Microsoft Azure

How to Create Standard Load Balancer in Azure

In this guide, I will show you how to create a Standard Load Balancer that load balances VMs across availability zones. Azure Load balancing provides a higher level of availability by distributing incoming requests across multiple VMs. This helps to defend your apps & data from a doubtful failure or loss of an entire datacenter. One or several availability zones, with zone-redundancy, may fail, & the data route remains as long as one zone in the region remains healthy.

Azure Standard Load Balancer just supports a “Standard Public IP address”. When we create a new public IP during creating the load balancer, it is automatically configured as a “Standard SKU” version, & is also automatically zone-redundant.

Steps to Create a Standard Load Balancer

Create a Standard Load Balancer
Create a Virtual Network
Create network security groups
Create VMs across multiple zones (zone redundant) and attach to the load balancer
Create load balancer backend pool
Create a load balancer health probe
Create load balancer traffic rules
Create a basic IIS site
Test load balancer

For more information about using Availability zones visit Microsoft Standard Load Balancer and Availability Zones.

Sign in to Azure Portal

Create Load Balancer

1- Choose Azure menu tab and then select Load Balancers.

microsoft azure menu

2- Select the + Add button to create load balancer.

azure create load balancer

3- Create load balancer wizard, Basics tab, select your resource group, or click new to create a new one.

azure create load balancer

4- Type a resource group name and then click ok.

azure create load balancer

5- Type a name of your Load Balancer (myloadbalancer)
Region (Central US)
Type (Public)
SKU (Standard)

azure create load balancer

6- Public IP address name (mypublicip)
Availability zone (Zone-redundant)
Select Review + create >

azure create load balancer

7- Click on Create.

azure create load balancer validation

8- Now you can see load balancer successfully created.

azure create load balancer

Create backend servers

In this step, I will create a virtual network, VM (virtual machines) in different zones. For the region, and then install IIS on the VMs to help test the zone-redundant load balancer. Therefore, if a zone fails, the health probe for virtual machines in the same zone fails, and then traffic continues to be served by VMs in the other zones.

Create virtual networks

Log in to the Azure portal

1- In the Azure portal, choose Azure menu bar and then select Virtual Network.

azure menu

2- Click on + Add to create virtual network.

azure create virtual network

3- Select your subscriptions
Resource group (my-rg)
Instance details
Virtual network name (myvnet)
Regions (Central US) and then click Next : IP Address >

azure create virtual network

4- IP Addresses tab, type 10.0.0.0/16 for the IPv4 Address Space field. Click the + Add subnet button below.

azure create virtual network ip address

5- Add subnet wizard;
Name (backendsubnet)
Subnet address range types 10.0.0.0/24 and then click Add.

azure vnet add subnet

6- Select Review + Create.

azure create virtual network ip address

7- Select Create.

azure create virtual network validation

8- Virtual network successfully created.

azure create network virtual

Create a network security group

Create “network security group” to specify inbound connections to our virtual network.

1- In Microsoft Azure portal, in the search box type Network Security Group, and select it.

microsoft azure search bar

2- Click Create network security group.

azure create network security group

3- Create network security group wizard
Name of the existing resource group (my-rg)
Name (mynsg) Network Security Group
Region (Central US) and select Review + create

create network security group

4- Select create.

create network security group validation

5- Network Security group successfully created.

azure network security group

Create network security group rules

In this portion, we will create network security group rules to allow inbound connections using HTTP and RDP using the Azure portal.

1- Select your network security group.

azure network security group

2- Under Settings, select Inbound security rules, and then click Add.

azure inbound security rules

3- Source (Service Tag)
Source service tag (Internet)
Destination port ranges (80)
Protocol (TCP)
Action Allow (Allow)
Priority (100)
Load balancer rule name (allowhttp)
Description (allow HTTP traffic)
Click Add.

azure add inbound security rules

4- Create another rule to allow for an inbound RDP connection using port 3389.

azure add inbound security rules

5- Source (Service Tag)
Source service tag (Internet)
Destination port ranges (3389)
Protocol (TCP)
Action Allow (Allow)
Priority (200)
Load balancer rule name (allowrdp)
Description (allow RDP connection)
Click Add.

azure add inbound security rules

6- Inbound security rules successfully created.

azure inbound security rules

Create virtual machines

Now we need to create virtual machines in different zones (zone 1, zone 2, and zone 3) for the region that can act as “backend servers” to the load balancer.

First VM

1- Select Azure menu bar and then select virtual machine.

microsoft azure menu

2- Select + Add

azure virtual machine

3- Select existing resource group (my-rg).

azure new vm wizard

