Last active
December 4, 2023 20:05
-
-
Save activeeon-bot/0ae94e182edfa6099314ad023d2d7bc4 to your computer and use it in GitHub Desktop.
ARM template for deploying Azure scaleSet without virtual network. New version including Windows compatibility.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"vmssName": { | |
"type": "string" | |
}, | |
"sasKey": { | |
"type": "string" | |
}, | |
"instancePriority": { | |
"type": "string", | |
"defaultValue": "Regular", | |
"allowedValues": [ | |
"Low", | |
"Regular", | |
"Spot" | |
] | |
}, | |
"evictionPolicy": { | |
"type": "string", | |
"defaultValue": "Delete", | |
"allowedValues": [ | |
"Delete", | |
"Deallocate" | |
] | |
}, | |
"maxPrice": { | |
"type": "String", | |
"defaultValue": -1 | |
}, | |
"tcpProbeProperties": { | |
"type": "object" | |
}, | |
"natPoolInboundProtocol": { | |
"type": "string" | |
}, | |
"natPoolInboundPort": { | |
"type": "int" | |
}, | |
"frontendPortRangeStart": { | |
"type": "int" | |
}, | |
"frontendPortRangeEnd": { | |
"type": "int" | |
}, | |
"virtualNetworkId": { | |
"type": "string" | |
}, | |
"subnetName": { | |
"type": "string" | |
}, | |
"osProfile": { | |
"type": "object" | |
}, | |
"storageProfile": { | |
"type": "object" | |
}, | |
"virtualMachineSku": { | |
"type": "object" | |
}, | |
"extensionProfile": { | |
"type": "object" | |
} | |
}, | |
"variables": { | |
"publicIPAddressName": "[concat(parameters('vmssName'), '-ip')]", | |
"publicIPAddressID": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]", | |
"loadBalancerName": "[concat(parameters('vmssName'), '-lb')]", | |
"frontEndIPConfigID": "[resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', variables('loadBalancerName'), 'LoadBalancerFrontEnd')]", | |
"bePoolName": "[concat(parameters('vmssName'), '-pool')]", | |
"networkInterfaceName": "[concat('vmssName', '-nic')]", | |
"ipConfigName": "[concat(parameters('vmssName'), '-ipconfig')]", | |
"location": "[resourceGroup().location]", | |
"evictionPolicy": "[if(equals(parameters('instancePriority'), 'Spot'), parameters('evictionPolicy'), json('null'))]", | |
"maxPrice": "[if(equals(parameters('instancePriority'), 'Spot'), if(equals(parameters('maxPrice'), '-1'), int(parameters('maxPrice')), json(parameters('maxPrice'))), json('null'))]" | |
}, | |
"outputs": { | |
"vmssName": { | |
"value": "[parameters('vmssName')]", | |
"type": "string" | |
} | |
}, | |
"resources": [ | |
{ | |
"type": "Microsoft.Network/publicIPAddresses", | |
"name": "[variables('publicIPAddressName')]", | |
"location": "[variables('location')]", | |
"apiVersion": "2018-02-01", | |
"dependsOn": [], | |
"sku": { | |
"name": "Standard" | |
}, | |
"properties": { | |
"publicIPAllocationMethod": "Static", | |
"dnsSettings": { | |
"domainNameLabel": "[parameters('vmssName')]" | |
} | |
} | |
}, | |
{ | |
"type": "Microsoft.Network/loadBalancers", | |
"name": "[variables('loadBalancerName')]", | |
"location": "[variables('location')]", | |
"apiVersion": "2018-02-01", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]" | |
], | |
"sku": { | |
"name": "Standard" | |
}, | |
"properties": { | |
"frontendIPConfigurations": [ | |
{ | |
"name": "LoadBalancerFrontEnd", | |
"properties": { | |
"publicIPAddress": { | |
"id": "[variables('publicIPAddressID')]" | |
} | |
} | |
} | |
], | |
"backendAddressPools": [ | |
{ | |
"name": "[variables('bePoolName')]" | |
} | |
], | |
"loadBalancingRules": [ | |
{ | |
"name": "lbrules", | |
"properties" : { | |
"frontendIPConfiguration": { | |
"id": "[variables('frontEndIPConfigID')]" | |
}, | |
"frontendPort": 80, | |
"backendPort": 80, | |
"protocol": "[parameters('natPoolInboundProtocol')]", | |
"loadDistribution": "Default", | |
"disableOutboundSnat": false, | |
"backendAddressPool": { | |
"id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', variables('loadBalancerName'), variables('bePoolName'))]" | |
}, | |
"probe": { | |
"id": "[resourceId('Microsoft.Network/loadBalancers/probes', variables('loadBalancerName'), 'tcpProbe')]" | |
} | |
} | |
} | |
], | |
"probes": [ | |
{ | |
"name": "tcpProbe", | |
"properties": "[parameters('tcpProbeProperties')]" | |
} | |
], | |
"inboundNatPools": [ | |
{ | |
"name": "natpool", | |
"properties": { | |
"backendPort": "[parameters('natPoolInboundPort')]", | |
"frontendPortRangeStart": "[parameters('frontendPortRangeStart')]", | |
"frontendPortRangeEnd": "[parameters('frontendPortRangeEnd')]", | |
"protocol": "[parameters('natPoolInboundProtocol')]", | |
"frontendIPConfiguration": { | |
"id": "[variables('frontEndIPConfigID')]" | |
} | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"type": "Microsoft.Compute/virtualMachineScaleSets", | |
"name": "[parameters('vmssName')]", | |
"location": "[variables('location')]", | |
"apiVersion": "2019-03-01", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName'))]" | |
], | |
"sku": "[parameters('virtualMachineSku')]", | |
"properties": { | |
"overprovision": false, | |
"singlePlacementGroup": false, | |
"upgradePolicy": { | |
"mode": "Manual" | |
}, | |
"virtualMachineProfile": { | |
"priority": "[parameters('instancePriority')]", | |
"evictionPolicy": "[variables('evictionPolicy')]", | |
"billingProfile": { | |
"maxPrice": "[variables('maxPrice')]" | |
}, | |
"extensionProfile": "[parameters('extensionProfile')]", | |
"networkProfile": { | |
"networkInterfaceConfigurations": [ | |
{ | |
"name": "[variables('networkInterfaceName')]", | |
"properties": { | |
"enableIPForwarding": false, | |
"primary": true, | |
"ipConfigurations": [ | |
{ | |
"name": "[variables('ipConfigName')]", | |
"properties": { | |
"privateIPAddressVersion": "IPv4", | |
"subnet": { | |
"id": "[concat(parameters('virtualNetworkId'), '/subnets/', parameters('subnetName'))]" | |
}, | |
"loadBalancerBackendAddressPools": [ | |
{ | |
"id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', variables('loadBalancerName'), variables('bePoolName'))]" | |
} | |
], | |
"loadBalancerInboundNatPools": [ | |
{ | |
"id": "[resourceId('Microsoft.Network/loadBalancers/inBoundNatPools', variables('loadBalancerName'), 'natpool')]" | |
} | |
] | |
} | |
} | |
] | |
} | |
} | |
] | |
}, | |
"osProfile": "[parameters('osProfile')]", | |
"storageProfile": "[parameters('storageProfile')]" | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment