Create a public load balancer with a health probe and rule
In this task you'll create a public load balancer with a health probe and a rule.
A load balancer is built from four parts. The frontend is the address clients connect to. The backend pool is the set of servers that share the work. A health probe checks each server every few seconds. A load balancing rule joins them: traffic arriving on this frontend port goes to this port on the healthy servers in the pool.
Only the Standard type is offered now (Basic was retired in 2025). Standard is secure by default: nothing reaches the backend servers until an NSG allows it.
Example. SS Kaiser runs its shop on two web servers behind lb-shop. When one server is patched and stops answering on port 80, the probe notices within seconds and every visitor goes to the other.
Costs money. A Standard load balancer and its public IP each cost a little every hour they exist, even with no servers behind them. A test of under an hour costs a few pence. Delete them straight after.
Before you start
You need: Network Contributor on the resource group. Time: 20 minutes.
Where to look
- Load balancers
- + Create
Steps
- Search for load balancers and select + Create.
- On Basics, choose rg-portal-practice, name it lb-practice, pick your region, leave SKU on Standard, change Type to Public and leave Tier on Regional.Type starts on Internal, which has no internet address, so check it before moving on. Global tier spreads one address across regions; Regional is what you want almost every time.
- On Frontend IP configuration, select + Add a frontend IP configuration. Name it fe-practice, choose Create new for the public IP, name it pip-lb-practice, and save.
- On Backend pools, select + Add a backend pool. Name it be-practice, pick vnet-practice, and save it empty.You'd normally add VMs here. An empty pool is fine for seeing how the parts fit together.
- On Inbound rules, select + Add a load balancing rule. Name it rule-http, choose the frontend and backend pool, and set Port and Backend port to 80.Some forms label this tab Load balancing rules instead.
- For Health probe, select Create new: name it probe-http, protocol TCP, port 80. Save the rule.The probe checks port 80 on each server every few seconds.
- Select Review + create, then Create. Open the new load balancer and look at Frontend IP configuration, Backend pools, Health probes and Load balancing rules.With an empty pool, Insights and the metrics show no healthy servers, which is expected.
Commands
# Build the same load balancer in four commands
az network public-ip create --resource-group rg-portal-practice --name pip-lb-practice --sku Standard
az network lb create --resource-group rg-portal-practice --name lb-practice --sku Standard \
--public-ip-address pip-lb-practice --frontend-ip-name fe-practice --backend-pool-name be-practice
az network lb probe create --resource-group rg-portal-practice --lb-name lb-practice \
--name probe-http --protocol tcp --port 80
az network lb rule create --resource-group rg-portal-practice --lb-name lb-practice --name rule-http \
--protocol tcp --frontend-port 80 --backend-port 80 \
--frontend-ip-name fe-practice --backend-pool-name be-practice --probe-name probe-http
Watch out for
- Cost
- Charged per hour for the load balancer and the public IP, plus a small amount per GB of data. Both keep charging while they exist, so delete them as soon as you've finished.
- Security
- Standard load balancers block traffic by default. You must allow the port in an NSG on the backend servers, and allow Azure's probe (the AzureLoadBalancer service tag) so health checks can reach them.
- Common mistakes
- Forgetting the NSG, so the probe fails and every server shows unhealthy. Probing a port the app doesn't listen on. Deleting the load balancer but leaving its public IP, which still costs money.
Clean up
- Resource groups
- rg-portal-practice
- Delete resource group
Delete lb-practice, then pip-lb-practice (the public IP isn't removed with it). Or delete the resource group, which removes both.
Words to know
- Frontend IP
- The address clients connect to: a public IP, or a private one for an internal load balancer.
- Backend pool
- The servers (or network cards) that share the traffic.
- Load balancing rule
- Which frontend port goes to which backend port, checked by which probe.
- Inbound NAT rule
- Sends one frontend port to one particular server, for example to reach it for maintenance.
Tick off each step and track your progress in the guide.
Open this task in Azure Portal, Hands On