Implement load balancing rules

3.1 Azure Load Balancer and Traffic Manager

📘Microsoft Azure Networking Solutions (AZ-700)


When working with Azure Load Balancer (ALB) or Traffic Manager, a load balancing rule is the key configuration that determines how incoming traffic is distributed across your backend servers or endpoints. Think of it as the “traffic instructions” that tell Azure where to send requests for your applications.


1. What is a Load Balancing Rule?

A load balancing rule is a set of configurations in Azure Load Balancer that defines:

  • Which traffic to accept (incoming ports/protocols)
  • Which backend resources to send it to (VMs, VM scale sets, or other endpoints)
  • How the traffic is distributed (distribution mode and health checking)

It connects the frontend (where clients connect) with the backend pool (your servers).


2. Components of a Load Balancing Rule

When creating a load balancing rule in Azure, you need to define several key components:

ComponentDescriptionExample in IT Environment
Frontend IP configurationIP address that clients use to reach your servicePublic IP for a web app or private IP for internal apps
Backend poolCollection of VMs or VM Scale Sets that will handle traffic3 web servers running IIS/Apache
ProtocolTCP, UDP, or AllTCP 443 for HTTPS, UDP 53 for DNS
PortPort number clients connect toTCP 443 for a secure website
Backend portPort on the backend VMTCP 443 (often same as frontend port)
Session persistence (optional)Whether to “stick” a client to the same backend VMUseful for apps storing user sessions locally
Idle timeout (optional)Maximum time a connection can stay idle4 minutes by default
Floating IP (Direct Server Return)Allows the same VIP to be used for backend reply trafficOften used for NAT scenarios

Exam Tip: Know the difference between frontend port and backend port, and what session persistence does.


3. How Load Balancing Rules Work

  1. A client sends traffic to the frontend IP/port.
  2. The load balancer checks the rule to see which backend pool should receive it.
  3. The traffic is forwarded to a healthy backend VM, based on the load distribution method.
  4. Health probes periodically check backend VM health; unhealthy VMs are skipped.

IT Example: You have 3 web servers serving a public website on port 443. You configure a load balancing rule to forward TCP 443 traffic from the public IP to port 443 on all backend VMs. If VM2 is unhealthy, only VM1 and VM3 receive traffic.


4. Distribution Modes

Azure Load Balancer supports two distribution modes:

  1. 5-tuple hashing (default):
    Uses source IP, source port, destination IP, destination port, and protocol to decide backend.
    • Ensures traffic from a single client can go to the same backend for session consistency.
  2. Source IP affinity:
    Sticks a client IP to a backend VM.
    • Useful for stateful apps that need session persistence.

Exam Tip: Be ready to identify when session persistence is required and how it is implemented.


5. Health Probes

A load balancing rule always relies on health probes to determine which backend VMs are healthy.

  • Probe type: TCP, HTTP, or HTTPS
  • Probe interval: Frequency of checks
  • Unhealthy threshold: Number of failures before marking a VM as unhealthy

IT Example: Your probe checks HTTP /health endpoint every 5 seconds. If the endpoint fails 2 times consecutively, that VM is temporarily removed from the pool.


6. Example of a Rule in an IT Scenario

Suppose you have:

  • Frontend IP: 52.170.12.34 (public)
  • Backend Pool: 3 VMs running a web app
  • Protocol: TCP
  • Frontend Port: 443
  • Backend Port: 443
  • Session Persistence: Client IP (sticky session)

Flow:

  1. Client connects to 52.170.12.34:443
  2. Load Balancer selects a backend VM based on the rule and session persistence
  3. Sends traffic to VM1, VM2, or VM3
  4. If VM2 fails health probe, only VM1 and VM3 serve new requests

This is exactly the kind of understanding you need for exam questions.


7. Differences Between Azure Load Balancer and Traffic Manager

  • Azure Load Balancer: Layer 4 (TCP/UDP) load balancing, works within a region or virtual network. Uses rules for traffic distribution to backend pools.
  • Azure Traffic Manager: DNS-based routing across regions. No direct load balancing; it directs clients to the closest or healthiest endpoint.

Exam Tip: Traffic Manager does not use load balancing rules; Load Balancer does. Know this distinction.


8. Exam Checklist for Load Balancing Rules

  • Understand frontend vs backend ports and IPs
  • Know how to configure protocols (TCP, UDP)
  • Be able to explain backend pools and health probes
  • Know session persistence options and when to use them
  • Understand floating IP (DSR) scenarios
  • Distinguish Azure Load Balancer vs Traffic Manager for routing and load balancing

✅ Summary for Students:

A load balancing rule tells Azure Load Balancer how to distribute traffic from clients to your backend servers. You configure frontend IPs, backend pools, protocols, ports, and health probes, and optionally session persistence. Health probes ensure traffic only goes to healthy servers. This is critical for building highly available applications and passing the AZ-700 exam.

Buy Me a Coffee