{ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "adminUsername": { "type": "string", "metadata": { "description": "User name for the Virtual Machine." } }, "adminPassword": { "type": "securestring", "metadata": { "description": "Password for the Virtual Machine." } }, "vmName": { "type": "string", "metadata": { "description": "Name for the Virtual Machine." } }, "fileUris": { "type": "string", "defaultValue": "", "metadata": { "description": "The uri of script file." } }, "commandToExecute": { "type": "string", "metadata": { "description": "The command to execute." } } }, "variables": { "computeResouresApiVersion": "2016-04-30-preview", "dataDisk1Name": "[concat(uniquestring(parameters('vmName')), 'datadisk1')]", "imagePublisher": "OpenLogic", "imageOffer": "CentOS", "imageSku": "7.3", "OSDiskName": "[concat(uniquestring(parameters('vmName')), 'osdisk')]", "nicName": "[concat(uniquestring(parameters('vmName')), 'nic')]", "publicIPAddressName": "[concat(uniquestring(parameters('vmName')), 'publicip')]", "publicIPAddressType": "Dynamic", "vmSize": "Standard_E8s_v3", "virtualNetworkName": "VNET01", "vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]", "extensionName": "CustomScript", "subnetName": "VSNET01", "subnetRef": "[concat(variables('vnetID'), '/subnets/', variables('subnetName'))]" }, "resources": [ { "apiVersion": "2015-06-15", "type": "Microsoft.Network/publicIPAddresses", "name": "[variables('publicIPAddressName')]", "location": "[resourceGroup().location]", "properties": { "publicIPAllocationMethod": "[variables('publicIPAddressType')]" } }, { "apiVersion": "2015-06-15", "type": "Microsoft.Network/networkInterfaces", "name": "[variables('nicName')]", "location": "[resourceGroup().location]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]" ], "properties": { "ipConfigurations": [ { "name": "ipconfig1", "properties": { "privateIPAllocationMethod": "Dynamic", "publicIPAddress": { "id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]" }, "subnet": { "id": "[variables('subnetRef')]" } } } ] } }, { "apiVersion": "2016-04-30-preview", "type": "Microsoft.Compute/virtualMachines", "name": "[parameters('vmName')]", "location": "[resourceGroup().location]", "tags": { "Tag1": "ManagedVM" }, "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]" ], "properties": { "hardwareProfile": { "vmSize": "[variables('vmSize')]" }, "osProfile": { "computerName": "[parameters('vmName')]", "adminUsername": "[parameters('adminUsername')]", "adminPassword": "[parameters('adminPassword')]" }, "storageProfile": { "imageReference": { "publisher": "[variables('imagePublisher')]", "offer": "[variables('imageOffer')]", "sku": "[variables('imageSku')]", "version": "latest" }, "dataDisks": [ { "name": "[variables('dataDisk1Name')]", "diskSizeGB": "500", "lun": 0, "createOption": "Empty" } ] }, "networkProfile": { "networkInterfaces": [ { "id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]" } ] } } }, { "type": "Microsoft.Compute/virtualMachines/extensions", "name": "[concat(parameters('vmName'),'/', variables('extensionName'))]", "apiVersion": "2015-06-15", "location": "[resourceGroup().location]", "dependsOn": [ "[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" ], "properties": { "publisher": "Microsoft.Azure.Extensions", "type": "CustomScript", "typeHandlerVersion": "2.0", "autoUpgradeMinorVersion": true, "settings": { "fileUris": "[split(parameters('fileUris'), ' ')]", "commandToExecute": "[parameters('commandToExecute')]" } } } ] }