tests/functional/Microsoft.Compute/virtualMachines/deploy/deploy.json
{ "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "location": { "type": "string" }, "networkInterfaceName": { "type": "string" }, "networkSecurityGroupName": { "type": "string" }, "networkSecurityGroupRules": { "type": "array" }, "subnetName": { "type": "string" }, "virtualNetworkName": { "type": "string" }, "addressPrefixes": { "type": "array" }, "subnets": { "type": "array" }, "virtualMachineName": { "type": "string" }, "virtualMachineComputerName": { "type": "string" }, "osDiskType": { "type": "string" }, "osDiskDeleteOption": { "type": "string" }, "virtualMachineSize": { "type": "string" }, "nicDeleteOption": { "type": "string" }, "adminUsername": { "type": "string" }, "adminPassword": { "defaultValue": "[guid(resourceGroup().id)]", "type": "secureString" }, "patchMode": { "type": "string" }, "enableHotpatching": { "type": "bool" } }, "variables": { "nsgId": "[resourceId(resourceGroup().name, 'Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroupName'))]", "vnetId": "[resourceId(resourceGroup().name,'Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]", "subnetRef": "[concat(variables('vnetId'), '/subnets/', parameters('subnetName'))]" }, "resources": [ { "name": "[parameters('networkInterfaceName')]", "type": "Microsoft.Network/networkInterfaces", "apiVersion": "2021-03-01", "location": "[parameters('location')]", "dependsOn": [ "[concat('Microsoft.Network/networkSecurityGroups/', parameters('networkSecurityGroupName'))]", "[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]" ], "properties": { "ipConfigurations": [ { "name": "ipconfig1", "properties": { "subnet": { "id": "[variables('subnetRef')]" }, "privateIPAllocationMethod": "Dynamic" } } ], "networkSecurityGroup": { "id": "[variables('nsgId')]" } } }, { "name": "[parameters('networkSecurityGroupName')]", "type": "Microsoft.Network/networkSecurityGroups", "apiVersion": "2019-02-01", "location": "[parameters('location')]", "properties": { "securityRules": "[parameters('networkSecurityGroupRules')]" } }, { "name": "[parameters('virtualNetworkName')]", "type": "Microsoft.Network/virtualNetworks", "apiVersion": "2020-11-01", "location": "[parameters('location')]", "properties": { "addressSpace": { "addressPrefixes": "[parameters('addressPrefixes')]" }, "subnets": "[parameters('subnets')]" } }, { "name": "[parameters('virtualMachineName')]", "type": "Microsoft.Compute/virtualMachines", "apiVersion": "2021-07-01", "location": "[parameters('location')]", "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', parameters('networkInterfaceName'))]" ], "properties": { "hardwareProfile": { "vmSize": "[parameters('virtualMachineSize')]" }, "storageProfile": { "osDisk": { "createOption": "fromImage", "managedDisk": { "storageAccountType": "[parameters('osDiskType')]" }, "deleteOption": "[parameters('osDiskDeleteOption')]" }, "imageReference": { "publisher": "MicrosoftWindowsServer", "offer": "WindowsServer", "sku": "2022-datacenter-azure-edition", "version": "latest" } }, "networkProfile": { "networkInterfaces": [ { "id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName'))]", "properties": { "deleteOption": "[parameters('nicDeleteOption')]" } } ] }, "osProfile": { "computerName": "[parameters('virtualMachineComputerName')]", "adminUsername": "[parameters('adminUsername')]", "adminPassword": "[parameters('adminPassword')]", "windowsConfiguration": { "enableAutomaticUpdates": true, "provisionVmAgent": true, "patchSettings": { "enableHotpatching": "[parameters('enableHotpatching')]", "patchMode": "[parameters('patchMode')]" } } }, "diagnosticsProfile": { "bootDiagnostics": { "enabled": true } } } } ] } |