bicep update for 201-vmss-windows-extension
This commit is contained in:
Родитель
32ad64ed0d
Коммит
b7d22ec5c7
|
@ -7,3 +7,15 @@ PARAMETER RESTRICTIONS
|
|||
|
||||
vmssName must be 3-10 characters in length. It should also be globally unique across all of AzureStack. If it isn't globally unique, it is possible that this template will still deploy properly, but we don't recommend relying on this pseudo-probabilistic behavior.
|
||||
instanceCount must be 20 or less. VM Scale Set supports upto 100 VMs and one should add more storage accounts to support this number.
|
||||
|
||||
|
||||
Deploy using Az CLI
|
||||
```Powershell
|
||||
# update parameters values in azuredeploy.parametrs.json file and run below commands
|
||||
# create resource group if it doesn't exist
|
||||
az group create --name testrg --location "local"
|
||||
# ARM template deployment
|
||||
az deployment group create --resource-group testrg --template-file .\azuredeploy.json
|
||||
# Bicep deployment
|
||||
az deployment group create --resource-group testrg --template-file .\azuredeploy.bicep
|
||||
```
|
|
@ -0,0 +1,249 @@
|
|||
@description('Size of VMs in the VM Scale Set.')
|
||||
param vmSku string = 'Standard_D1'
|
||||
|
||||
@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.')
|
||||
@allowed([
|
||||
'2012-R2-Datacenter'
|
||||
'2016-Datacenter-Server-Core'
|
||||
'2016-Datacenter'
|
||||
])
|
||||
param osImageSku string = '2016-Datacenter'
|
||||
|
||||
@description('Maps to the publisher in the Azure Stack Platform Image Repository manifest file.')
|
||||
param osImagePublisher string = 'MicrosoftWindowsServer'
|
||||
|
||||
@description('Maps to the Offer in the Azure Stack Platform Image Repository manifest file.')
|
||||
param osImageOffer string = 'WindowsServer'
|
||||
|
||||
@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.')
|
||||
@minLength(3)
|
||||
@maxLength(10)
|
||||
param vmssName string = substring('vmss${uniqueString(replace(resourceGroup().id, '-', ''))}', 0, 8)
|
||||
|
||||
@description('Number of VM instances (20 or less).')
|
||||
@maxValue(20)
|
||||
param instanceCount int = 2
|
||||
|
||||
@description('Admin username on all VMs.')
|
||||
param adminUsername string = 'azureuser'
|
||||
|
||||
@description('Admin password on all VMs.')
|
||||
@secure()
|
||||
param adminPassword string = 'Subscription#${subscription().subscriptionId}'
|
||||
|
||||
@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.')
|
||||
param artifactsLocation string = 'https://raw.githubusercontent.com/Azure/azurestack-quickstart-templates/master/201-vmss-windows-extension'
|
||||
|
||||
var location = resourceGroup().location
|
||||
var vnetName = toLower('vnet${uniqueString(resourceGroup().id)}')
|
||||
var subnetName = toLower('subnet${uniqueString(resourceGroup().id)}')
|
||||
var storageAccountName = toLower('SA${uniqueString(resourceGroup().id)}')
|
||||
var storageAccountContainerName = toLower('SC${uniqueString(resourceGroup().id)}')
|
||||
var storageAccountType = 'Standard_LRS'
|
||||
var OSDiskName = 'osdisk'
|
||||
var vnetID = vnet.id
|
||||
var subnetRef = '${vnetID}/subnets/${subnetName}'
|
||||
var publicIPAddressName = toLower('pip${uniqueString(resourceGroup().id)}')
|
||||
var vmssDomainName = toLower('pubdns${uniqueString(resourceGroup().id)}')
|
||||
var loadBalancerName = 'LB${uniqueString(resourceGroup().id)}'
|
||||
var loadBalancerFrontEndName = 'LBFrontEnd${uniqueString(resourceGroup().id)}'
|
||||
var loadBalancerBackEndName = 'LBBackEnd${uniqueString(resourceGroup().id)}'
|
||||
var loadBalancerProbeName = 'LBHttpProbe${uniqueString(resourceGroup().id)}'
|
||||
var loadBalancerNatPoolName = 'LBNatPool${uniqueString(resourceGroup().id)}'
|
||||
|
||||
resource storageAccount 'Microsoft.Storage/storageAccounts@2019-06-01' = {
|
||||
name: storageAccountName
|
||||
location: location
|
||||
sku: {
|
||||
name: storageAccountType
|
||||
}
|
||||
kind: 'Storage'
|
||||
}
|
||||
|
||||
resource vnet 'Microsoft.Network/virtualNetworks@2018-11-01' = {
|
||||
name: vnetName
|
||||
location: location
|
||||
properties: {
|
||||
addressSpace: {
|
||||
addressPrefixes: [
|
||||
'10.0.0.0/16'
|
||||
]
|
||||
}
|
||||
subnets: [
|
||||
{
|
||||
name: subnetName
|
||||
properties: {
|
||||
addressPrefix: '10.0.0.0/24'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
resource publicIPAddress 'Microsoft.Network/publicIPAddresses@2018-11-01' = {
|
||||
name: publicIPAddressName
|
||||
location: location
|
||||
properties: {
|
||||
publicIPAllocationMethod: 'Dynamic'
|
||||
dnsSettings: {
|
||||
domainNameLabel: vmssDomainName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resource loadBalancer 'Microsoft.Network/loadBalancers@2018-11-01' = {
|
||||
name: loadBalancerName
|
||||
location: location
|
||||
properties: {
|
||||
frontendIPConfigurations: [
|
||||
{
|
||||
name: loadBalancerFrontEndName
|
||||
properties: {
|
||||
publicIPAddress: {
|
||||
id: publicIPAddress.id
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
backendAddressPools: [
|
||||
{
|
||||
name: loadBalancerBackEndName
|
||||
}
|
||||
]
|
||||
loadBalancingRules: [
|
||||
{
|
||||
name: 'roundRobinLBRule'
|
||||
properties: {
|
||||
frontendIPConfiguration: {
|
||||
id: resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', loadBalancerName, loadBalancerFrontEndName)
|
||||
}
|
||||
backendAddressPool: {
|
||||
id: resourceId('Microsoft.Network/loadBalancers/backendAddressPools', loadBalancerName, loadBalancerBackEndName)
|
||||
}
|
||||
protocol: 'Tcp'
|
||||
frontendPort: 80
|
||||
backendPort: 80
|
||||
enableFloatingIP: false
|
||||
idleTimeoutInMinutes: 5
|
||||
probe: {
|
||||
id: resourceId('Microsoft.Network/loadBalancers/probes', loadBalancerName, loadBalancerProbeName)
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
probes: [
|
||||
{
|
||||
name: loadBalancerProbeName
|
||||
properties: {
|
||||
protocol: 'Tcp'
|
||||
port: 80
|
||||
intervalInSeconds: 5
|
||||
numberOfProbes: 2
|
||||
}
|
||||
}
|
||||
]
|
||||
inboundNatPools: [
|
||||
{
|
||||
name: loadBalancerNatPoolName
|
||||
properties: {
|
||||
frontendIPConfiguration: {
|
||||
id: resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', loadBalancerName, loadBalancerFrontEndName)
|
||||
}
|
||||
protocol: 'Tcp'
|
||||
frontendPortRangeStart: 50000
|
||||
frontendPortRangeEnd: 50019
|
||||
backendPort: 3389
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
resource vmss 'Microsoft.Compute/virtualMachineScaleSets@2020-06-01' = {
|
||||
sku: {
|
||||
name: vmSku
|
||||
tier: 'Standard'
|
||||
capacity: instanceCount
|
||||
}
|
||||
name: vmssName
|
||||
location: location
|
||||
properties: {
|
||||
upgradePolicy: {
|
||||
mode: 'Manual'
|
||||
}
|
||||
virtualMachineProfile: {
|
||||
storageProfile: {
|
||||
osDisk: {
|
||||
vhdContainers: [
|
||||
'${reference(storageAccount.id, providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob}${storageAccountContainerName}'
|
||||
]
|
||||
name: OSDiskName
|
||||
caching: 'ReadOnly'
|
||||
createOption: 'FromImage'
|
||||
}
|
||||
imageReference: {
|
||||
publisher: osImagePublisher
|
||||
offer: osImageOffer
|
||||
sku: osImageSku
|
||||
version: 'latest'
|
||||
}
|
||||
}
|
||||
osProfile: {
|
||||
computerNamePrefix: vmssName
|
||||
adminUsername: adminUsername
|
||||
adminPassword: adminPassword
|
||||
}
|
||||
networkProfile: {
|
||||
networkInterfaceConfigurations: [
|
||||
{
|
||||
name: 'nic'
|
||||
properties: {
|
||||
primary: true
|
||||
ipConfigurations: [
|
||||
{
|
||||
name: 'ipconfig'
|
||||
properties: {
|
||||
subnet: {
|
||||
id: subnetRef
|
||||
}
|
||||
loadBalancerBackendAddressPools: [
|
||||
{
|
||||
id: loadBalancer.properties.backendAddressPools[0].id
|
||||
}
|
||||
]
|
||||
loadBalancerInboundNatPools: [
|
||||
{
|
||||
id: loadBalancer.properties.inboundNatPools[0].id
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
extensionProfile: {
|
||||
extensions: [
|
||||
{
|
||||
name: 'customScript'
|
||||
properties: {
|
||||
publisher: 'Microsoft.Compute'
|
||||
type: 'CustomScriptExtension'
|
||||
settings: {
|
||||
fileUris: [
|
||||
'${artifactsLocation}/scripts/helloWorld.ps1'
|
||||
]
|
||||
}
|
||||
typeHandlerVersion: '1.8'
|
||||
autoUpgradeMinorVersion: true
|
||||
protectedSettings: {
|
||||
commandToExecute: 'powershell -ExecutionPolicy Unrestricted -File helloWorld.ps1'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"apiProfile": "2018-03-01-hybrid",
|
||||
"apiProfile": "2020-09-01-hybrid",
|
||||
"parameters": {
|
||||
"vmSku": {
|
||||
"defaultValue": "Standard_D1",
|
||||
|
@ -73,13 +73,6 @@
|
|||
"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": {
|
||||
|
@ -103,6 +96,7 @@
|
|||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"apiVersion": "2019-06-01",
|
||||
"name": "[variables('storageAccountName')]",
|
||||
"location": "[variables('location')]",
|
||||
"sku": {
|
||||
|
@ -112,6 +106,7 @@
|
|||
},
|
||||
{
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"apiVersion": "2018-11-01",
|
||||
"name": "[variables('vnetName')]",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
|
@ -132,6 +127,7 @@
|
|||
},
|
||||
{
|
||||
"type": "Microsoft.Network/publicIPAddresses",
|
||||
"apiVersion": "2018-11-01",
|
||||
"name": "[variables('publicIPAddressName')]",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
|
@ -143,6 +139,7 @@
|
|||
},
|
||||
{
|
||||
"type": "Microsoft.Network/loadBalancers",
|
||||
"apiVersion": "2018-11-01",
|
||||
"name": "[variables('loadBalancerName')]",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
|
@ -166,10 +163,10 @@
|
|||
"name": "roundRobinLBRule",
|
||||
"properties": {
|
||||
"frontendIPConfiguration": {
|
||||
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/frontendIPConfigurations/', variables('loadBalancerFrontEndName'))]"
|
||||
"id": "[resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', variables('loadBalancerName'), variables('loadBalancerFrontEndName'))]"
|
||||
},
|
||||
"backendAddressPool": {
|
||||
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/backendAddressPools/', variables('loadBalancerBackendName'))]"
|
||||
"id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', variables('loadBalancerName'), variables('loadBalancerBackendName'))]"
|
||||
},
|
||||
"protocol": "tcp",
|
||||
"frontendPort": 80,
|
||||
|
@ -177,7 +174,7 @@
|
|||
"enableFloatingIP": false,
|
||||
"idleTimeoutInMinutes": 5,
|
||||
"probe": {
|
||||
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/probes/', variables('loadBalancerProbeName'))]"
|
||||
"id": "[resourceId('Microsoft.Network/loadBalancers/probes', variables('loadBalancerName'), variables('loadBalancerProbeName'))]"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -188,8 +185,8 @@
|
|||
"properties": {
|
||||
"protocol": "tcp",
|
||||
"port": 80,
|
||||
"intervalInSeconds": "5",
|
||||
"numberOfProbes": "2"
|
||||
"intervalInSeconds": 5,
|
||||
"numberOfProbes": 2
|
||||
}
|
||||
}
|
||||
],
|
||||
|
@ -198,22 +195,23 @@
|
|||
"name": "[variables('loadBalancerNatPoolName')]",
|
||||
"properties": {
|
||||
"frontendIPConfiguration": {
|
||||
"id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/frontendIPConfigurations/', variables('loadBalancerFrontEndName'))]"
|
||||
"id": "[resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', variables('loadBalancerName'), variables('loadBalancerFrontEndName'))]"
|
||||
},
|
||||
"protocol": "tcp",
|
||||
"frontendPortRangeStart": "50000",
|
||||
"frontendPortRangeEnd": "50019",
|
||||
"backendPort": "3389"
|
||||
"frontendPortRangeStart": 50000,
|
||||
"frontendPortRangeEnd": 50019,
|
||||
"backendPort": 3389
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]"
|
||||
"[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Compute/virtualMachineScaleSets",
|
||||
"apiVersion": "2020-06-01",
|
||||
"sku": {
|
||||
"name": "[parameters('vmSku')]",
|
||||
"tier": "Standard",
|
||||
|
@ -229,7 +227,7 @@
|
|||
"storageProfile": {
|
||||
"osDisk": {
|
||||
"vhdContainers": [
|
||||
"[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob, variables('storageAccountContainerName'))]"
|
||||
"[concat(reference(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).primaryEndpoints.blob, variables('storageAccountContainerName'))]"
|
||||
],
|
||||
"name": "[variables('OSDiskName')]",
|
||||
"caching": "ReadOnly",
|
||||
|
@ -252,7 +250,7 @@
|
|||
{
|
||||
"name": "nic",
|
||||
"properties": {
|
||||
"primary": "true",
|
||||
"primary": true,
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig",
|
||||
|
@ -262,12 +260,12 @@
|
|||
},
|
||||
"loadBalancerBackendAddressPools": [
|
||||
{
|
||||
"id": "[concat('/subscriptions/', subscription().subscriptionId,'/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/loadBalancers/', variables('loadBalancerName'), '/backendAddressPools/', variables('loadBalancerBackEndName'))]"
|
||||
"id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', variables('loadBalancerName'), variables('loadBalancerBackendName'))]"
|
||||
}
|
||||
],
|
||||
"loadBalancerInboundNatPools": [
|
||||
{
|
||||
"id": "[concat('/subscriptions/', subscription().subscriptionId,'/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/loadBalancers/', variables('loadBalancerName'), '/inboundNatPools/', variables('loadBalancerNatPoolName'))]"
|
||||
"id": "[resourceId('Microsoft.Network/loadBalancers/inboundNatPools', variables('loadBalancerName'), variables('loadBalancerNatPoolName'))]"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -301,8 +299,8 @@
|
|||
}
|
||||
},
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('vnetName'))]",
|
||||
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]",
|
||||
"[resourceId('Microsoft.Network/virtualNetworks', variables('vnetName'))]",
|
||||
"[resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName'))]"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,315 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"metadata": {
|
||||
"_generator": {
|
||||
"name": "bicep",
|
||||
"version": "0.4.613.9944",
|
||||
"templateHash": "313291512184700301"
|
||||
}
|
||||
},
|
||||
"parameters": {
|
||||
"vmSku": {
|
||||
"type": "string",
|
||||
"defaultValue": "Standard_D1",
|
||||
"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": {
|
||||
"type": "string",
|
||||
"defaultValue": "[substring(format('vmss{0}', uniqueString(replace(resourceGroup().id, '-', ''))), 0, 8)]",
|
||||
"maxLength": 10,
|
||||
"minLength": 3,
|
||||
"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": {
|
||||
"type": "int",
|
||||
"defaultValue": 2,
|
||||
"maxValue": 20,
|
||||
"metadata": {
|
||||
"description": "Number of VM instances (20 or less)."
|
||||
}
|
||||
},
|
||||
"adminUsername": {
|
||||
"type": "string",
|
||||
"defaultValue": "azureuser",
|
||||
"metadata": {
|
||||
"description": "Admin username on all VMs."
|
||||
}
|
||||
},
|
||||
"adminPassword": {
|
||||
"type": "secureString",
|
||||
"defaultValue": "[format('Subscription#{0}', subscription().subscriptionId)]",
|
||||
"metadata": {
|
||||
"description": "Admin password on all VMs."
|
||||
}
|
||||
},
|
||||
"artifactsLocation": {
|
||||
"type": "string",
|
||||
"defaultValue": "https://raw.githubusercontent.com/Azure/azurestack-quickstart-templates/master/201-vmss-windows-extension",
|
||||
"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."
|
||||
}
|
||||
}
|
||||
},
|
||||
"functions": [],
|
||||
"variables": {
|
||||
"location": "[resourceGroup().location]",
|
||||
"vnetName": "[toLower(format('vnet{0}', uniqueString(resourceGroup().id)))]",
|
||||
"subnetName": "[toLower(format('subnet{0}', uniqueString(resourceGroup().id)))]",
|
||||
"storageAccountName": "[toLower(format('SA{0}', uniqueString(resourceGroup().id)))]",
|
||||
"storageAccountContainerName": "[toLower(format('SC{0}', uniqueString(resourceGroup().id)))]",
|
||||
"storageAccountType": "Standard_LRS",
|
||||
"OSDiskName": "osdisk",
|
||||
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks', variables('vnetName'))]",
|
||||
"subnetRef": "[format('{0}/subnets/{1}', variables('vnetID'), variables('subnetName'))]",
|
||||
"publicIPAddressName": "[toLower(format('pip{0}', uniqueString(resourceGroup().id)))]",
|
||||
"vmssDomainName": "[toLower(format('pubdns{0}', uniqueString(resourceGroup().id)))]",
|
||||
"loadBalancerName": "[format('LB{0}', uniqueString(resourceGroup().id))]",
|
||||
"loadBalancerFrontEndName": "[format('LBFrontEnd{0}', uniqueString(resourceGroup().id))]",
|
||||
"loadBalancerBackEndName": "[format('LBBackEnd{0}', uniqueString(resourceGroup().id))]",
|
||||
"loadBalancerProbeName": "[format('LBHttpProbe{0}', uniqueString(resourceGroup().id))]",
|
||||
"loadBalancerNatPoolName": "[format('LBNatPool{0}', uniqueString(resourceGroup().id))]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"apiVersion": "2019-06-01",
|
||||
"name": "[variables('storageAccountName')]",
|
||||
"location": "[variables('location')]",
|
||||
"sku": {
|
||||
"name": "[variables('storageAccountType')]"
|
||||
},
|
||||
"kind": "Storage"
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"apiVersion": "2018-11-01",
|
||||
"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",
|
||||
"apiVersion": "2018-11-01",
|
||||
"name": "[variables('publicIPAddressName')]",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"publicIPAllocationMethod": "Dynamic",
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[variables('vmssDomainName')]"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Network/loadBalancers",
|
||||
"apiVersion": "2018-11-01",
|
||||
"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": "[resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', variables('loadBalancerName'), variables('loadBalancerFrontEndName'))]"
|
||||
},
|
||||
"backendAddressPool": {
|
||||
"id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', variables('loadBalancerName'), variables('loadBalancerBackEndName'))]"
|
||||
},
|
||||
"protocol": "Tcp",
|
||||
"frontendPort": 80,
|
||||
"backendPort": 80,
|
||||
"enableFloatingIP": false,
|
||||
"idleTimeoutInMinutes": 5,
|
||||
"probe": {
|
||||
"id": "[resourceId('Microsoft.Network/loadBalancers/probes', variables('loadBalancerName'), variables('loadBalancerProbeName'))]"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"probes": [
|
||||
{
|
||||
"name": "[variables('loadBalancerProbeName')]",
|
||||
"properties": {
|
||||
"protocol": "Tcp",
|
||||
"port": 80,
|
||||
"intervalInSeconds": 5,
|
||||
"numberOfProbes": 2
|
||||
}
|
||||
}
|
||||
],
|
||||
"inboundNatPools": [
|
||||
{
|
||||
"name": "[variables('loadBalancerNatPoolName')]",
|
||||
"properties": {
|
||||
"frontendIPConfiguration": {
|
||||
"id": "[resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', variables('loadBalancerName'), variables('loadBalancerFrontEndName'))]"
|
||||
},
|
||||
"protocol": "Tcp",
|
||||
"frontendPortRangeStart": 50000,
|
||||
"frontendPortRangeEnd": 50019,
|
||||
"backendPort": 3389
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"dependsOn": [
|
||||
"[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Compute/virtualMachineScaleSets",
|
||||
"apiVersion": "2020-06-01",
|
||||
"name": "[parameters('vmssName')]",
|
||||
"sku": {
|
||||
"name": "[parameters('vmSku')]",
|
||||
"tier": "Standard",
|
||||
"capacity": "[parameters('instanceCount')]"
|
||||
},
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"upgradePolicy": {
|
||||
"mode": "Manual"
|
||||
},
|
||||
"virtualMachineProfile": {
|
||||
"storageProfile": {
|
||||
"osDisk": {
|
||||
"vhdContainers": [
|
||||
"[format('{0}{1}', reference(resourceId('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": "[reference(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName'))).backendAddressPools[0].id]"
|
||||
}
|
||||
],
|
||||
"loadBalancerInboundNatPools": [
|
||||
{
|
||||
"id": "[reference(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName'))).inboundNatPools[0].id]"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"extensionProfile": {
|
||||
"extensions": [
|
||||
{
|
||||
"name": "customScript",
|
||||
"properties": {
|
||||
"publisher": "Microsoft.Compute",
|
||||
"type": "CustomScriptExtension",
|
||||
"settings": {
|
||||
"fileUris": [
|
||||
"[format('{0}/scripts/helloWorld.ps1', parameters('artifactsLocation'))]"
|
||||
]
|
||||
},
|
||||
"typeHandlerVersion": "1.8",
|
||||
"autoUpgradeMinorVersion": true,
|
||||
"protectedSettings": {
|
||||
"commandToExecute": "powershell -ExecutionPolicy Unrestricted -File helloWorld.ps1"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependsOn": [
|
||||
"[resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName'))]",
|
||||
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]",
|
||||
"[resourceId('Microsoft.Network/virtualNetworks', variables('vnetName'))]"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
Загрузка…
Ссылка в новой задаче