Last active
October 10, 2017 18:54
-
-
Save mmckechney/9bb5c26dc20736d8b94a74927f1b53cf to your computer and use it in GitHub Desktop.
JSON template to create a DevTest lab from a custom image
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": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"newVMName": { | |
"type": "string", | |
"metadata": { | |
"description": "Name of an VM to be created" | |
} | |
}, | |
"labName": { | |
"type": "string", | |
"metadata": { | |
"description": "Name of the DevTest lab to create the VM in" | |
} | |
}, | |
"size": { | |
"type": "string", | |
"metadata": { | |
"description": "Size of the VM. Make sure the lab allows this size." | |
} | |
}, | |
"customImageName": { | |
"type": "string", | |
"metadata": { | |
"description": "Name of the lab's custom image" | |
} | |
}, | |
"virtualNetworkName": { | |
"type": "string", | |
"metadata": { | |
"description": "Name of the VNET for the VM" | |
} | |
}, | |
"subNetName": { | |
"type": "string", | |
"metadata": { | |
"description": "Name of the subnet to put the VM in" | |
} | |
}, | |
"userName": { | |
"type": "string", | |
"metadata": { | |
"description": "User name for the VM" | |
} | |
}, | |
"password": { | |
"type": "securestring", | |
"metadata": { | |
"description": "Password for the VM" | |
} | |
} | |
}, | |
"variables": { | |
"labSubnetName": "[parameters('subNetName')]", | |
"labVirtualNetworkId": "[resourceId('Microsoft.DevTestLab/labs/virtualnetworks', parameters('labName'), variables('labVirtualNetworkName'))]", | |
"labVirtualNetworkName": "[parameters('virtualNetworkName')]", | |
"vmId": "[resourceId ('Microsoft.DevTestLab/labs/virtualmachines', parameters('labName'), parameters('newVMName'))]", | |
"vmName": "[concat(parameters('labName'), '/', parameters('newVMName'))]", | |
"labnameUri": "[resourceId('microsoft.devtestlab/labs',parameters('labName'))]", | |
"imageName":"[concat(variables('labnameUri'), '/', 'customimages/', '/', parameters('customImageName'))]" | |
}, | |
"resources": [ | |
{ | |
"apiVersion": "2017-04-26-preview", | |
"type": "Microsoft.DevTestLab/labs/virtualmachines", | |
"name": "[variables('vmName')]", | |
"location": "[resourceGroup().location]", | |
"properties": { | |
"labVirtualNetworkId": "[variables('labVirtualNetworkId')]", | |
"notes": "", | |
"customImageId": "[variables('imageName')]", | |
"size": "[parameters('size')]", | |
"userName": "[parameters('userName')]", | |
"password": "[parameters('password')]", | |
"isAuthenticationWithSshKey": false, | |
"labSubnetName": "[variables('labSubnetName')]", | |
"disallowPublicIpAddress": false, | |
"storageType": "Premium", | |
"allowClaim": false | |
} | |
} | |
], | |
"outputs": { | |
"labVMId": { | |
"type": "string", | |
"value": "[variables('vmId')]" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment