Created
April 30, 2016 03:09
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": { | |
"numOfInstances" : { | |
"type" : "int", | |
"defaultValue" : 2 | |
}, | |
"storageAccountName": { | |
"type": "string", | |
"metadata": { | |
"description": "Storage Account Name" | |
} | |
}, | |
"virtualNetworkName": { | |
"type": "string", | |
"metadata": { | |
"description": "Virtual Network Name" | |
} | |
}, | |
"subnetName": { | |
"type": "string", | |
"metadata": { | |
"description": "Subnet Name" | |
} | |
}, | |
"vmName": { | |
"type": "string", | |
"metadata": { | |
"description": "Name of the VM" | |
} | |
}, | |
"vmSize": { | |
"type": "string", | |
"defaultValue": "Standard_A2", | |
"metadata": { | |
"description": "Size of the VM" | |
} | |
}, | |
"imageSKU": { | |
"type": "string", | |
"defaultValue": "2012-R2-Datacenter", | |
"allowedValues": [ | |
"2008-R2-SP1", | |
"2012-Datacenter", | |
"2012-R2-Datacenter" | |
], | |
"metadata": { | |
"description": "Image SKU" | |
} | |
}, | |
"adminUsername": { | |
"type": "string", | |
"metadata": { | |
"description": "Admin username" | |
} | |
}, | |
"adminPassword": { | |
"type": "securestring", | |
"metadata": { | |
"description": "Admin password" | |
} | |
}, | |
"modulesUrl": { | |
"type": "string", | |
"metadata": { | |
"description": "URL for the DSC configuration module. NOTE: Can be a Github url(raw) to the zip file" | |
} | |
}, | |
"configurationFunction": { | |
"type": "string", | |
"defaultValue": "ContosoWebsite.ps1\\ContosoWebsite", | |
"metadata": { | |
"description": "DSC configuration function to call" | |
} | |
} | |
}, | |
"variables": { | |
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]", | |
"subnetRef": "[concat(variables('vnetID'),'/subnets/', parameters('subnetName'))]", | |
"publicIPAddressType": "Dynamic", | |
"publicIPAddressName": "dscPubIP", | |
"nicName": "dscNIC", | |
"imagePublisher": "MicrosoftWindowsServer", | |
"imageOffer": "WindowsServer", | |
"vmExtensionName": "dscExtension", | |
"location" : "[resourceGroup().location]", | |
"asName" : "websvras" | |
}, | |
"resources": [ | |
{ | |
"apiVersion": "2015-05-01-preview", | |
"type": "Microsoft.Network/publicIPAddresses", | |
"name": "[concat(variables('publicIPAddressName'),copyIndex())]", | |
"location": "[variables('location')]", | |
"copy" : { | |
"name" : "publicIpCopy", | |
"count" : "[parameters('numOfInstances')]" | |
}, | |
"properties": { | |
"publicIPAllocationMethod": "[variables('publicIPAddressType')]" | |
} | |
}, | |
{ | |
"apiVersion": "2015-05-01-preview", | |
"type": "Microsoft.Network/networkInterfaces", | |
"name": "[concat(variables('nicName'), copyIndex())]", | |
"location": "[variables('location')]", | |
"copy" : { | |
"name" : "nicCopy", | |
"count" : "[parameters('numOfInstances')]" | |
}, | |
"dependsOn": [ | |
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'), copyIndex())]" | |
], | |
"properties": { | |
"ipConfigurations": [ | |
{ | |
"name": "ipconfig1", | |
"properties": { | |
"privateIPAllocationMethod": "Dynamic", | |
"publicIPAddress": { | |
"id": "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('publicIPAddressName'),copyIndex()))]" | |
}, | |
"subnet": { | |
"id": "[variables('subnetRef')]" | |
} | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"apiVersion": "2015-06-15", | |
"type": "Microsoft.Compute/availabilitySets", | |
"name": "[variables('asName')]", | |
"location": "[resourceGroup().location]", | |
"properties": {} | |
}, | |
{ | |
"apiVersion": "2015-05-01-preview", | |
"type": "Microsoft.Compute/virtualMachines", | |
"name": "[concat(parameters('vmName'), copyIndex())]", | |
"location": "[variables('location')]", | |
"dependsOn": [ | |
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'), copyIndex())]", | |
"[concat('Microsoft.Compute/availabilitySets/', variables('asName'))]" | |
], | |
"copy" : { | |
"name" : "vmCopy", | |
"count" : "[parameters('numOfInstances')]" | |
}, | |
"properties": { | |
"availabilitySet": { | |
"id" : "[concat(resourceId('Microsoft.Compute/availabilitySets', variables('asName')))]" | |
}, | |
"hardwareProfile": { | |
"vmSize": "[parameters('vmSize')]" | |
}, | |
"osProfile": { | |
"computerName": "[concat(parameters('vmName'),copyIndex())]", | |
"adminUsername": "[parameters('adminUsername')]", | |
"adminPassword": "[parameters('adminPassword')]" | |
}, | |
"storageProfile": { | |
"imageReference": { | |
"publisher": "[variables('imagePublisher')]", | |
"offer": "[variables('imageOffer')]", | |
"sku": "[parameters('imageSKU')]", | |
"version": "latest" | |
}, | |
"osDisk": { | |
"name": "osdisk", | |
"vhd": { | |
"uri": "[concat('http://',parameters('storageAccountName'),'.blob.core.windows.net/vhds/',concat('osdisk',copyIndex(),'.vhd'))]" | |
}, | |
"caching": "ReadWrite", | |
"createOption": "FromImage" | |
} | |
}, | |
"networkProfile": { | |
"networkInterfaces": [ | |
{ | |
"id": "[concat(resourceId('Microsoft.Network/networkInterfaces', variables('nicName')), copyIndex())]" | |
} | |
] | |
} | |
} | |
}, | |
{ | |
"type": "Microsoft.Compute/virtualMachines/extensions", | |
"name": "[concat(parameters('vmName'),copyIndex(),'/', variables('vmExtensionName'))]", | |
"apiVersion": "2015-05-01-preview", | |
"location": "[variables('location')]", | |
"copy" : { "name" : "extCopy", "count" : "[parameters('numOfInstances')]" }, | |
"dependsOn": ["[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'), copyIndex())]"], | |
"properties": { | |
"publisher": "Microsoft.Powershell", | |
"type": "DSC", | |
"typeHandlerVersion": "2.8", | |
"settings": { | |
"ModulesUrl": "[parameters('modulesUrl')]", | |
"ConfigurationFunction": "[parameters('configurationFunction')]", | |
"Properties": { | |
"MachineName": "[concat(parameters('vmName'),copyIndex())]" | |
} | |
}, | |
"protectedSettings": null | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment