{ "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", "contentVersion": "1.0.0.0", "parameters": { "adminPassword": { "type": "string" }, "adminUsername": { "type": "string" }, "dnsNameForPublicIP": { "type": "string" }, "osDiskName": { "type": "string" }, "storageAccountBlobEndpoint": { "type": "string" }, "vmName": { "type": "string" }, "vmSize": { "type": "string" } }, "variables": { "addressPrefix": "10.0.0.0/16", "apiVersion": "2015-06-15", "location": "[resourceGroup().location]", "nicName": "packerNic", "publicIPAddressName": "packerPublicIP", "publicIPAddressType": "Dynamic", "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", "subnetAddressPrefix": "10.0.0.0/24", "subnetName": "packerSubnet", "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", "virtualNetworkName": "packerNetwork", "vmStorageAccountContainerName": "images", "vnetID": "[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" }, "resources": [ { "apiVersion": "[variables('apiVersion')]", "name": "[variables('publicIPAddressName')]", "type": "Microsoft.Network/publicIPAddresses", "location": "[variables('location')]", "properties": { "dnsSettings": { "domainNameLabel": "[parameters('dnsNameForPublicIP')]" }, "publicIPAllocationMethod": "[variables('publicIPAddressType')]" } }, { "apiVersion": "[variables('apiVersion')]", "name": "[variables('virtualNetworkName')]", "type": "Microsoft.Network/virtualNetworks", "location": "[variables('location')]", "properties": { "addressSpace": { "addressPrefixes": [ "[variables('addressPrefix')]" ] }, "subnets": [ { "properties": { "addressPrefix": "[variables('subnetAddressPrefix')]" }, "name": "[variables('subnetName')]" } ] } }, { "apiVersion": "[variables('apiVersion')]", "name": "[variables('nicName')]", "type": "Microsoft.Network/networkInterfaces", "location": "[variables('location')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" ], "properties": { "ipConfigurations": [ { "properties": { "privateIPAllocationMethod": "Dynamic", "subnet": { "id": "[variables('subnetRef')]" }, "publicIPAddress": { "id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]" } }, "name": "ipconfig" } ] } }, { "apiVersion": "[variables('apiVersion')]", "name": "[parameters('vmName')]", "type": "Microsoft.Compute/virtualMachines", "location": "[variables('location')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]" ], "properties": { "diagnosticsProfile": { "bootDiagnostics": { "enabled": false } }, "hardwareProfile": { "vmSize": "[parameters('vmSize')]" }, "networkProfile": { "networkInterfaces": [ { "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]" } ] }, "osProfile": { "computerName": "[parameters('vmName')]", "adminUsername": "[parameters('adminUsername')]", "adminPassword": "[parameters('adminPassword')]", "windowsConfiguration": { "provisionVMAgent": true, "winRM": { "listeners": [ { "protocol": "https", "certificateUrl": "--test-winrm-certificate-url--" } ] } }, "secrets": [ { "sourceVault": { "id": "[resourceId(resourceGroup().name, 'Microsoft.KeyVault/vaults', '--test-key-vault-name')]" }, "vaultCertificates": [ { "certificateUrl": "--test-winrm-certificate-url--", "certificateStore": "My" } ] } ] }, "storageProfile": { "imageReference": { "publisher": "MicrosoftWindowsServer", "offer": "WindowsServer", "sku": "2012-R2-Datacenter", "version": "latest" }, "osDisk": { "name": "osdisk", "vhd": { "uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]" }, "caching": "ReadWrite", "createOption": "FromImage" } } } } ] }