Skip to content

Instantly share code, notes, and snippets.

@hnky
Created December 16, 2016 12:06
Show Gist options
  • Save hnky/27087a895789b591181c09a2da053387 to your computer and use it in GitHub Desktop.
Save hnky/27087a895789b591181c09a2da053387 to your computer and use it in GitHub Desktop.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {
"dtlName": "AzureChallenge",
"dtlId": "[resourceId('Microsoft.DevTestLab/labs', variables('dtlName'))]",
"dtlVnetName": "DevCampVnet",
"dtlVnetId": "[resourceId('Microsoft.DevTestLab/labs/virtualNetworks', variables('dtlName'), variables('dtlVnetName'))]",
"dtlVmName": "[concat('Dev', '-', take(uniqueString(resourceGroup().id), 4))]",
"dtlVmSizes": "\"Standard_DS1_v2\", \"Standard_DS2_v2\"",
"dtlVmSize": "Standard_DS2_v2",
"dtlVmStorage": "Premium",
"dtlShutdownTime": "21:00",
"dtlTimeZoneId": "UTC",
"dtlVmUsername": "l-admin",
"dtlVmPassword": "Devc@mp2016!",
"chocoPackages": "git-credential-winstore,webpicmd,eclipse,jre8,javaruntime"
},
"resources": [
{
"apiVersion": "2016-05-15",
"type": "Microsoft.DevTestLab/labs",
"name": "[variables('dtlName')]",
"location": "[resourceGroup().location]",
"resources": [
{
"apiVersion": "2016-05-15",
"name": "[variables('dtlVnetName')]",
"type": "virtualnetworks",
"dependsOn": [
"[variables('dtlId')]"
]
},
{
"apiVersion": "2016-05-15",
"name": "LabVmsShutdown",
"type": "schedules",
"dependsOn": [
"[variables('dtlId')]"
],
"properties": {
"status": "Enabled",
"timeZoneId": "[variables('dtlTimeZoneId')]",
"taskType": "LabVmsShutdownTask",
"dailyRecurrence": {
"time": "[replace(variables('dtlShutdownTime'), ':', '')]"
}
}
},
{
"apiVersion": "2016-05-15",
"name": "default/MaxVmsAllowedPerUser",
"type": "policysets/policies",
"dependsOn": [
"[variables('dtlId')]"
],
"properties": {
"description": "",
"factName": "UserOwnedLabVmCount",
"threshold": 5,
"evaluatorType": "MaxValuePolicy",
"status": "enabled"
}
},
{
"apiVersion": "2016-05-15",
"name": "default/MaxVmsAllowedPerLab",
"type": "policysets/policies",
"dependsOn": [
"[variables('dtlId')]"
],
"properties": {
"description": "",
"factName": "LabVmCount",
"threshold": 25,
"evaluatorType": "MaxValuePolicy",
"status": "enabled"
}
},
{
"apiVersion": "2016-05-15",
"name": "default/AllowedVmSizesInLab",
"type": "policysets/policies",
"dependsOn": [
"[variables('dtlId')]"
],
"properties": {
"description": "VM sizes allowed for creation in lab",
"factName": "LabVmSize",
"threshold": "[concat('[', trim(variables('dtlVmSizes')), ']')]",
"evaluatorType": "AllowedValuesPolicy",
"status": "enabled"
}
}
]
},
{
"apiVersion": "2016-05-15",
"type": "Microsoft.DevTestLab/labs/virtualmachines",
"name": "[concat(variables('dtlName'), '/', 'Win', variables('dtlVmName'))]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[variables('dtlVnetId')]"
],
"properties": {
"labVirtualNetworkId": "[variables('dtlVnetId')]",
"labSubnetName": "[concat(variables('dtlVnetName'), 'Subnet')]",
"notes": "WinServer 2012R2 DC + VS2015",
"galleryImageReference": {
"offer": "VisualStudio",
"publisher": "MicrosoftVisualStudio",
"sku": "VS-2015-Comm-VSU3-AzureSDK-291-WS2012R2",
"osType": "Windows",
"version": "latest"
},
"size": "[variables('dtlVmSize')]",
"storageType": "[variables('dtlVmStorage')]",
"userName": "[variables('dtlVmUsername')]",
"password": "[variables('dtlVmPassword')]",
"isAuthenticationWithSshKey": false,
"disallowPublicIpAddress": false,
"allowClaim": false,
"artifacts": [
{
"artifactId": "[resourceId('Microsoft.DevTestLab/labs/artifactSources/artifacts', variables('dtlName'), 'public repo', 'windows-chrome')]"
},
{
"artifactId": "[resourceId('Microsoft.DevTestLab/labs/artifactSources/artifacts', variables('dtlName'), 'public repo', 'windows-git')]"
},
{
"artifactId": "[resourceId('Microsoft.DevTestLab/labs/artifactSources/artifacts', variables('dtlName'), 'public repo', 'windows-powershell3')]"
},
{
"artifactId": "[resourceId('Microsoft.DevTestLab/labs/artifactSources/artifacts', variables('dtlName'), 'public repo', 'windows-azurepowershell')]"
},
{
"artifactId": "[resourceId('Microsoft.DevTestLab/labs/artifactSources/artifacts', variables('dtlName'), 'public repo', 'windows-dotnet45')]"
},
{
"artifactId": "[resourceId('Microsoft.DevTestLab/labs/artifactSources/artifacts', variables('dtlName'), 'public repo', 'windows-vscode')]"
},
{
"artifactId": "[resourceId('Microsoft.DevTestLab/labs/artifactSources/artifacts', variables('dtlName'), 'public repo', 'windows-chocolatey')]",
"parameters": [
{
"name": "packages",
"value": "[variables('chocoPackages')]"
}
]
}
]
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment