Azure Load Balancer Documentation

This document provides a comprehensive guide to Azure Load Balancer, a powerful service that distributes network traffic across multiple virtual machines or services within an Azure virtual network. It offers high availability and improves application responsiveness by routing client requests to healthy instances.

What is Azure Load Balancer?

Azure Load Balancer is a Layer 4 (TCP/UDP) load balancer that enables you to distribute inbound and outbound traffic. It provides:

Key Concepts

Load Balancing Rules

Load balancing rules define how traffic is distributed to your backend pool. You specify the frontend IP address, protocol, port, and the backend port to which traffic should be sent. Health probes are used to determine the health of backend instances.

Health Probes

Health probes are essential for monitoring the health of your backend instances. Azure Load Balancer periodically sends probes to these instances. If an instance fails to respond to a probe, it is marked as unhealthy, and traffic is no longer sent to it until it becomes healthy again.

Supported probe types include:

Backend Pools

A backend pool is a collection of virtual machines or virtual machine scale sets that serve the incoming traffic. When you create a load balancing rule, you associate it with a backend pool.

Inbound and Outbound Load Balancing

Inbound Load Balancing: Distributes incoming traffic from the internet or your on-premises network to your backend resources.

Outbound Load Balancing: Enables virtual machines within your virtual network to access the internet or on-premises resources through a public IP address. This is crucial for scenarios where your VMs need to initiate connections externally.

Types of Azure Load Balancer

Standard Load Balancer

The Standard SKU offers advanced features, including:

Basic Load Balancer

The Basic SKU is a simpler option suitable for development and testing environments. It has fewer features compared to the Standard SKU and does not support availability zones.

Common Scenarios

Web Application Load Balancing

Distribute incoming HTTP/HTTPS traffic across multiple web servers to ensure high availability and scalability for your web applications.

Web App Icon

Database Load Balancing

Distribute database connections across a cluster of database instances for improved performance and fault tolerance.

Database Icon

Internal Load Balancing

Distribute traffic for internal services within your virtual network, ensuring internal applications are highly available.

Internal Icon

Getting Started

To get started with Azure Load Balancer:

  1. Create a Load Balancer: You can create a Basic or Standard Load Balancer through the Azure portal, Azure CLI, or PowerShell.
  2. Configure a Backend Pool: Add your virtual machines or scale sets to the backend pool.
  3. Define a Health Probe: Set up a health probe to monitor the health of your backend instances.
  4. Create a Load Balancing Rule: Configure rules to direct traffic from the frontend to the backend pool.

Note: For production workloads, it is highly recommended to use the Standard Load Balancer SKU due to its advanced features and availability zone support.

Example Configuration (Azure CLI)

Here's a simplified example of creating a public Standard Load Balancer using the Azure CLI:


az network lb create \
    --resource-group MyResourceGroup \
    --name MyLoadBalancer \
    --sku Standard \
    --public-ip-address MyPublicIP \
    --frontend-ip-name MyFrontendIP \
    --backend-pool-name MyBackendPool

az network lb rule create \
    --resource-group MyResourceGroup \
    --lb-name MyLoadBalancer \
    --name MyHTTPRule \
    --protocol Tcp \
    --frontend-port 80 \
    --backend-port 80 \
    --frontend-ip-name MyFrontendIP \
    --backend-pool-name MyBackendPool \
    --disable-outbound-snat true \
    --idle-timeout 4 \
    --load-distribution Default
        

This example creates a Standard Load Balancer, defines a frontend IP, a backend pool, and a load balancing rule for HTTP traffic on port 80.

Learn More