Creating Azure Load Balancer for VM Load Balancing

Introduction

In this article, we'll delve into the process of configuring a load balancer in the Microsoft Azure portal to effectively distribute traffic across virtual machines. Assuming you've already set up essential components like a NAT gateway, virtual network, bastion host, and the load balancer itself, we'll focus on the specific steps required to integrate two VMs located in different zones into the load balancer's backend pool. This ensures optimal resource utilization and reliability within your Azure infrastructure.

Step 1. Sign in to the Azure portal via https://portal.azure.com

Step 2. Click on + Create a resource to get started.

Create a resource

Step 3. In the search bar, search for Virtual Machine, click on the Create button, and then click on the Virtual Machine button.

Virtual machine

Step 4. In the Create a Virtual Machine page, under the Basics tab, provide the required information as below.

Create virtual machine

Provide a username and a password for the Administrator account. Make sure to mark Public inbound ports as None.

Administrator account

Then, navigate to the Networking tab.

Step 5. Under the Networking tab, provide the required information as below.

Networking

Click on Create new under Configure network security group. Provide a name and click on + Add an inbound rule.

Name

Select HTTP as the Service, set Priority as 100, and provide a name, then click on Add.

Add inbound security rule

Click on Review + Create. You will be able to see that your VM has successfully been deployed.

Your deployment is complete

Follow the same process for the second VM.

Step 6. Now, select your VM, click on Connect, and Connect via Bastion.

Koshila lb vm

Provide the username and the password. Then click on Connect.

Bastion

Step 7. On the server desktop, navigate to Start > Windows PowerShell > Windows PowerShell.

Window powershell

In the PowerShell Window, run the following commands.

  • Install IIS server role: Install-WindowsFeature -name Web-Server -IncludeManagementTools.
  • Remove default htm file: Remove-Item C:\inetpub\wwwroot\iisstart.htm.
  • Add a new htm file that displays server name: Add-Content -Path "C:\inetpub\wwwroot\iisstart.htm" -Value $("Hello World from " + $env:computername).Administrator window powershell

Follow the same process for the second VM.

Step 8. Get the frontend IP address of the relevant VM and search it on your browser. The custom VM page of the IIS Web server is displayed in the browser.

Summary

In this article, we learned “How to create a load balancer to load balance VMs using the MS Azure portal”. Please use the comments section, if you have any clarifications.


Similar Articles