"resources": [ { "apiVersion": "2016-04-30-preview", "type": "Microsoft.Compute/virtualMachines", "name": "[concat('myVM', copyindex())]", "location": "[resourceGroup().location]", "copy": { "name": "virtualMachineLoop", "count": "[parameters('numberOfInstances')]" }, "dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/myNIC', copyindex())]" ], "properties": { "hardwareProfile": { "vmSize": "Standard_DS1" }, "osProfile": { "computername": "[concat('myVM', copyindex())]", "adminUsername": "[parameters('adminUsername')]", "adminPassword": "[parameters('adminPassword')]" }, "storageProfile": { "imageReference": { "publisher": "MicrosoftWindowsServer", "offer": "WindowsServer", "sku": "2012-R2-Datacenter", "version": "latest" }, "osDisk": { "name": "[concat('myOSDisk', copyindex())]", "caching": "ReadWrite", "createOption": "FromImage" }, "dataDisks": [ { "name": "[concat('myDataDisk', copyindex())]", "diskSizeGB": "100", "lun": 0, "createOption": "Empty" } ] }, "networkProfile": { "networkInterfaces": [ { "id": "[resourceId('Microsoft.Network/networkInterfaces', concat('myNIC', copyindex()))]" } ] }, "diagnosticsProfile": { "bootDiagnostics": { "enabled": "true", "storageUri": "[concat('https://', variables('storageName'), '.blob.core.windows.net')]" } } }, "resources": [ { "name": "Microsoft.Insights.VMDiagnosticsSettings", "type": "extensions", "location": "[resourceGroup().location]", "apiVersion": "2016-03-30", "dependsOn": [ "[concat('Microsoft.Compute/virtualMachines/myVM', copyindex())]" ], "properties": { "publisher": "Microsoft.Azure.Diagnostics", "type": "IaaSDiagnostics", "typeHandlerVersion": "1.5", "autoUpgradeMinorVersion": true, "settings": { "xmlCfg": "[base64(concat(variables('wadcfgxstart'), variables('wadmetricsresourceid'), concat('myVM', copyindex()), variables('wadcfgxend')))]", "storageAccount": "[variables('storageName')]" }, "protectedSettings": { "storageAccountName": "[variables('storageName')]", "storageAccountKey": "[listkeys(variables('accountid'), '2015-06-15').key1]", "storageAccountEndPoint": "https://core.windows.net" } } }, { "name": "MyCustomScriptExtension", "type": "extensions", "apiVersion": "2016-03-30", "location": "[resourceGroup().location]", "dependsOn": [ "[concat('Microsoft.Compute/virtualMachines/myVM', copyindex())]" ], "properties": { "publisher": "Microsoft.Compute", "type": "CustomScriptExtension", "typeHandlerVersion": "1.7", "autoUpgradeMinorVersion": true, "settings": { "fileUris": [ "[concat('https://', variables('storageName'), '.blob.core.windows.net/customscripts/start.ps1')]" ], "commandToExecute": "powershell.exe -ExecutionPolicy Unrestricted -File start.ps1" } } } ] } ]