Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • DevOps Lifecycle
  • DevOps Roadmap
  • Docker Tutorial
  • Kubernetes Tutorials
  • Amazon Web Services [AWS] Tutorial
  • AZURE Tutorials
  • GCP Tutorials
  • Docker Cheat sheet
  • Kubernetes cheat sheet
  • AWS interview questions
  • Docker Interview Questions
  • Ansible Interview Questions
  • Jenkins Interview Questions
Open In App
Next Article:
How to Configure an Azure Load Balancer?
Next article icon

How to Configure an Azure Load Balancer?

Last Updated : 20 Sep, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report

In this article, we will see how to set up a Load Balancer in Azure. Load Balancer is a component that splits or divides network traffic across multiple application servers. It helps in the high availability of applications. In this article, we will configure a public load balancer that is accessible through the Internet.

Introduction to Azure Load Balancer

Azure Load Balancer is a component in Azure that helps in uniform distribution of load across services. There are mainly two types of Azure load balancers public and internal. It provides load balancing across various virtual machines, scale sets, and IP addresses.

Types of Azure Load Balancers

  • Public Load Balancer: A load balancer that is exposed to the internet is the public load balancer.
  • Internal Load Balancer: A load balancer that is only available inside the network and not available through the internet is the internal load balancer. It is mainly used for internal traffic splitting.

Health Checks In Azure

Health checks in azure helps in rerouting the traffics to available resources if any of the other resources are not available. Health checks continuously check for availability of resources depending upon specified threshold and time . If it finds an unhealthy resource it forwards the traffic to other healthy resource .

Steps to configure load Balancer in Azure

  • We will first create a virtual network with Bastion host . This network will contain our Azure virtual machine VM's . In the search box on azure portal search for virtual networks and then click create.
  • Specify your subscription and name for virtual network in your required region . Then click next to security tab . Under security tab specify the options as below . specify name for bastion and create new public ip for the same.

virtual private network
>
  • On next tab "IP addresses" select starting address as '10.1.0.0' and address space as '\16' and then 'Add'. Now click on add new subnet . specify following fields . This is configuration for our Virtual machines subnet

subnet settings
  • click add and again select add new subnet and specify options as below . This is configuration for subnet used by Bastion host .

Add subnet

  • Now click on 'review+create' . Review the specified options and then click create.
  • Now lets configure load balancer in virtual network . Search for load balancers in search . Click on create .
  • On create page first select your subscription and then select resource group same as virtual network . Then select public load balancer and specify other options as below .

Instance details
  • Now go to next . Here click on add frontend ip configuration . Under frontend Ip configuration create new public ip address for frontend and make it zone redundant. specify other options as below.

Frontend
  • Click next on backend pools . Select add backend pool . Specify options as below and give backend pool a name. select virtual network we have created as virtual network .

Add backend pool
  • Now click next to configure inbound rules . on this page select add load balancing rule . Now specify options as below .

Load balancing rule

Protocol
  • Create a new health probe with below settings .

Health Probe
  • Click save then click on review and create . After reviewing all the settings click on create.
  • Once the deployment is successful lets create a NAT gateway for outbound access to bastion. Search for NAT gateways in search and click on create . Specify the options as below .

NAT Gateway
  • Click next for outbound IP specification . Create a new public ip address and add it . Now review all configuration and click create . For subnet select backend subnet that we have created .
  • Once the NAT is set up now we will create two virtual machines for web servers . Specify options as below for virtual machine .

Create Virtual Machine
  • Specify user name and password for user . Select None for public inbound ports.
  • Now click next to configure networking . On networking tab select our virtual network and set subnet as backend subnet . select none for public ip address . Now select 'Advanced' for NIC .
  • Now scroll down to configure load balancing . Check 'Put this instance behind load balancer' once the option is selected configure load balancer . Select 'Azure Load balancer' under it select our created load balancer . The backend pool will be automatically selected .
  • Now go up to configure network security group . Click on create new . Specify options as below . Create a new inbound rule with service as 'HTTP' and priority as 100 . Add rule to security group . Click OK.

Network Security group
  • After adding security group click on review and create . Click create .
  • Similarly follow above steps to create another virtual machine . Specify different name for vm2 . Select availability zone 2 for this vm . Make sure you select existing created network security group . After configuring click create .
  • Once both virtual machines are created . Go to overview page of VM1 and click connect select Bastion . Enter Username and Password and connect to VM .
  • On VM desktop search for powershell and run below commands one by one .
Install-WindowsFeature -name Web-Server -IncludeManagementTools
Remove-Item C:\inetpub\wwwroot\iisstart.htm
Add-Content -Path "C:\inetpub\wwwroot\iisstart.htm" -Value $("Hello World from " + $env:computername)
  • If first command fails manually go to windows features options and Turn on "Internet Information Services" and "Internet Information Services Ho-stable web Core" features. After that run next two commands . Close the bastion tab .
  • Do the same for VM2 .
  • Now we have completed configuration of load balancer . Lets check the working .
  • Search for public ip address in search bar . Now go to load balancer ip address . Copy and paste it in the browser you should see similar output as below . Every time you refresh the page it will be served from different virtual machines .

Output 2

OutPut 2
  • If you see above output congratulations you have successfully configured Azure load balancer .

Troubleshooting

  • If you dont see correct output then make sure you have configured the load balancer with correct IP addresses.
  • Make sure your VM instances are in same region and resource group as load balancer .
  • Make sure IP configuration for load balancer is correct .

Best practices for configuring Azure Load Balancer

There are various options for configuring Azure Load Balancer. You can also choose other services as Traffic Manager , Application Gateway, Azure Front Door .etc . For Load Balancer best way to configure is to use group of servers as backend.


Next Article
How to Configure an Azure Load Balancer?

D

deepcodr
Improve
Article Tags :
  • Microsoft Azure
  • DevOps

Similar Reads

    How To Configure GateWay Load Balancer In AWS ?
    In the advanced landscape of cloud computing, managing incoming internet traffic efficiently is fundamental for ensuring the accessibility, scalability, and reliability of applications. AWS offers a set of services to address these necessities, and one such help is the Gateway Load Balancer (GWLB).
    7 min read
    How to Create a Load Balancer on GCP?
    A load balancer in GCP (Google Cloud Platform) is a service that distributes incoming network traffic across multiple backend resources such as virtual machines (VMs), container instances, and managed instance groups. The main purpose of a load balancer is to improve the availability and scalability
    5 min read
    How to Create a Load Balancer and Connect it across 2 VMs?
    Load Balancer is basically defined as a distributing device that is used to distribute the work Processes into different systems/servers. It is generally used to control the traffic on one system by dividing the flow of traffic into different systems. In other words, A load balancer is a networking
    5 min read
    How to Install an SSL Certificate on Azure
    It is always more important for your web applications and services to ensure the transmission data security for users and protect personal information with HTTPS encryption. Microsoft’s cloud offering known as Azure offers several ways of deploying SSL & TLS certificates that would facilitate se
    8 min read
    Create and Configure: Mastering AWS Network Load Balancer Essentials
    In the domain of distributed computing, compelling administration of network traffic is fundamental for keeping up with the presentation, dependability, and versatility of utilizations. Amazon Web Services (AWS), a main cloud specialist organization, offers the Network Load Balancer (NLB) as an esse
    14 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences