Fix Azure Virtual Network Load Balancer Errors
When working with Azure Virtual Network, you may encounter a configuration error that prevents your deployment from working. This guide explains the most common mistake with load balancer and shows the exact fix.
A Common Mistake
Creating a load balancer without a health probe, causing traffic to be sent to unhealthy backend VMs.
The incorrect command:
az network lb create --name my-lb --resource-group my-rg --sku Standard --public-ip-address lb-pip
az network lb address-pool create --lb-name my-lb --resource-group my-rg --name backend-pool
az network lb rule create --lb-name my-lb --resource-group my-rg --name http-rule --protocol Tcp --frontend-port 80 --backend-port 80 --backend-pool-name backend-pool
Error output:
Load balancer created without health probe.
Traffic is sent to all backend VMs regardless of health.
When a backend VM crashes (HTTP 500):
Traffic still routes to the failed VM. Users see 50% error rate. The VM is not removed from rotation.
The Correct Approach
The right way to configure load balancer in Azure Virtual Network:
az network lb probe create --lb-name my-lb --resource-group my-rg --name http-health --protocol Http --port 80 --path /health --interval 15 --threshold 2
az network lb rule update --lb-name my-lb --resource-group my-rg --name http-rule --probe-name http-health
Successful result:
Health probe configured.
When a backend VM returns HTTP 503:
Probe fails twice (30s).
VM is removed from backend pool.
Traffic goes only to healthy VMs. Load balancer probes run every 15s.
How to Prevent This
Always configure health probes for load balancers. Probe types: HTTP/HTTPS (best), TCP (good), Guest Agent (legacy). Use a dedicated /health endpoint that checks app dependencies. Set appropriate intervals and thresholds. Monitor probe status with az network lb probe list.
FAQ
Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro. Secure your cloud with DodaTech.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro