311 строки
12 KiB
JSON
311 строки
12 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."
|
|
}
|
|
},
|
|
"osImageSku": {
|
|
"type": "string",
|
|
"defaultValue": "2016-Datacenter",
|
|
"allowedValues": [
|
|
"2012-R2-Datacenter",
|
|
"2016-Datacenter-Server-Core",
|
|
"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."
|
|
}
|
|
},
|
|
"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."
|
|
}
|
|
},
|
|
"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."
|
|
}
|
|
},
|
|
"_artifactsLocation": {
|
|
"defaultValue": "https://raw.githubusercontent.com/Azure/azurestack-quickstart-templates/master/201-vmss-windows-extension",
|
|
"type": "String",
|
|
"metadata": {
|
|
"description": "The base URI where artifacts required by this template are located. When the template is deployed using the accompanying scripts, a private location in the subscription will be used and this value will be automatically generated."
|
|
}
|
|
},
|
|
"_artifactsLocationSasToken": {
|
|
"defaultValue": "",
|
|
"type": "SecureString",
|
|
"metadata": {
|
|
"description": "The sasToken required to access _artifactsLocation. When the template is deployed using the accompanying scripts, a sasToken will be automatically generated."
|
|
}
|
|
}
|
|
},
|
|
"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": {
|
|
"vhdContainers": [
|
|
"[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), 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'))]"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"extensionProfile": {
|
|
"extensions": [
|
|
{
|
|
"name": "customScript",
|
|
"properties": {
|
|
"publisher": "Microsoft.Compute",
|
|
"type": "CustomScriptExtension",
|
|
"settings": {
|
|
"fileUris": [
|
|
"[concat(parameters('_artifactsLocation'), '/scripts/helloWorld.ps1')]"
|
|
]
|
|
},
|
|
"typeHandlerVersion": "1.8",
|
|
"autoUpgradeMinorVersion": true,
|
|
"protectedSettings": {
|
|
"commandToExecute": "powershell -ExecutionPolicy Unrestricted -File helloWorld.ps1"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"dependsOn": [
|
|
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
|
|
"[concat('Microsoft.Network/virtualNetworks/', variables('vnetName'))]",
|
|
"[resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName'))]"
|
|
]
|
|
}
|
|
]
|
|
}
|