title | description | author | ms.author | ms.service | ms.topic | ms.date | ms.custom |
---|---|---|---|---|---|---|---|
Tutorial: Add Azure Load Balancer to an existing virtual machine scale set - Azure portal |
In this tutorial, learn how to add a load balancer to existing virtual machine scale set using the Azure portal. |
greg-lindsay |
greglin |
load-balancer |
tutorial |
4/21/2021 |
template-tutorial |
The need may arise when an Azure Load Balancer isn't associated with a virtual machine scale set.
You may have an existing virtual machine scale set deployed with an Azure Load Balancer that requires updating.
The Azure portal can be used to add or update an Azure Load Balancer associated with a virtual machine scale set.
In this tutorial, you learn how to:
[!div class="checklist"]
- Create a virtual network
- Create a NAT gateway for outbound connectivity
- Create a standard SKU Azure Load Balancer
- Create a virtual machine scale set without a load balancer
- Add a Azure Load Balancer to virtual machine scale set
- An Azure account with an active subscription. Create an account for free
In this section, you'll create a virtual network for the scale set and the other resources used in the tutorial.
-
Sign in to the Azure portal.
-
In the search box at the top of the portal, enter Virtual network.
-
In the search results, select Virtual networks.
-
Select + Create.
-
In the Basics tab of the Create virtual network, enter, or select the following information:
Setting Value Project details Subscription Select your subscription. Resource group Select Create new.
Enter TutorLBVMSS-rg in Name.
Select OK.Instance details Name Enter myVNet. Region Select (US) West US 2. -
Select the IP addresses tab, or the Next: IP Addresses button at the bottom of the page.
-
In the IP addresses tab, under Subnet name select default.
-
In the Edit subnet pane, under Subnet name enter myBackendSubnet.
-
Select Save.
-
Select the Security tab, or the Next: Security button at the bottom of the page.
-
In the Security tab, in BastionHost select Enable.
-
Enter or select the following information:
Setting Value Bastion name Enter MyBastionHost. AzureBastionSubnet address space Enter 10.1.1.0/27. Public IP address Select Create new.
Enter myBastionIP in Name. -
Select the Review + create tab, or the blue Review + create button at the bottom of the page.
-
Select Create.
In this section, you'll create a NAT gateway for outbound connectivity of the virtual machines.
-
In the search box at the top of the portal, enter NAT gateway.
-
Select NAT gateways in the search results.
-
Select + Create.
-
In the Basics tab of Create network address translation (NAT) gateway, enter or select the following information:
Setting Value Project details Subscription Select your subscription. Resource group Select TutorLBVMSS-rg. Instance details NAT gateway name Enter myNATgateway. Region Select (US) West US 2. Availability zone Select None. Idle timeout (minutes) Enter 15. -
Select the Outbound IP tab, or select the Next: Outbound IP button at the bottom of the page.
-
Select Create a new public IP address next to Public IP addresses in the Outbound IP tab.
-
Enter myPublicIP-nat in Name.
-
Select OK.
-
Select the Subnet tab, or select the Next: Subnet button at the bottom of the page.
-
Select myVNet in the pull-down menu under Virtual network.
-
Select the check box next to myBackendSubnet.
-
Select the Review + create tab, or select the blue Review + create button at the bottom of the page.
-
Select Create.
In this section, you'll create a load balancer for the virtual machines.
-
In the search box at the top of the portal, enter Load balancer.
-
Select Load balancers in the search results.
-
Select + Create.
-
In the Basics tab of Create load balancer, enter, or select the following information:
Setting Value Project details Subscription Select your subscription. Resource group Select TutorLBVMSS-rg. Instance details Name Enter myLoadBalancer. Region Select (US) West US 2. Type Leave the default of Public. SKU Leave the default of Standard. Tier Leave the default of Regional. Public IP address Public IP address Leave the default of Create new. Public IP address name Enter myPublicIP-lb. Availability zone Select Zone-redundant. Add a public IPv6 address Leave the default of No. Routing preference Leave the default of Microsoft network. -
Select the Review + create tab, or select the blue Review + create button at the bottom of the page.
-
Select Create.
In this section, you'll create a backend pool for myLoadBalancer.
You'll create a health probe to monitor HTTP and Port 80. The health probe will monitor the health of the virtual machines in the backend pool.
You'll create a load-balancing rule for Port 80 with outbound SNAT disabled. The NAT gateway you created earlier will handle the outbound connectivity of the virtual machines.
-
In the search box at the top of the portal, enter Load balancer.
-
Select Load balancers in the search results.
-
Select myLoadBalancer.
-
In myLoadBalancer, select Backend pools in Settings.
-
Select + Add in Backend pools.
-
In Add backend pool, enter or select the following information:
Setting Value Name Enter myBackendPool. Virtual network Select myVNet. Backend Pool Configuration Leave the default of NIC. IP Version Leave the default of IPv4. -
Select Add.
-
Select Health probes.
-
Select + Add.
-
In Add health probe, enter or select the following information:
Setting Value Name Enter myHTTPProbe. Protocol Select HTTP. Port Leave the default of 80. Path Leave the default of /. Interval Leave the default of 5 seconds. Unhealthy threshold Leave the default of 2 consecutive failures. -
Select Add.
-
Select Load-balancing rules.
-
Select + Add.
-
Enter or select the following information in Add load-balancing rule:
Setting Value Name Enter myHTTPRule. IP Version Leave the default of IPv4. Frontend IP address Select LoadBalancerFrontEnd. Protocol Select the default of TCP. Port Enter 80. Backend port Enter 80. Backend pool Select myBackendPool. Health probe Select myHTTPProbe. Session persistence Leave the default of None. Idle timeout (minutes) Change the slider to 15. TCP reset Select Enabled. Floating IP Leave the default of Disabled. Outbound source network address translation (SNAT) Leave the default of (Recommended) Use outbound rules to provide backend pool members access to the internet. -
Select Add.
In this section, you'll create a virtual machine scale set without a load balancer. Later, you'll add a load balancer to this scale set in the Azure portal.
-
In the search box at the top of the portal, enter Virtual machine scale.
-
In the search results, select Virtual machine scale sets.
-
Select + Add.
-
In the Basics tab of Create a virtual machine scale set, enter, or select the following information:
Setting Value Project details Subscription Select your subscription. Resource group Select TutorLBVMSS-rg. Scale set details Virtual machine scale set name Enter myVMScaleSet. Region Select (US) West US 2. Availability zone Leave the default of None. Orchestration Orchestration mode Leave the default of Uniform: optimized for large-scale stateless workloads with identical instances. Instance details Image Select Windows Server 2019 Datacenter - Gen1. Azure Spot Instance Leave the default of the box unchecked. Size Select a size. Administrator account Username Enter a username. Password Enter a password. Confirm password Confirm password. -
Select the Networking tab.
-
Enter or select the following information in the Networking tab:
Setting Value Virtual network configuration Virtual network Select myVNet. -
Select the Review + create tab, or select the blue Review + create button at the bottom of the page.
-
Select Create.
In this section, you'll go to the scale set in the Azure portal and add a load balancer to the scale set.
-
In the search box at the top of the portal, enter Virtual machine scale.
-
In the search results, select Virtual machine scale sets.
-
Select myVMScaleSet.
-
In the Settings section of myVMScaleSet, select Networking.
-
Select the Load balancing tab in the Overview page of the Networking settings of myVMScaleSet.
:::image type="content" source="./media/tutorial-add-lb-existing-scale-set-portal/load-balancing-tab.png" alt-text="Select the load balancing tab in networking." border="true":::
-
Select the blue Add load balancing button.
-
In Add load balancing, enter or select the following information:
Setting Value Load balancing options Select Azure load balancer. Select a load balancer Select myLoadBalancer. Backend pool Select Use existing. Select a backend pool Select myBackendPool. -
Select Save.
If you're not going to continue to use this application, delete the load balancer and the supporting resources with the following steps:
-
In the search box at the top of the portal, enter Resource group.
-
Select Resource groups in the search results.
-
Select TutorLBVMSS-rg.
-
In the overview page of TutorLBVMSS-rg, select Delete resource group.
-
Enter TutorLBVMSS-rg in TYPE THE RESOURCE GROUP NAME.
-
Select Delete.
In this tutorial, you:
- Created a virtual network and Azure Bastion host.
- Created an Azure Standard Load Balancer.
- Created a virtual machine scale set.
- Added load balancer to virtual machine scale set.
Advance to the next article to learn how to create a cross-region Azure Load Balancer:
[!div class="nextstepaction"] Create a cross-region load balancer