Load Balancing In Azure - Step By Step Example

With this article, I will lead you through an example of how to perform Load Balancing in Microsoft Azure.

Load Balancers distribute the incoming traffic over multiple servers. Here, it will distribute the load over two Virtual Machines that I have already created.
  1. First, click on "Create a Resource", and find Load Balancer under the Networking category.

    Azure

  2. Set the name of Load Balancer, keep it Public. Set the Public Address. Create new, keep it dynamic, and give it some name. 

    Azure

  3. I am using an existing resource group where I have already created two Virtual Machines. Give the location and click on "Create". 

    Azure

    1. First, we are going to configure Health Probes of our Load Balancer. So, we need to define how many servers we need to make the Load Balancer.

  4. So, inside Load Balancer, go to Health Probes and click on Add. 

     Azure

  5. Give name to the Health Probe. The interval shows at it is going to make a probe attempt at five second intervals. And the unhealthy threshold shows that after two failed probe attempts, it is going to declare it as an unhealthy server.

    Azure

    1. Now comes the role of Backend Pools.
    2. In the Backend Pools, we define the servers which we are going to use in the Load Balancer.

  6. Now click on Backend Pools and click on Add. 

    Azure

  7. Here I have given some name to my Backend Pool. I have associated it with an availability set that I had created. This AvailSet1 contains two of my VMs. Next, we need to add target network IP configuration. 

    Azure

  8. First I have selected the VM1 and its network IP configuration. 

    Azure

  9. Then I have selected the second VM and its IP configuration. Finally click on OK. 

    Azure

  10. So the backend pool has been configured now. The next step is configuring Load Balancing Rules.

    Azure

  11. Click on Load Balancing Rules and click on Add. 

    Azure

  12. Here I have given some name to the rule. The IP version is IPv4, protocol is TCP, port number is 80, backend port is 80, backend pool is the one that we just created and the health probe is the one that we just created. 

    Azure

  13. Session persistence is none by default and idle timeout is 4 minutes by default. Floating IP disabled. Click on OK. 

    Azure

  14. So our Load Balancing Rule has been created. 

    Azure

  15. Both of my VMs which are under the Load Balancer are in running mode. 

    Azure

  16. In the Load Balancer, I have my Public IP address. I am going to copy it and paste it in the address bar. 

    Azure

  17. On the first hit, it has taken me to VM1’s server. 

    Azure

  18. But if I hit the same address in another browser window, it is taking me to VM2’s server. 

    Azure

  19. Side by side they would look something like this.

    Azure