|
| 1 | +--- |
| 2 | +title: Configure virtual machine scale set with an existing Azure Load Balancer - Azure portal |
| 3 | +description: Learn how to configure a virtual machine scale set with an existing Azure Load Balancer. |
| 4 | +author: asudbring |
| 5 | +ms.author: allensu |
| 6 | +ms.service: load-balancer |
| 7 | +ms.topic: article |
| 8 | +ms.date: 09/17/2019 |
| 9 | +--- |
| 10 | + |
| 11 | +# Configure a virtual machine scale set with an existing Azure Load Balancer using the Azure CLI |
| 12 | + |
| 13 | +In this article, you'll learn how to configure a virtual machine scale set with an existing Azure Load Balancer. |
| 14 | + |
| 15 | +## Prerequisites |
| 16 | + |
| 17 | +- An Azure subscription. |
| 18 | +- An existing Azure Load Balancer in the subscription where the virtual machine scale set will be deployed. |
| 19 | +- An Azure Virtual Network for the virtual machine scale set. |
| 20 | + |
| 21 | +[!INCLUDE [cloud-shell-try-it.md](../../includes/cloud-shell-try-it.md)] |
| 22 | + |
| 23 | +If you choose to use the CLI locally, this article requires that you have a version of the Azure CLI version 2.0.28 or later installed. To find the version, run `az --version`. If you need to install or upgrade, see [Install Azure CLI 2.0]( /cli/azure/install-azure-cli). |
| 24 | + |
| 25 | +## Sign in to Azure CLI |
| 26 | + |
| 27 | +Sign into Azure. |
| 28 | + |
| 29 | +```azurecli-interactive |
| 30 | +az login |
| 31 | +``` |
| 32 | + |
| 33 | +## Deploy a virtual machine scale set with existing load balancer |
| 34 | + |
| 35 | +Replace the values in brackets with the names of the resources in your configuration. |
| 36 | + |
| 37 | +```azurecli-interactive |
| 38 | +az vmss create \ |
| 39 | + --resource-group <resource-group> \ |
| 40 | + --name <vmss-name>\ |
| 41 | + --image <your-image> \ |
| 42 | + --admin-username <admin-username> \ |
| 43 | + --generate-ssh-keys \ |
| 44 | + --upgrade-policy-mode Automatic \ |
| 45 | + --instance-count 3 \ |
| 46 | + --vnet-name <virtual-network-name> \ |
| 47 | + --subnet <subnet-name> \ |
| 48 | + --lb <load-balancer-name> \ |
| 49 | + --backend-pool-name <backend-pool-name> |
| 50 | +``` |
| 51 | + |
| 52 | +The below example deploys a virtual machine scale set with: |
| 53 | + |
| 54 | +- Virtual machine scale set named **myVMSS** |
| 55 | +- Azure Load Balancer named **myLoadBalancer** |
| 56 | +- Load balancer backend pool named **myBackendPool** |
| 57 | +- Azure Virtual Network named **myVnet** |
| 58 | +- Subnet named **mySubnet** |
| 59 | +- Resource group named **myResourceGroup** |
| 60 | +- Ubuntu Server image for the virtual machine scale set |
| 61 | + |
| 62 | +```azurecli-interactive |
| 63 | +az vmss create \ |
| 64 | + --resource-group myResourceGroup \ |
| 65 | + --name myVMSS \ |
| 66 | + --image Canonical:UbuntuServer:18.04-LTS:latest \ |
| 67 | + --admin-username adminuser \ |
| 68 | + --generate-ssh-keys \ |
| 69 | + --upgrade-policy-mode Automatic \ |
| 70 | + --instance-count 3 \ |
| 71 | + --vnet-name myVnet\ |
| 72 | + --subnet mySubnet \ |
| 73 | + --lb myLoadBalancer \ |
| 74 | + --backend-pool-name myBackendPool |
| 75 | +``` |
| 76 | +> [!NOTE] |
| 77 | +> After the scale set has been created, the backend port cannot be modified for a load balancing rule used by a health probe of the load balancer. To change the port, you can remove the health probe by updating the Azure virtual machine scale set, update the port and then configure the health probe again. |
| 78 | +
|
| 79 | +## Next Steps |
| 80 | + |
| 81 | +In this article, you deployed a virtual machine scale set with an existing Azure Load Balancer. To learn more about virtual machine scale sets and load balancer, see: |
| 82 | + |
| 83 | +- [What is Azure Load Balancer?](load-balancer-overview.md) |
| 84 | +- [What are virtual machine scale sets?](../virtual-machine-scale-sets/overview.md) |
0 commit comments