4- Virtual machine name (myvm1)
Region (Central US)
Availability options (Availability zone)
Availability zone (1)
Image (Windows Server 2019 Datacenter

azure vm instance details

5- Enter username, password
Public inbound ports (Allow selected ports)
Select inbound ports (HTTP, HTTPS, RDP)
Select Next : Disks > and then select Next : Networking >

azure new vm wizard

6- Virtual network (myvnet)
NIC network security group (advanced)
Configure network security group (mynsg)
Select Next : Management >

azure new vm networking

7- Boot diagnostic (Off) select Review + create and then select review + create.

azure new vm management

Create 2nd VM

SettingsValue
Resource groupmy-rg
Namemyvm2
RegionCentral US
Availability setAvailability zone
Availability zone2
ServerWindows server 2019 datacenter
Administrator accountUsername, password
Public Inbound portsHTTP, HTTPS, RDP
Networking, virtual networkmyvnet
NIC network security groupAdvanced
Configure network security groupmynsg
ManagementBoot diagnostic off
create 

Create 3rd VM

SettingsValue
Resource groupmy-rg
Namemyvm3
RegionCentral US
Availability setAvailability zone
Availability zone3
ServerWindows server 2019 datacenter
Administrator accountUsername, password
Public Inbound portsHTTP, HTTPS, RDP
Networking, virtual networkmyvnet
NIC network security groupAdvanced
Configure network security groupmynsg
ManagementBoot diagnostic off
create 

Now you can see three virtual machine has been created.

azure virtual machine

Install IIS on VMs

How to install Web server IIS

1- # install IIS server role
Install-WindowsFeature -name Web-Server -IncludeManagementTools

2- # remove default htm file
remove-item C:\inetpub\wwwroot\iisstart.htm

3- # Add a new html file that displays server name
Add-Content -Path “C:\inetpub\wwwroot\iisstart.htm” -Value $(“Hello World from” + $env:computername)

4- C:\inetpub\wwwroot
Right-click on iisstart and open with notepad

windows explorer wwwroot

5- Rename text.

notepad

Repeat steps 1 to 5 to install web server IIS and the updated iisstart.htm file on myVM2 and myVM3.

Create load balancer Resources

In this section, we will configure load balancer settings for a backend address pool and a health probe, and specify load balancer and NAT rules.

Create a backend address pool

To “distribute traffic” to the VMs virtual, a “backend address pool” contains the IP addresses of the virtual (NICs) connected to the load balancer.

1- Select Azure menu and then select load balancer.

2- Click on myLoadBalancer.

azure create load balancer

3- Under Settings, select Backend pools, then click + Add.

azure load balancer backend pool

4- Add a backend pool wizard, do the following.
backend pool name (backendpool).
Virtual network, in the drop-down menu, select (myvnet)
Under Virtual machines click the add button.

azure add vm to backend pool

5- Select the virtual machines to add to backend pool and then click add.

azure add vm to backend pool

6- Click Add.

azure add backend pool

7- Make sure your load balancer backend pool setting displays all the 3 VMs and then select Health probe.

Create a health probe

To permit the load balancer to monitor the status of our app, you use a health probe. The health probe dynamically adds or removes virtual machines from the load balancer rotation based on their response to health checks.

1- Click + Add.

azure health probe

2- Add health probe wizard

Name (healthporbe)
Protocol type (HTTP)
Port number (80)
Number of Interval (5 seconds)
Number of “Unhealthy threshold” or consecutive probe failures (two seconds) that must occur before a VM is considered unhealthy.
Click OK.

azure add health probe

3- Health probe successfully created
Under settings click on load balancing rule

azure load balancer health probe

Create a load balancer rule

A load balancer rule is used to specify traffic how it distributed to the VMs. You specify the front-end IP configuration for the incoming traffic and then the back-end IP pool to receive the traffic, ahead with the required source and destination port.

1- Click + Add.

azure load balancing rule

2- Add load balancing rule wizard.

Name (lb-rule)
IP version (IPv4)
Protocol type TCP
Port number (80)
Backend port (80)
Backend pool (3 virtual machines)
Health probe name (healthprobe)
Click Add.

azure add load balancing rule

Test the load balancer

1- Select Azure menu and then select Load balancers.

microsoft azure menu

2- Click on myloadbalancer

azure load balancers

3- On the overview screen, find the public IP address for the Load Balancer.
Select mypublicip
Copy the public IP address,

azure load balancer overview

4- Open any web browser and then paste it into the address bar.
On the browser, the default page of IIS Web server is displayed.

standard load balancer

5- You can force-refresh your web browser, to see the load balancer distribute traffic across the VMs distributed across the zone

standard load balancer

Jamil Parvez

Jamil Pervez works as a Network Administrator, based in Kuwait with a Primary focus on Microsoft technologies. Microsoft Certified MCSE, MCTP, MCITP, CCNP, CCIP, CCVP with 20 years of experience in administering Windows Servers, Exchange, VMWare, Veeam B&R, Veritas BackupExec.

Related Articles

Leave a Reply

Back to top button