AzureStack-QuickStart-Templ.../201-vmss-linux-vm-largescale/azuredeploy.json

291 строка
12 KiB
JSON

{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"vmSku": {
"defaultValue": "Standard_A1",
"type": "String",
"metadata": {
"description": "Size of VMs in the VM Scale Set."
}
},
"vmssName": {
"type": "String",
"defaultValue": "[substring(concat('vmss', uniquestring(replace(resourceGroup().Id,'-',''))), 0, 8)]",
"metadata": {
"description": "String used as a base for naming resources. Must be 3-10 characters in length and globally unique across Azure Stack. A hash is prepended to this string for some resources, and resource-specific information is appended."
}
},
"instanceCount": {
"defaultValue": 2,
"maxValue": 100,
"type": "Int",
"metadata": {
"description": "Number of VM instances (100 or less)."
}
},
"adminUsername": {
"type": "String",
"defaultValue": "azureuser",
"metadata": {
"description": "Admin username on all VMs."
}
},
"adminPassword": {
"type": "SecureString",
"defaultValue": "[concat('Subscription#', subscription().subscriptionId)]",
"metadata": {
"description": "Admin password on all VMs."
}
},
"osImagePublisher": {
"type": "string",
"defaultValue": "Canonical",
"metadata": {
"description": "Maps to the publisher in the Azure Stack Platform Image Repository manifest file."
}
},
"osImageOffer": {
"type": "string",
"defaultValue": "UbuntuServer",
"metadata": {
"description": "Maps to the Offer in the Azure Stack Platform Image Repository manifest file."
}
},
"osImageSku": {
"type": "string",
"defaultValue": "16.04-LTS",
"metadata": {
"description": "Maps to the sku in the Azure Stack Platform Image Repository."
}
}
},
"variables": {
"location": "[resourceGroup().location]",
"vnetName": "[toLower(concat('vnet', uniqueString(resourceGroup().id)))]",
"subnetName": "[toLower(concat('subnet', uniqueString(resourceGroup().id)))]",
"storageAccountType": "Standard_LRS",
"saCount": 5,
"storageAccountSuffix": "[concat('sa', toLower(uniqueString(resourceGroup().id)))]",
"uniqueStringArray": [
"[concat(variables('storageAccountSuffix'), '0')]",
"[concat(variables('storageAccountSuffix'), '1')]",
"[concat(variables('storageAccountSuffix'), '2')]",
"[concat(variables('storageAccountSuffix'), '3')]",
"[concat(variables('storageAccountSuffix'), '4')]"
],
"storageAccountContainerName": "[concat(toLower(uniqueString(resourceGroup().id)), 'vhd')]",
"osDiskName": "[concat(toLower(uniqueString(resourceGroup().id)), 'osdisk')]",
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks', variables('vnetName'))]",
"subnetRef": "[concat(variables('vnetID'),'/subnets/', variables('subnetName'))]",
"publicIPAddressName": "[toLower(concat('pip', uniqueString(resourceGroup().id)))]",
"vmssDomainName": "[toLower(concat('pubdns', uniqueString(resourceGroup().id)))]",
"loadBalancerName": "[concat('LB', uniqueString(resourceGroup().id))]",
"loadBalancerFrontEndName": "[concat('LBFrontEnd', uniqueString(resourceGroup().id))]",
"loadBalancerBackEndName": "[concat('LBBackEnd', uniqueString(resourceGroup().id))]",
"loadBalancerProbeName": "[concat('LBHttpProbe', uniqueString(resourceGroup().id))]",
"loadBalancerNatPoolName": "[concat('LBNatPool', uniqueString(resourceGroup().id))]"
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[concat(variables('storageAccountSuffix'), copyIndex())]",
"location": "[variables('location')]",
"apiVersion": "2015-06-15",
"copy": {
"name": "storageLoop",
"count": "[variables('saCount')]"
},
"properties": {
"accountType": "[variables('storageAccountType')]"
}
},
{
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('vnetName')]",
"apiVersion": "2015-06-15",
"location": "[variables('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"10.0.0.0/16"
]
},
"subnets": [
{
"name": "[variables('subnetName')]",
"properties": {
"addressPrefix": "10.0.0.0/24"
}
}
]
}
},
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('publicIPAddressName')]",
"apiVersion": "2015-06-15",
"location": "[variables('location')]",
"properties": {
"publicIPAllocationMethod": "Dynamic",
"dnsSettings": {
"domainNameLabel": "[variables('vmssDomainName')]"
}
}
},
{
"type": "Microsoft.Network/loadBalancers",
"name": "[variables('loadBalancerName')]",
"apiVersion": "2015-06-15",
"location": "[variables('location')]",
"properties": {
"frontendIPConfigurations": [
{
"name": "[variables('loadBalancerFrontEndName')]",
"properties": {
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
}
}
}
],
"backendAddressPools": [
{
"name": "[variables('loadBalancerBackendName')]"
}
],
"loadBalancingRules": [
{
"name": "roundRobinLBRule",
"properties": {
"frontendIPConfiguration": {
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/frontendIPConfigurations/', variables('loadBalancerFrontEndName'))]"
},
"backendAddressPool": {
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/backendAddressPools/', variables('loadBalancerBackendName'))]"
},
"protocol": "tcp",
"frontendPort": 80,
"backendPort": 80,
"enableFloatingIP": false,
"idleTimeoutInMinutes": 5,
"probe": {
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/probes/', variables('loadBalancerProbeName'))]"
}
}
}
],
"probes": [
{
"name": "[variables('loadBalancerProbeName')]",
"properties": {
"protocol": "tcp",
"port": 80,
"intervalInSeconds": "5",
"numberOfProbes": "2"
}
}
],
"inboundNatPools": [
{
"name": "[variables('loadBalancerNatPoolName')]",
"properties": {
"frontendIPConfiguration": {
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/frontendIPConfigurations/', variables('loadBalancerFrontEndName'))]"
},
"protocol": "tcp",
"frontendPortRangeStart": "50000",
"frontendPortRangeEnd": "50099",
"backendPort": "3389"
}
}
]
},
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]"
]
},
{
"type": "Microsoft.Compute/virtualMachineScaleSets",
"sku": {
"name": "[parameters('vmSku')]",
"tier": "Standard",
"capacity": "[parameters('instanceCount')]"
},
"name": "[parameters('vmssName')]",
"apiVersion": "2016-03-30",
"location": "[variables('location')]",
"properties": {
"upgradePolicy": {
"mode": "Manual"
},
"virtualMachineProfile": {
"storageProfile": {
"osDisk": {
"vhdContainers": [
"[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray')[0]), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob, variables('storageAccountContainerName'))]",
"[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray')[1]), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob, variables('storageAccountContainerName'))]",
"[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray')[2]), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob, variables('storageAccountContainerName'))]",
"[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray')[3]), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob, variables('storageAccountContainerName'))]",
"[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray')[4]), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob, variables('storageAccountContainerName'))]"
],
"name": "[variables('osDiskName')]",
"caching": "ReadOnly",
"createOption": "FromImage"
},
"imageReference": {
"publisher": "[parameters('osImagePublisher')]",
"offer": "[parameters('osImageOffer')]",
"sku": "[parameters('osImageSku')]",
"version": "latest"
}
},
"osProfile": {
"computerNamePrefix": "[parameters('vmssName')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]"
},
"networkProfile": {
"networkInterfaceConfigurations": [
{
"name": "nic",
"properties": {
"primary": "true",
"ipConfigurations": [
{
"name": "ipconfig",
"properties": {
"subnet": {
"id": "[variables('subnetRef')]"
},
"loadBalancerBackendAddressPools": [
{
"id": "[concat('/subscriptions/', subscription().subscriptionId,'/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/loadBalancers/', variables('loadBalancerName'), '/backendAddressPools/', variables('loadBalancerBackEndName'))]"
}
],
"loadBalancerInboundNatPools": [
{
"id": "[concat('/subscriptions/', subscription().subscriptionId,'/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/loadBalancers/', variables('loadBalancerName'), '/inboundNatPools/', variables('loadBalancerNatPoolName'))]"
}
]
}
}
]
}
}
]
}
}
},
"dependsOn": [
"[concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray')[0])]",
"[concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray')[1])]",
"[concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray')[2])]",
"[concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray')[3])]",
"[concat('Microsoft.Storage/storageAccounts/', variables('uniqueStringArray')[4])]",
"[concat('Microsoft.Network/virtualNetworks/', variables('vnetName'))]",
"[resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName'))]"
]
}
]
}