Azure Load Balancer
Azure Load Balancer is a high-performance, low-latency Layer 4 load balancer that enables you to distribute network traffic effectively across your virtual machines and services in Azure. It provides a range of features to ensure high availability and scalability for your applications.

Conceptual diagram of Azure Load Balancer distribution.
Key Concepts
- Load Balancing Rules: Define how traffic is distributed to back-end instances. You specify the front-end IP configuration, protocol, port, and the back-end port.
- Health Probes: Monitor the health of back-end instances. If an instance fails a health probe, the load balancer stops sending traffic to it.
- Floating IP (Direct Server Return): Allows a single IP address to be used by multiple resources, often used for high-availability scenarios like SQL Server Always On Availability Groups.
- Session Persistence (Sticky Sessions): Ensures that requests from a client are directed to the same back-end instance for the duration of a session.
- Inbound and Outbound Load Balancing: Azure Load Balancer can manage both inbound traffic to your services and outbound traffic from your virtual machines to the internet.
Types of Azure Load Balancers
- Standard Load Balancer: Offers advanced features, higher availability SLAs, and zone redundancy. Recommended for production workloads.
- Basic Load Balancer: A cost-effective option for development and testing, with fewer features and a lower SLA.
Common Use Cases
- Distributing incoming internet traffic to a web farm.
- Distributing traffic between application tiers.
- Ensuring high availability of stateful applications.
- Providing outbound connectivity for virtual machines.
Configuration Example (CLI)
Here's a simplified example of creating a Standard Load Balancer using the Azure CLI:
az network lb create \
--resource-group myResourceGroup \
--name myLoadBalancer \
--sku Standard \
--frontend-ip-name myFrontEnd \
--public-ip-address myPublicIP
This command creates a Standard SKU load balancer with a frontend IP address associated with a public IP resource.
Adding a Load Balancing Rule
az network lb rule create \
--resource-group myResourceGroup \
--lb-name myLoadBalancer \
--name httpRule \
--protocol tcp \
--frontend-port 80 \
--backend-port 80 \
--frontend-ip-name myFrontEnd \
--backend-pool-name myBackEndPool \
--idle-timeout 15 \
--enable-tcp-reset true
Tip: Always use Standard Load Balancer for production environments to leverage its enhanced reliability and features.