Introduction to Azure Load Balancer
Azure Load Balancer is a high-performance, highly available load balancer service that operates at Layer 4 (TCP/UDP). It distributes incoming traffic across multiple virtual machines (VMs) in a backend pool, ensuring application availability and responsiveness.

Key Components
- Frontend IP Configuration: One or more public or private IP addresses used by the load balancer to receive incoming traffic.
- Backend Pool: A collection of virtual machines or virtual machine scale sets that will receive the traffic distributed by the load balancer.
- Health Probes: Used to monitor the health of the backend instances. If an instance fails a health probe, the load balancer stops sending traffic to it.
- Load Balancing Rules: Define how traffic is distributed from a frontend IP and port to backend instances and ports.
- Inbound NAT Rules: Used to direct specific inbound traffic to a specific VM.
Steps for Basic Configuration
This section outlines the fundamental steps to configure an Azure Load Balancer using the Azure portal.
Step 1: Create an Azure Load Balancer
Navigate to the Azure portal and search for "Load balancers". Click "Create load balancer".
- Subscription and Resource group: Select appropriate values.
- Name: Provide a unique name for your load balancer.
- Region: Choose the region where your resources are located.
- SKU: For basic configurations, choose 'Standard' for more features and availability, or 'Basic' for simpler scenarios. For this guide, we'll assume 'Standard'.
- Type: Select 'Public' for internet-facing applications or 'Internal' for applications accessible only within your VNet.
- Public IP address: Create a new public IP address or select an existing one for the frontend.
Click "Review + create" and then "Create".
Step 2: Configure the Backend Pool
Once the load balancer is deployed, go to its resource page and navigate to "Backend pools". Click "Add".
- Name: Provide a name for your backend pool.
- Virtual machines: Select the VMs or VMSS you want to include in this pool.
- Network interface: Ensure the correct network interface is selected for each VM.
Click "Add" to save the backend pool.
Step 3: Create a Health Probe
In the load balancer resource, navigate to "Health probes" and click "Add".
- Name: A descriptive name for the probe (e.g.,
http-probe
). - Protocol: Select the protocol your application uses (e.g., HTTP, TCP, HTTPS).
- Port: The port on your backend VMs that the probe will check (e.g., 80 for HTTP).
- Path (if HTTP/HTTPS): The URL path for the probe to check (e.g.,
/health
). - Interval: The time in seconds between probe attempts.
- Unhealthy threshold: The number of consecutive probe failures before an instance is marked as unhealthy.
Click "Add".
Step 4: Configure a Load Balancing Rule
Navigate to "Load balancing rules" and click "Add".
- Name: A descriptive name (e.g.,
web-traffic-rule
). - IP Version: IPv4 or IPv6.
- Frontend IP address: Select the frontend IP you configured.
- Protocol: TCP or UDP.
- Port: The port clients will connect to (e.g., 80 for HTTP).
- Backend port: The port your application is listening on the backend VMs (often the same as the frontend port, e.g., 80).
- Backend pool: Select the backend pool you created.
- Health probe: Select the health probe you created.
- Session persistence: Choose whether to direct a client to the same backend instance for the duration of a session (None, Client IP, Client IP and protocol).
- Floating IP (Direct Server Return): Enable if your scenario requires it (usually for specific high-availability scenarios like SQL Server Always On).
Click "Add".
Example Scenario: Load Balancing Web Servers
To load balance HTTP traffic (port 80) to a pool of web servers running on port 80:
- Frontend IP: Your public IP address.
- Frontend Port: 80
- Protocol: TCP
- Backend Pool: Your pool of web servers.
- Backend Port: 80
- Health Probe: An HTTP probe on port 80, path
/
, interval 5 seconds, unhealthy threshold 2.
Example CLI Commands (Azure CLI)
Here are some equivalent commands using the Azure CLI:
# Create a Load Balancer
az network lb create \
--name myLoadBalancer \
--resource-group myResourceGroup \
--frontend-ip-name myFrontendIP \
--public-ip-address myPublicIP \
--sku Standard
# Create a Backend Pool
az network lb address-pool create \
--lb-name myLoadBalancer \
--resource-group myResourceGroup \
--name myBackendPool
# Add a VM to the Backend Pool (example)
az network nic ip-config address-pool add \
--ip-config-name ipconfig1 \
--lb-name myLoadBalancer \
--resource-group myResourceGroup \
--pool-name myBackendPool \
--nic-name myVMnic
# Create a Health Probe
az network lb probe create \
--lb-name myLoadBalancer \
--resource-group myResourceGroup \
--name myHTTPProbe \
--protocol http \
--port 80 \
--path /health
# Create a Load Balancing Rule
az network lb rule create \
--lb-name myLoadBalancer \
--resource-group myResourceGroup \
--name myHTTPRule \
--protocol tcp \
--frontend-port 80 \
--backend-port 80 \
--frontend-ip-name myFrontendIP \
--backend-pool-name myBackendPool \
--probe-name myHTTPProbe
Next Steps
Explore more advanced configurations like inbound NAT rules, load balancing rules for different protocols, and integration with Virtual Machine Scale Sets.