title | description | author | ms.author | ms.service | ms.topic | ms.date |
---|---|---|---|---|---|---|
Configure virtual machine scale set with an existing Azure Load Balancer - Azure CLI |
Learn how to configure a virtual machine scale set with an existing Azure Load Balancer by using the Azure CLI. |
asudbring |
allensu |
load-balancer |
how-to |
03/25/2020 |
In this article, you'll learn how to configure a virtual machine scale set with an existing Azure Load Balancer.
- An Azure subscription.
- An existing standard sku load balancer in the subscription where the virtual machine scale set will be deployed.
- An Azure Virtual Network for the virtual machine scale set.
[!INCLUDE cloud-shell-try-it.md]
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.
Sign into Azure.
az login
Replace the values in brackets with the names of the resources in your configuration.
az vmss create \
--resource-group <resource-group> \
--name <vmss-name>\
--image <your-image> \
--admin-username <admin-username> \
--generate-ssh-keys \
--upgrade-policy-mode Automatic \
--instance-count 3 \
--vnet-name <virtual-network-name> \
--subnet <subnet-name> \
--lb <load-balancer-name> \
--backend-pool-name <backend-pool-name>
The below example deploys a virtual machine scale set with:
- Virtual machine scale set named myVMSS
- Azure Load Balancer named myLoadBalancer
- Load balancer backend pool named myBackendPool
- Azure Virtual Network named myVnet
- Subnet named mySubnet
- Resource group named myResourceGroup
- Ubuntu Server image for the virtual machine scale set
az vmss create \
--resource-group myResourceGroup \
--name myVMSS \
--image Canonical:UbuntuServer:18.04-LTS:latest \
--admin-username adminuser \
--generate-ssh-keys \
--upgrade-policy-mode Automatic \
--instance-count 3 \
--vnet-name myVnet\
--subnet mySubnet \
--lb myLoadBalancer \
--backend-pool-name myBackendPool
Note
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.
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: