Created
April 10, 2017 12:26
-
-
Save marrobi/c0fb80a095e22950170f0870a0503a62 to your computer and use it in GitHub Desktop.
DevTest Lab Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"newLabName": { | |
"type": "string", | |
"defaultValue": "MyDevTestLab", | |
"metadata": { | |
"description": "The name of the new lab instance to be created" | |
} | |
}, | |
"artifactRepositoryDisplayName": { | |
"type": "string" | |
}, | |
"artifactRepoUri": { | |
"type": "string", | |
"defaultValue": "https://github.com/marrobi/azure-devtestlab.git" | |
}, | |
"artifactRepoBranch": { | |
"type": "string", | |
"defaultValue": "master" | |
}, | |
"artifactRepoFolder": { | |
"type": "string", | |
"defaultValue": "Artifacts/" | |
}, | |
"artifactRepoType": { | |
"type": "string", | |
"defaultValue": "GitHub", | |
"allowedValues": [ "VsoGit", "GitHub" ] | |
}, | |
"artifactRepoSecurityToken": { | |
"type": "securestring" | |
} | |
}, | |
"variables": { | |
"privateRepoName": "[concat('Repo-', uniqueString(subscription().subscriptionId))]", | |
"labVirtualNetworkName": "[concat('Dtl', parameters('newLabName'))]", | |
"labVirtualNetworkId": "[concat('/virtualnetworks/', variables('labVirtualNetworkName'))]", | |
"DevTestLabNetworkPrefix": "10.0.0.0/16", | |
"DevTestLabNetworkSubnet1Name": "Subnet-1", | |
"DevTestLabNetworkSubnet1Prefix": "10.0.0.0/24", | |
"existingSubnetId": "[concat(resourceId('Microsoft.Network/virtualNetworks', variables('labVirtualNetworkName')), '/subnets/', variables('DevTestLabNetworkSubnet1Name'))]", | |
"ostype": "windows", | |
"privateRepoId": "[resourceId('Microsoft.DevTestLab/labs/artifactSources', parameters('newLabName'), variables('privateRepoName'))]" | |
}, | |
"resources": [ | |
{ | |
"name": "[variables('labVirtualNetworkName')]", | |
"type": "Microsoft.Network/virtualNetworks", | |
"location": "[resourceGroup().location]", | |
"apiVersion": "2016-03-30", | |
"dependsOn": [], | |
"tags": { | |
"displayName": "[variables('labVirtualNetworkName')]" | |
}, | |
"properties": { | |
"addressSpace": { | |
"addressPrefixes": [ | |
"[variables('DevTestLabNetworkPrefix')]" | |
] | |
}, | |
"subnets": [ | |
{ | |
"name": "[variables('DevTestLabNetworkSubnet1Name')]", | |
"properties": { | |
"addressPrefix": "[variables('DevTestLabNetworkSubnet1Prefix')]" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"apiVersion": "2016-05-15", | |
"type": "Microsoft.DevTestLab/labs", | |
"name": "[parameters('newLabName')]", | |
"location": "[resourceGroup().location]", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Network/virtualNetworks', variables('labVirtualNetworkName'))]" | |
], | |
"resources": [ | |
{ | |
"apiVersion": "2016-05-15", | |
"name": "[variables('labVirtualNetworkName')]", | |
"type": "virtualnetworks", | |
"properties": { | |
"externalProviderResourceId": "[resourceId('Microsoft.Network/virtualNetworks', variables('labVirtualNetworkName'))]", | |
"subnetOverrides": [ | |
{ | |
"name": "[variables('DevTestLabNetworkSubnet1Name')]", | |
"resourceId": "[variables('existingSubnetId')]", | |
"useInVmCreationPermission": "Allow", | |
"usePublicIpAddressPermission": "Default", | |
"sharedPublicIpAddressConfiguration": { | |
"allowedPorts": [ | |
{ | |
"transportProtocol": "tcp", | |
"backendPort": 3389 | |
}, | |
{ | |
"transportProtocol": "tcp", | |
"backendPort": 22 | |
} | |
] | |
} | |
} | |
] | |
}, | |
"dependsOn": [ | |
"[resourceId('Microsoft.DevTestLab/labs', parameters('newLabName'))]" | |
] | |
}, | |
{ | |
"apiVersion": "2016-05-15", | |
"name": "[variables('privateRepoName')]", | |
"type": "artifactsources", | |
"dependsOn": [ | |
"[resourceId('Microsoft.DevTestLab/labs', parameters('newLabName'))]" | |
], | |
"properties": { | |
"uri": "[parameters('artifactRepoUri')]", | |
"folderPath": "[parameters('artifactRepoFolder')]", | |
"branchRef": "[parameters('artifactRepoBranch')]", | |
"displayName": "[parameters('artifactRepositoryDisplayName')]", | |
"securityToken": "[parameters('artifactRepoSecurityToken')]", | |
"sourceType": "[parameters('artifactRepoType')]", | |
"status": "Enabled" | |
} | |
} | |
] | |
}, | |
{ | |
"type": "Microsoft.DevTestLab/labs/formulas", | |
"name": "[concat(parameters('newLabName'), '/', 'BuildAgent')]", | |
"location": "[resourceGroup().location]", | |
"apiversion": "2016-05-15", | |
"dependsOn": [ | |
"[resourceId('Microsoft.DevTestLab/labs/artifactSources', parameters('newLabName'), variables('privateRepoName'))]" | |
], | |
"properties": { | |
"description": "Formula for build agent.", | |
"ostype": "[variables('ostype')]", | |
"formulacontent": { | |
"properties": { | |
"size": "Standard_D2_v2", | |
"username": "", | |
"password": "", | |
"labsubnetname": "DevTestLabNetworkSubnet1Name", | |
"labvirtualnetworkid": "[variables('labVirtualNetworkId')]", | |
"artifacts": [ | |
{ | |
"artifactId": "[concat('/artifactsources/',variables('privateRepoName'), '/Artifacts/windows-chocolatey')]", | |
"parameters": [ { "packages": "jdk8,ant,eclipse,nodejs.install,dotnet4.5,git.install,firefox,googlechrome,selenium-chrome-driver,selenium-ie-driver" } ] | |
}, | |
{ | |
"artifactid": "[concat('/artifactsources/',variables('privateRepoName'), '/Artifacts/windows-adobe-flex-sdk')]", | |
"parameters": [] | |
}, | |
{ | |
"artifactid": "[concat('/artifactsources/',variables('privateRepoName'),'/Artifacts/windows-selenium-server')]", | |
"parameters": [] | |
}, | |
{ | |
"artifactid": "[concat('/artifactsources/',variables('privateRepoName'),'/Artifacts/windows-docker')]", | |
"parameters": [] | |
} | |
], | |
"galleryimagereference": { | |
"offer": "VisualStudio", | |
"publisher": "MicrosoftVisualStudio", | |
"sku": "VS-2017-Comm-WS2016", | |
"ostype": "[variables('ostype')]", | |
"version": "latest" | |
} | |
} | |
} | |
} | |
} | |
], | |
"outputs": { | |
"labId": { | |
"type": "string", | |
"value": "[resourceId('Microsoft.DevTestLab/labs', parameters('newLabName'))]" | |
}, | |
"privateRepoId": { | |
"type": "string", | |
"value": "[resourceId('Microsoft.DevTestLab/labs/artifactSources', parameters('newLabName'), variables('privateRepoName'))]" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment