Created
June 13, 2016 23:15
-
-
Save rupertbenbrook/d56a61bc413c72dc4d519ac8b46e2888 to your computer and use it in GitHub Desktop.
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": { | |
"deploymentLocation": { | |
"defaultValue": "westeurope", | |
"type": "string" | |
}, | |
"vmSize": { | |
"defaultValue": "Standard_D1_v2", | |
"type": "string" | |
}, | |
"numberOfVms": { | |
"defaultValue": 2, | |
"type": "int" | |
}, | |
"namePrefix": { | |
"type": "string" | |
}, | |
"adminUsername": { | |
"type": "string" | |
}, | |
"adminPassword": { | |
"type": "securestring" | |
}, | |
"virtualNetworkAddressSpace": { | |
"defaultValue": "192.168.0.0", | |
"type": "string" | |
}, | |
"storageAccountType": { | |
"defaultValue": "Standard_LRS", | |
"type": "string" | |
} | |
}, | |
"resources": [ | |
{ | |
"type": "Microsoft.Compute/availabilitySets", | |
"name": "[concat(parameters('namePrefix'),'avail')]", | |
"apiVersion": "2015-06-15", | |
"location": "[parameters('deploymentLocation')]", | |
"properties": { | |
"platformUpdateDomainCount": 5, | |
"platformFaultDomainCount": 3 | |
} | |
}, | |
{ | |
"type": "Microsoft.Compute/virtualMachines", | |
"name": "[concat(parameters('namePrefix'),'vm',copyIndex(1))]", | |
"apiVersion": "2015-06-15", | |
"location": "[parameters('deploymentLocation')]", | |
"copy": { | |
"name": "copyVm", | |
"count" : "[parameters('numberOfVms')]" | |
}, | |
"properties": { | |
"availabilitySet": { | |
"id": "[resourceId('Microsoft.Compute/availabilitySets', concat(parameters('namePrefix'),'avail'))]" | |
}, | |
"hardwareProfile": { | |
"vmSize": "[parameters('vmSize')]" | |
}, | |
"storageProfile": { | |
"imageReference": { | |
"publisher": "MicrosoftWindowsServer", | |
"offer": "WindowsServer", | |
"sku": "2012-R2-Datacenter", | |
"version": "latest" | |
}, | |
"osDisk": { | |
"name": "[concat(parameters('namePrefix'),'vm',copyIndex(1))]", | |
"createOption": "FromImage", | |
"vhd": { | |
"uri": "[concat('https', '://', parameters('namePrefix'), 'store.blob.core.windows.net/vhds/', parameters('namePrefix'),'vm',copyIndex(1),'-os.vhd')]" | |
}, | |
"caching": "ReadWrite" | |
}, | |
"dataDisks": [ ] | |
}, | |
"osProfile": { | |
"computerName": "[concat(parameters('namePrefix'),'vm',copyIndex(1))]", | |
"adminUsername": "[parameters('adminUsername')]", | |
"adminPassword": "[parameters('adminPassword')]", | |
"windowsConfiguration": { | |
"provisionVMAgent": true, | |
"enableAutomaticUpdates": true | |
}, | |
"secrets": [ ] | |
}, | |
"networkProfile": { | |
"networkInterfaces": [ | |
{ | |
"id": "[resourceId('Microsoft.Network/networkInterfaces', concat(parameters('namePrefix'),'vm',copyIndex(1),'nic'))]" | |
} | |
] | |
}, | |
"diagnosticsProfile": { | |
"bootDiagnostics": { | |
"enabled": true, | |
"storageUri": "[concat('https', '://', parameters('namePrefix'), 'store.blob.core.windows.net/')]" | |
} | |
} | |
}, | |
"dependsOn": [ | |
"[resourceId('Microsoft.Compute/availabilitySets', concat(parameters('namePrefix'),'avail'))]", | |
"[resourceId('Microsoft.Storage/storageAccounts', concat(parameters('namePrefix'),'store'))]", | |
"[resourceId('Microsoft.Network/networkInterfaces', concat(parameters('namePrefix'),'vm',copyIndex(1),'nic'))]" | |
] | |
}, | |
{ | |
"type": "Microsoft.Network/networkInterfaces", | |
"name": "[concat(parameters('namePrefix'),'vm',copyIndex(1),'nic')]", | |
"apiVersion": "2016-03-30", | |
"location": "[parameters('deploymentLocation')]", | |
"copy": { | |
"name": "copyVmNic", | |
"count": "[parameters('numberOfVms')]" | |
}, | |
"properties": { | |
"ipConfigurations": [ | |
{ | |
"name": "ipconfig1", | |
"properties": { | |
"privateIPAllocationMethod": "Dynamic", | |
"publicIPAddress": { | |
"id": "[resourceId('Microsoft.Network/publicIPAddresses', concat(parameters('namePrefix'),'vm',copyIndex(1),'pip'))]" | |
}, | |
"subnet": { | |
"id": "[concat(resourceId('Microsoft.Network/virtualNetworks', parameters('namePrefix')), 'vnet/subnets/default')]" | |
}, | |
"primary": true, | |
"privateIPAddressVersion": "IPv4" | |
} | |
} | |
], | |
"enableIPForwarding": false, | |
"networkSecurityGroup": { | |
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', concat(parameters('namePrefix'),'vmnsg'))]" | |
} | |
}, | |
"dependsOn": [ | |
"[resourceId('Microsoft.Network/publicIPAddresses', concat(parameters('namePrefix'),'vm',copyIndex(1),'pip'))]", | |
"[resourceId('Microsoft.Network/virtualNetworks', concat(parameters('namePrefix'),'vnet'))]", | |
"[resourceId('Microsoft.Network/networkSecurityGroups', concat(parameters('namePrefix'),'vmnsg'))]" | |
] | |
}, | |
{ | |
"type": "Microsoft.Network/networkSecurityGroups", | |
"name": "[concat(parameters('namePrefix'),'vmnsg')]", | |
"apiVersion": "2016-03-30", | |
"location": "[parameters('deploymentLocation')]", | |
"properties": { | |
"securityRules": [ | |
{ | |
"name": "default-allow-rdp", | |
"properties": { | |
"protocol": "*", | |
"sourcePortRange": "*", | |
"destinationPortRange": "3389", | |
"sourceAddressPrefix": "*", | |
"destinationAddressPrefix": "*", | |
"access": "Allow", | |
"priority": 1000, | |
"direction": "Inbound" | |
} | |
}, | |
{ | |
"name": "AllowHTTP", | |
"properties": { | |
"protocol": "*", | |
"sourcePortRange": "*", | |
"destinationPortRange": "80", | |
"sourceAddressPrefix": "*", | |
"destinationAddressPrefix": "*", | |
"access": "Allow", | |
"priority": 1010, | |
"direction": "Inbound" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "Microsoft.Network/publicIPAddresses", | |
"name": "[concat(parameters('namePrefix'),'vm',copyIndex(1),'pip')]", | |
"apiVersion": "2016-03-30", | |
"location": "[parameters('deploymentLocation')]", | |
"copy": { | |
"name": "copyVmPip", | |
"count": "[parameters('numberOfVms')]" | |
}, | |
"properties": { | |
"publicIPAllocationMethod": "Dynamic", | |
"idleTimeoutInMinutes": 4, | |
"dnsSettings": { | |
"domainNameLabel": "[concat(parameters('namePrefix'),'vm',copyIndex(1),'pip')]", | |
"fqdn": "[concat(parameters('namePrefix'),'vm',copyIndex(1),'pip.',parameters('deploymentLocation'),'.cloudapp.azure.com')]" | |
} | |
} | |
}, | |
{ | |
"type": "Microsoft.Network/virtualNetworks", | |
"name": "[concat(parameters('namePrefix'),'vnet')]", | |
"apiVersion": "2016-03-30", | |
"location": "[parameters('deploymentLocation')]", | |
"properties": { | |
"addressSpace": { | |
"addressPrefixes": [ | |
"[concat(parameters('virtualNetworkAddressSpace'),'/16')]" | |
] | |
}, | |
"subnets": [ | |
{ | |
"name": "default", | |
"properties": { | |
"addressPrefix": "[concat(parameters('virtualNetworkAddressSpace'),'/24')]" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "Microsoft.Storage/storageAccounts", | |
"name": "[concat(parameters('namePrefix'),'store')]", | |
"apiVersion": "2015-06-15", | |
"location": "[parameters('deploymentLocation')]", | |
"tags": { }, | |
"properties": { | |
"accountType": "[parameters('storageAccountType')]" | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Click the button below to deploy this template to Azure.