Skip to content

Instantly share code, notes, and snippets.

@yaegashi
Last active Feb 12, 2020
Embed
What would you like to do?
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