Availability set with multiple VMs quick start template. (#230)
* Multiple VMs Availability set quick start template - initial checkin. * Add Parameters json file. * Added Metadat json and readme files * CR feedback addressed.
This commit is contained in:
Родитель
fa159c11fc
Коммит
83fd264285
|
@ -0,0 +1 @@
|
|||
# Deploys a set of VMs (defaut 3) as part of the same availability group. This template template also deploys an availability group, a virtual Network (with DNS), a load balancer with a front end Public IP address, and a Network Security Group.
|
|
@ -0,0 +1,351 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminUsername": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "The name of the Administrator of the new VMs"
|
||||
},
|
||||
"defaultValue": "vmadmin"
|
||||
},
|
||||
"adminPassword": {
|
||||
"type": "securestring",
|
||||
"metadata": {
|
||||
"description": "The password for the Administrator account of the new VMs. Default value is subscription id"
|
||||
},
|
||||
"defaultValue": "[concat('Subscription#',substring(resourcegroup().id,15,36))]"
|
||||
},
|
||||
"numberOfInstances": {
|
||||
"type": "int",
|
||||
"defaultValue": 3,
|
||||
"allowedValues": [
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
],
|
||||
"metadata": {
|
||||
"description": "Number of VMs to deploy, limit 5 since this sample is using a single storage account"
|
||||
}
|
||||
},
|
||||
"vmNamePrefix": {
|
||||
"type": "string",
|
||||
"defaultValue": "vmset-",
|
||||
"metadata": {
|
||||
"description": "VM name prefix"
|
||||
}
|
||||
},
|
||||
"osImagePublisher": {
|
||||
"type": "string",
|
||||
"defaultValue": "MicrosoftWindowsServer",
|
||||
"metadata": {
|
||||
"description": "Maps to the publisher in the Azure Stack Platform Image Repository manifest file."
|
||||
}
|
||||
},
|
||||
"osImageOffer": {
|
||||
"type": "string",
|
||||
"defaultValue": "WindowsServer",
|
||||
"metadata": {
|
||||
"description": "Maps to the Offer in the Azure Stack Platform Image Repository manifest file."
|
||||
}
|
||||
},
|
||||
"osImageSKU": {
|
||||
"type": "string",
|
||||
"defaultValue": "2016-Datacenter",
|
||||
"allowedValues": [
|
||||
"2012-R2-Datacenter",
|
||||
"2016-Datacenter"
|
||||
],
|
||||
"metadata": {
|
||||
"description": "The Windows version for the VM. This will pick a fully patched image of this given Windows version. Allowed values: 2008-R2-SP1, 2012-Datacenter, 2012-R2-Datacenter."
|
||||
}
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"availabilitySetName": "[toLower(concat('aSet-', resourceGroup().name))]",
|
||||
"storageAccountType": "Standard_LRS",
|
||||
"VMSize": "Standard_A1",
|
||||
"dnsPrefix": "[tolower(concat('vmdns', resourceGroup().name))]",
|
||||
"windowsImageVersion": "latest",
|
||||
"dataDiskSize": 2,
|
||||
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"virtualNetworkName": "[tolower(concat('vNet-',resourceGroup().name))]",
|
||||
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]",
|
||||
|
||||
"NICPrefix": "vnic-",
|
||||
"subnetPrefix": "10.0.0.0/24",
|
||||
"subnetName": "vmstaticsubnet",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
|
||||
"storageName": "[concat('sa', uniquestring(resourceGroup().id))]",
|
||||
|
||||
"publicLBName": "[tolower(concat('external-lb-', resourceGroup().name))]",
|
||||
"publiclbID": "[resourceId('Microsoft.Network/loadBalancers',variables('publicLBName'))]",
|
||||
"lbFE": "[tolower(concat('external-lb-fe-',resourceGroup().name))]",
|
||||
"publiclbFEConfigID": "[concat(variables('publiclbID'),'/frontendIPConfigurations/',variables('lbFE'))]",
|
||||
|
||||
"publicIPAddressName": "[tolower(concat('public-ip',resourceGroup().name))]",
|
||||
"rdpPort": 3389,
|
||||
"nsgName": "[tolower(concat('vmnsg',resourceGroup().name))]",
|
||||
"nsgID": "[resourceId('Microsoft.Network/networkSecurityGroups',variables('nsgName'))]",
|
||||
"vmContainerName": "vhds"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"name": "[variables('storageName')]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"properties": {
|
||||
"accountType": "[variables('storageAccountType')]"
|
||||
},
|
||||
"dependsOn": [
|
||||
"[variables('publiclbName')]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Network/networkSecurityGroups",
|
||||
"name": "[variables('nsgName')]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"properties": {
|
||||
"securityRules": [
|
||||
{
|
||||
"name": "rule1",
|
||||
"properties": {
|
||||
"protocol": "*",
|
||||
"sourcePortRange": "*",
|
||||
"destinationPortRange": "*",
|
||||
"sourceAddressPrefix": "*",
|
||||
"destinationAddressPrefix": "*",
|
||||
"access": "Allow",
|
||||
"priority": 101,
|
||||
"direction": "Inbound"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Compute/availabilitySets",
|
||||
"name": "[variables('availabilitySetName')]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"properties": {
|
||||
"platformFaultDomainCount": "1",
|
||||
"platformUpdateDomainCount": "1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Network/publicIPAddresses",
|
||||
"name": "[variables('publicIPAddressName')]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"properties": {
|
||||
"publicIPAllocationMethod": "Dynamic",
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[variables('dnsPrefix')]"
|
||||
}
|
||||
},
|
||||
"dependsOn": [
|
||||
"[variables('vnetID')]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetPrefix')]",
|
||||
"networkSecurityGroup": {
|
||||
"id": "[variables('nsgID')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"dependsOn": [
|
||||
"[variables('nsgID')]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-06-15",
|
||||
"name": "[variables('publiclbName')]",
|
||||
"type": "Microsoft.Network/loadBalancers",
|
||||
"location": "[resourceGroup().location]",
|
||||
"dependsOn": [
|
||||
"[variables('vnetID')]",
|
||||
"[variables('publicIPAddressName')]"
|
||||
],
|
||||
"properties": {
|
||||
"frontendIPConfigurations": [
|
||||
{
|
||||
"name": "[variables('lbFE')]",
|
||||
"properties": {
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"backendAddressPools": [
|
||||
{
|
||||
"name": "LoadBalancerBackend"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-06-15",
|
||||
"type": "Microsoft.Network/loadBalancers/inboundNatRules",
|
||||
"name": "[concat(variables('publicLBName'), '/RDP-VM', copyIndex())]",
|
||||
"location": "[resourceGroup().location]",
|
||||
"copy": {
|
||||
"name": "lbNatLoop",
|
||||
"count": "[parameters('numberOfInstances')]"
|
||||
},
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/loadBalancers/', variables('publiclbName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"frontendIPConfiguration": {
|
||||
"id": "[variables('publiclbFEConfigID')]"
|
||||
},
|
||||
"protocol": "tcp",
|
||||
"frontendPort": "[copyIndex(5000)]",
|
||||
"backendPort": 3389,
|
||||
"enableFloatingIP": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Network/networkInterfaces",
|
||||
"name": "[concat(variables('NICPrefix'), parameters('vmNamePrefix'), copyIndex())]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"copy": {
|
||||
"name": "nicLoop",
|
||||
"count": "[parameters('numberOfInstances')]"
|
||||
},
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
|
||||
"[concat('Microsoft.Network/loadBalancers/', variables('publicLBName'))]",
|
||||
"[concat('Microsoft.Network/loadBalancers/', variables('publicLBName'), '/inboundNatRules/', 'RDP-VM', copyIndex())]"
|
||||
],
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig1",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
},
|
||||
"loadBalancerBackendAddressPools": [
|
||||
{
|
||||
"id": "[concat(variables('publiclbID'), '/backendAddressPools/LoadBalancerBackend')]"
|
||||
}
|
||||
],
|
||||
"loadBalancerInboundNatRules": [
|
||||
{
|
||||
"id": "[concat(variables('publiclbID'), '/inboundNatRules/RDP-VM', copyIndex())]"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Compute/virtualMachines",
|
||||
"name": "[concat(parameters('vmNamePrefix'), copyIndex())]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"copy": {
|
||||
"name": "virtualMachineLoop",
|
||||
"count": "[parameters('numberOfInstances')]"
|
||||
},
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Storage/storageAccounts/',variables('storageName'))]",
|
||||
"[resourceId('Microsoft.Network/networkInterfaces', concat(variables('NICPrefix'), parameters('vmNamePrefix'), copyIndex()))]",
|
||||
"[concat('Microsoft.Compute/availabilitySets/', variables('availabilitySetName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"availabilitySet": {
|
||||
"id": "[resourceId('Microsoft.Compute/availabilitySets',variables('availabilitySetName'))]"
|
||||
},
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[variables('vmSize')]"
|
||||
},
|
||||
"osProfile": {
|
||||
"computerName": "[concat(parameters('vmNamePrefix'), copyIndex())]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"adminPassword": "[parameters('adminPassword')]"
|
||||
},
|
||||
"storageProfile": {
|
||||
"imageReference": {
|
||||
"publisher": "[parameters('osImagePublisher')]",
|
||||
"offer": "[parameters('osImageOffer')]",
|
||||
"sku": "[parameters('osImageSKU')]",
|
||||
"version": "[variables('windowsImageVersion')]"
|
||||
},
|
||||
"osDisk": {
|
||||
"name": "osdisk",
|
||||
"vhd": {
|
||||
"uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageName')),providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob, variables('vmContainerName'),'/', parameters('vmNamePrefix'), copyIndex(),'-osdisk.vhd')]"
|
||||
},
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage"
|
||||
},
|
||||
"dataDisks": [
|
||||
{
|
||||
"vhd": {
|
||||
"uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageName')),providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob, variables('vmContainerName'),'/', parameters('vmNamePrefix'), copyIndex(),'-data-1.vhd')]"
|
||||
},
|
||||
"name": "[concat(parameters('vmNamePrefix'), copyIndex(),'-data-disk1')]",
|
||||
"createOption": "Empty",
|
||||
"caching": "None",
|
||||
"diskSizeGB": "[variables('dataDiskSize')]",
|
||||
"lun": 0
|
||||
},
|
||||
{
|
||||
"vhd": {
|
||||
"uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageName')),providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob, variables('vmContainerName'),'/', parameters('vmNamePrefix'), copyIndex(),'-data-2.vhd')]"
|
||||
},
|
||||
"name": "[concat(parameters('vmNamePrefix'), copyIndex(),'-data-disk2')]",
|
||||
"createOption": "Empty",
|
||||
"caching": "None",
|
||||
"diskSizeGB": "[variables('dataDiskSize')]",
|
||||
"lun": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('NICPrefix'), parameters('vmNamePrefix'), copyIndex()))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": "true",
|
||||
"storageUri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageName')),providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob)]"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outputs": { }
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"itemDisplayName": "Deploy a set of VMs in the same availability set",
|
||||
"description": "This template deploys a set of VMs (defaut 3) as part of the same availability group. This template template also deploys an availability group, a virtual Network (with DNS), a load balancer with a front end Public IP address, and a Network Security Group.",
|
||||
"summary": "This template takes a minimum amount of parameters and deploys 3 Windows VMs, with the appropriate DNS setting for the Azure Stack POC environment.",
|
||||
"githubUsername": "azurestack",
|
||||
"dateUpdated": "2017-05-17"
|
||||
}
|
Загрузка…
Ссылка в новой задаче