From eb714cc5b462531267b222a4b2fcf4efc844b648 Mon Sep 17 00:00:00 2001 From: martab-msft Date: Wed, 3 Oct 2018 15:23:18 -0700 Subject: [PATCH] Add 201-vmss-windows-vm-largescale-with-managed-disk template (#380) * add 201-vmss-windows-vm-largescale-with-managed-disk template * Update template's apiProfile * Fix tab * Add new line at end of file * prepopulate on the parameters file * Remove vmssName var from parameter file --- .../README.md | 9 + .../azuredeploy.json | 269 ++++++++++++++++++ .../azuredeploy.parameters.json | 30 ++ .../metadata.json | 7 + 4 files changed, 315 insertions(+) create mode 100644 201-vmss-windows-vm-largescale-with-managed-disk/README.md create mode 100644 201-vmss-windows-vm-largescale-with-managed-disk/azuredeploy.json create mode 100644 201-vmss-windows-vm-largescale-with-managed-disk/azuredeploy.parameters.json create mode 100644 201-vmss-windows-vm-largescale-with-managed-disk/metadata.json diff --git a/201-vmss-windows-vm-largescale-with-managed-disk/README.md b/201-vmss-windows-vm-largescale-with-managed-disk/README.md new file mode 100644 index 0000000..c105155 --- /dev/null +++ b/201-vmss-windows-vm-largescale-with-managed-disk/README.md @@ -0,0 +1,9 @@ +# Deploy a VM Scale Set of Windows VMs + +This template allows you to deploy a VM Scale Set of Windows VMs using the lastest patched version of various Windows Versions. The VM Scale Set can be scaled upto 100 VMs. VMs are set with 2 managed disks; the OS disk and a data disk of 1 GB. VMs are behind a load balancer with NAT rules for rdp connections. To connect from the load balancer to a VM in the scale set, you would go to the AzureStack Portal, find the load balancer of your scale set, examine the NAT rules, then connect using the NAT rule you want. For example, if there is a NAT rule on port 50000, you could RDP on port 50000 of the public IP to connect to that VM. Similarly if something is listening on port 80 we can connect to it using port 80. + +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 100 or less. diff --git a/201-vmss-windows-vm-largescale-with-managed-disk/azuredeploy.json b/201-vmss-windows-vm-largescale-with-managed-disk/azuredeploy.json new file mode 100644 index 0000000..1f0e5c3 --- /dev/null +++ b/201-vmss-windows-vm-largescale-with-managed-disk/azuredeploy.json @@ -0,0 +1,269 @@ +{ + "$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." + } + }, + "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": "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." + } + }, + "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." + } + }, + "dataDiskSizeGB": { + "defaultValue": 1, + "type": "Int", + "metadata": { + "description": "Size of the data disk (GB) to be attached to the VMs." + } + } + }, + "variables": { + "location": "[resourceGroup().location]", + "vnetName": "[toLower(concat('vnet', uniqueString(resourceGroup().id)))]", + "subnetName": "[toLower(concat('subnet', uniqueString(resourceGroup().id)))]", + "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.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": "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')]", + "location": "[variables('location')]", + "properties": { + "upgradePolicy": { + "mode": "Manual" + }, + "virtualMachineProfile": { + "storageProfile": { + "osDisk": { + "caching": "ReadOnly", + "createOption": "FromImage" + }, + "dataDisks": [ + { + "diskSizeGB": "[parameters('dataDiskSizeGB')]", + "lun": 1, + "createOption": "Empty" + } + ], + "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.Network/virtualNetworks/', variables('vnetName'))]", + "[resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName'))]" + ] + } + ] +} diff --git a/201-vmss-windows-vm-largescale-with-managed-disk/azuredeploy.parameters.json b/201-vmss-windows-vm-largescale-with-managed-disk/azuredeploy.parameters.json new file mode 100644 index 0000000..0332a86 --- /dev/null +++ b/201-vmss-windows-vm-largescale-with-managed-disk/azuredeploy.parameters.json @@ -0,0 +1,30 @@ +{ + "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "vmSku": { + "value": "Standard_D1" + }, + "instanceCount": { + "value": 2 + }, + "adminUsername": { + "value": "azureuser" + }, + "adminPassword": { + "value": "[concat('Subscription#', subscription().subscriptionId)]" + }, + "osImagePublisher": { + "value": "MicrosoftWindowsServer" + }, + "osImageOffer": { + "value": "WindowsServer" + }, + "osImageSku": { + "value": "2016-Datacenter" + }, + "dataDiskSizeGB": { + "value": 1 + } + } +} diff --git a/201-vmss-windows-vm-largescale-with-managed-disk/metadata.json b/201-vmss-windows-vm-largescale-with-managed-disk/metadata.json new file mode 100644 index 0000000..00bc13f --- /dev/null +++ b/201-vmss-windows-vm-largescale-with-managed-disk/metadata.json @@ -0,0 +1,7 @@ +{ + "itemDisplayName": "Deploy a Windows VM Scale Set", + "description": "This template allows you to deploy a VM Scale Set of Windows VMs using the lastest patched version of various Windows Versions. The VM Scale Set can be scaled upto 100 VMs. VMs are set with 2 managed disks; the OS disk and a data disk of 1 GB. VMs are behind a load balancer with NAT rules for rdp connections.", + "summary": "This template deploys a Windows VM Scale Set with custom script extension behind a load balancer with NAT rules for rdp connections.", + "githubUsername": "azurestack", + "dateUpdated": "2018-09-29" +}