AzureStack-QuickStart-Templ.../201-vmss-windows-customimage/azuredeploy.json

250 строки
9.1 KiB
JSON

{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"apiProfile": "2018-03-01-hybrid",
"parameters": {
"vmSku": {
"defaultValue": "Standard_D1",
"type": "String",
"metadata": {
"description": "Size of VMs in the VM Scale Set."
}
},
"osImageUrl": {
"type": "string",
"metadata": {
"description": "The source of the blob containing the custom image."
}
},
"vmssName": {
"defaultValue": "[substring(concat('vmss', uniquestring(replace(resourceGroup().Id,'-',''))), 0, 8)]",
"minLength": 3,
"maxLength": 10,
"type": "String",
"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": 20,
"type": "Int",
"metadata": {
"description": "Number of VM instances (20 or less)."
}
},
"adminUsername": {
"defaultValue": "azureuser",
"type": "String",
"metadata": {
"description": "Admin username on all VMs."
}
},
"adminPassword": {
"defaultValue": "[concat('Subscription#', subscription().subscriptionId)]",
"type": "SecureString",
"metadata": {
"description": "Admin password on all VMs."
}
}
},
"variables": {
"location": "[resourceGroup().location]",
"vnetName": "[toLower(concat('vnet', uniqueString(resourceGroup().id)))]",
"subnetName": "[toLower(concat('subnet', uniqueString(resourceGroup().id)))]",
"storageAccountName": "[toLower(concat('SA', uniqueString(resourceGroup().id)))]",
"storageAccountContainerName": "[toLower(concat('SC', uniqueString(resourceGroup().id)))]",
"storageAccountType": "Standard_LRS",
"OSDiskName": "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": "[variables('storageAccountName')]",
"location": "[variables('location')]",
"sku": {
"name": "[variables('storageAccountType')]"
},
"kind": "Storage"
},
{
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('vnetName')]",
"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')]",
"location": "[variables('location')]",
"properties": {
"publicIPAllocationMethod": "Dynamic",
"dnsSettings": {
"domainNameLabel": "[variables('vmssDomainName')]"
}
}
},
{
"type": "Microsoft.Network/loadBalancers",
"name": "[variables('loadBalancerName')]",
"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": "50019",
"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')]",
"location": "[variables('location')]",
"properties": {
"upgradePolicy": {
"mode": "Manual"
},
"virtualMachineProfile": {
"storageProfile": {
"osDisk": {
"name": "[variables('OSDiskName')]",
"caching": "ReadOnly",
"createOption": "FromImage",
"osType": "Windows",
"image": {
"uri": "[parameters('osImageUrl')]"
}
}
},
"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('storageAccountName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('vnetName'))]",
"[resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName'))]"
]
}
]
}