Skip to content

Instantly share code, notes, and snippets.

@yaegashi
Last active February 12, 2020 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yaegashi/44cb8bbfcc383431387b70207da801e0 to your computer and use it in GitHub Desktop.
Save yaegashi/44cb8bbfcc383431387b70207da801e0 to your computer and use it in GitHub Desktop.
Create DevTest Lab attached to exsiting VNet/Subnet (redacted ARM template)
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {...},
"variables": {...},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"name": "subnetTemplate",
"apiVersion": "2017-05-10",
"resourceGroup": "[variables('labVirtualNetworkResourceGroup')]",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [
{
"apiVersion": "2017-10-01",
"type": "Microsoft.Network/virtualNetworks/subnets",
"location": "[resourceGroup().location]",
"name": "[concat(variables('labVirtualNetworkName'), '/', parameters('labName'))]",
"properties": {
"addressPrefix": "[parameters('labSubnetAddressPrefix')]"
}
}
]
},
"parameters": {}
}
},
{
"name": "[parameters('labName')]",
"type": "Microsoft.DevTestLab/labs",
"apiVersion": "2018-09-15",
"location": "[resourceGroup().location]",
"tags": {
"DTL": "[parameters('labName')]"
},
"properties": {
"announcement": {
"title": "[parameters('labAnnouncementTitle')]",
"markdown": "[parameters('labAnnouncementMarkdown')]",
"enabled": "Enabled",
"expirationDate": null,
"expired": false
},
"support": {
"enabled": "Enabled",
"markdown": "[parameters('labSupportMarkdown')]"
}
},
"resources": [
{
"type": "schedules",
"name": "LabVmsShutdown",
"apiVersion": "2017-04-26-preview",
"location": "[resourceGroup().location]",
"properties": {
"status": "Enabled",
"timeZoneId": "Tokyo Standard Time",
"dailyRecurrence": {
"time": "2200"
},
"taskType": "LabVmsShutdownTask",
"notificationSettings": {
"status": "Disabled",
"timeInMinutes": 30
}
},
"dependsOn": [
"[resourceId('Microsoft.DevTestLab/labs', parameters('labName'))]"
]
},
{
"type": "virtualnetworks",
"name": "[variables('labVirtualNetworkName')]",
"apiVersion": "2017-04-26-preview",
"location": "[resourceGroup().location]",
"properties": {
"externalProviderResourceId": "[variables('labVirtualNetworkId')]",
"subnetOverrides": [
{
"name": "[parameters('labName')]",
"resourceId": "[variables('labSubnetId')]",
"useInVmCreationPermission": "Allow",
"usePublicIpAddressPermission": "Allow",
"sharedPublicIpAddressConfiguration": {
"allowedPorts": [
{
"transportProtocol": "tcp",
"backendPort": 3389
},
{
"transportProtocol": "tcp",
"backendPort": 22
}
]
}
}
]
},
"dependsOn": [
"[resourceId('Microsoft.DevTestLab/labs', parameters('labName'))]"
]
}
],
"dependsOn": [
"subnetTemplate"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment