Azure Load Balancer: Public and Internal Load Balancing, Probes, Rules, NAT and Outbound Connectivity
What It Does
Azure Load Balancer works at layer 4 (TCP and UDP). It spreads incoming connections across healthy VMs in a backend pool. It is very fast and supports any application protocol.
| Type | Use |
|---|---|
| Public load balancer | Internet traffic to VMs (public frontend IP) |
| Internal load balancer | Traffic inside a VNet or from on-premises (private frontend IP) |
| SKU | Notes |
|---|---|
| Standard | Zone-redundant, up to 1000 instances, SLA, secure by default (needs NSG to allow traffic). Use for production |
| Basic | Being retired. Do not use for new work |
Components
| Part | Meaning |
|---|---|
| Frontend IP | The address clients connect to |
| Backend pool | The VMs or scale set instances that receive traffic |
| Health probe | Checks each VM (TCP, HTTP or HTTPS). Unhealthy instances stop getting traffic |
| Load balancing rule | Maps frontend port to backend port (for example 80 to 80) |
| Inbound NAT rule | Forward a specific port to one VM (for example 50001 to VM1 port 22) |
| Outbound rule | Controls SNAT for outbound internet access |
Create a Public Load Balancer
bash
az network public-ip create -g rg-lb -n pip-lb --sku Standard --zone 1 2 3
az network lb create -g rg-lb -n lb-web --sku Standard --frontend-ip-name fe --public-ip-address pip-lb --backend-pool-name be
az network lb probe create -g rg-lb --lb-name lb-web -n probe-http --protocol Http --port 80 --path /health
az network lb rule create -g rg-lb --lb-name lb-web -n rule-http --protocol Tcp --frontend-port 80 --backend-port 80 \
--frontend-ip-name fe --backend-pool-name be --probe-name probe-http --idle-timeout 4 --load-distribution Default
# add NICs to the backend pool
az network nic ip-config address-pool add -g rg-lb --nic-name nic-web1 --ip-config-name ipconfig1 --lb-name lb-web --address-pool be
Distribution Modes
| Mode | Behavior |
|---|---|
| Default (5-tuple hash) | Source IP, source port, destination IP, destination port, protocol. Spreads connections |
| Source IP affinity (2-tuple) | Same client IP goes to the same VM |
| Source IP and protocol (3-tuple) | Same client and protocol to the same VM |
Internal Load Balancer
bash
az network lb create -g rg-lb -n lb-db --sku Standard --vnet-name vnet-app --subnet data --frontend-ip-name fe-int --backend-pool-name be-db --private-ip-address 10.20.2.100
- Used between tiers (web to app to database) and for HA ports with firewalls (all ports at once)
Outbound and Troubleshooting
- VMs behind a Standard LB without public IPs need outbound rules or a NAT Gateway for internet access. NAT Gateway is the recommended option
- Probe failing? Check the NSG allows the AzureLoadBalancer tag, the app answers on the probe port and path, and the OS firewall allows it
- Use Metrics: Health probe status, Data path availability, SNAT connections
Practice
- Create a Standard public LB with two VMs running a web page
- Browse the frontend IP and refresh to see both VMs
- Stop the web service on one VM and watch the probe remove it
- Create an inbound NAT rule for SSH to one VM
Conclusion
Load Balancer distributes layer 4 traffic using frontends, backend pools, probes and rules. Use Standard SKU, allow probe traffic in NSGs and plan outbound access with NAT Gateway.
Quick Summary: what; components; create; modes; internal; outbound and troubleshooting.

