Azure Load Balancer
The Azure Load Balancer distributes inbound traffic among healthy instances of services in a virtual network. It supports both public and internal load balancing scenarios.
Key Features
- Layer‑4 (TCP/UDP) load balancing
- High availability with SLA up to 99.99 %
- Outbound connectivity for virtual machines
- Health probes for automatic fail‑over
- Support for IPv4 and IPv6
Supported Scenarios
Scenario | Load Balancer Type |
---|---|
Public web traffic to VMs | Public Load Balancer |
Internal service mesh | Internal Load Balancer |
Outbound internet connectivity for a subnet | Standard Public LB (Outbound) |
Quick Start
Azure CLI
PowerShell
Azure Portal
# Create a resource group
az group create -n MyLoadBalancerRG -l eastus
# Create a public IP address
az network public-ip create -g MyLoadBalancerRG -n MyPublicIP --sku Standard
# Create a frontend IP configuration
az network lb create -g MyLoadBalancerRG -n MyLoadBalancer \
--sku Standard --public-ip-address MyPublicIP
# Add a backend pool
az network lb address-pool create -g MyLoadBalancerRG \
--lb-name MyLoadBalancer -n BackendPool
# Create a health probe (TCP on port 80)
az network lb probe create -g MyLoadBalancerRG --lb-name MyLoadBalancer \
-n TcpProbe --protocol Tcp --port 80
# Create a load balancing rule
az network lb rule create -g MyLoadBalancerRG --lb-name MyLoadBalancer \
-n HttpRule --protocol Tcp --frontend-port 80 --backend-port 80 \
--frontend-ip-name LoadBalancerFrontEnd --backend-pool-name BackendPool \
--probe-name TcpProbe
# Resource Group
New-AzResourceGroup -Name MyLoadBalancerRG -Location eastus
# Public IP
$publicIp = New-AzPublicIpAddress -Name MyPublicIP -ResourceGroupName MyLoadBalancerRG `
-Location eastus -AllocationMethod Static -Sku Standard
# Load Balancer
$lb = New-AzLoadBalancer -ResourceGroupName MyLoadBalancerRG -Name MyLoadBalancer `
-Location eastus -Sku Standard -FrontendIpConfiguration @(
New-AzLoadBalancerFrontendIpConfig -Name FrontendConfig -PublicIpAddress $publicIp)
# Backend pool
Add-AzLoadBalancerBackendAddressPoolConfig -LoadBalancer $lb -Name BackendPool
# Health Probe
Add-AzLoadBalancerProbeConfig -LoadBalancer $lb -Name TcpProbe -Protocol Tcp -Port 80
# Load Balancing Rule
Add-AzLoadBalancerRuleConfig -LoadBalancer $lb -Name HttpRule -Protocol Tcp `
-FrontendPort 80 -BackendPort 80 -FrontendIpConfiguration $lb.FrontendIpConfigurations[0] `
-BackendAddressPool $lb.BackendAddressPools[0] -Probe $lb.Probes[0]
Set-AzLoadBalancer -LoadBalancer $lb
1. Open the Azure portal and navigate to Create a resource → Networking → Load Balancer.
2. Fill in the basic settings (resource group, name, region, SKU).
3. Choose Public or Internal as the type and associate a public IP address if needed.
4. Create a Backend pool and add your virtual machines or scale set.
5. Define a Health probe (e.g., TCP on port 80).
6. Add a Load balancing rule linking the front‑end to the back‑end.
7. Review and create.
Best Practices
- Use the Standard SKU for production workloads to benefit from zone‑redundancy and larger scale limits.
- Configure health probes that accurately reflect your application's availability.
- Combine Load Balancer with Network Security Groups (NSGs) to restrict traffic.
- Monitor metrics via Azure Monitor and set up alerts for unhealthy instances.