Overview
An Azure Load Balancer typically includes:- One or more frontend IP configurations (public or private addresses clients connect to).
- A backend pool of virtual machines or instances that receive traffic.
- Health probes that verify backend instance health.
- Rules that map frontend traffic to backend pool instances and control inbound/outbound behavior.
- Load-balancing rules — distribute incoming client traffic to backends.
- Inbound NAT rules — forward specific frontend ports to a particular VM/port.
- Outbound rules — control SNAT/egress behavior for backend instances.
Quick comparison
Load-balancing rules
Load-balancing rules (LB rules) are the primary mechanism for distributing incoming traffic across the backend pool. Key behavior:- An LB rule maps a frontend IP and frontend port to a backend port and backend pool.
- The rule references a health probe so only healthy instances receive traffic.
- It controls protocol (TCP/UDP), session persistence (affinity), and idle timeout settings.
- When clients connect to the frontend IP and port, the load balancer distributes those connections across healthy backend instances according to the configured distribution algorithm.
- Clients connect to the frontend IP on port
80. - The LB rule forwards requests to backend pool instances on port
80. - Health probes (HTTP/TCP) verify backend health; only healthy servers receive traffic.
Inbound NAT rules
Inbound NAT (Network Address Translation) rules forward traffic arriving at the load balancer to a specific port on a specific VM in the backend pool. These are commonly used to provide administrative access to individual VMs behind the load balancer. Mapping example:- Connecting to the load balancer’s frontend IP at
30008forwards the connection to port3389on VM1. - Common administrative uses: RDP (3389) or SSH (22) multiplexed across a single public IP with different frontend ports.
- Inbound NAT rules target a specific VM NIC and port and do not load-balance across multiple VMs.
- To forward ports to many VMs, create multiple NAT rules, each mapping a different frontend port to a different backend VM/port.
Outbound rules
Outbound rules control how traffic initiated from backend pool instances reaches external destinations (for example, the internet). They define SNAT behavior and can provide consistent outbound IP addresses. Key points:- Use outbound rules when VMs/instances need to initiate connections to external endpoints.
- Outbound rules allocate ephemeral (SNAT) ports and can be associated with a specific frontend IP configuration (public IP or public IP prefix) to provide predictable outbound IPs.
- Behavior differs by SKU: the Basic Load Balancer provides platform-managed outbound connectivity for VMs without public IPs by default; the Standard Load Balancer does not. For predictable outbound behavior on Standard, configure an outbound rule, attach a public IP to the VM, or use a managed NAT gateway.
- Ensuring a known public IP for outbound calls to external services.
- Controlling the number of ephemeral ports to avoid port exhaustion under high concurrency.
Important: With the Standard SKU, Azure does not provide default outbound connectivity for backend VMs that lack a public IP. Configure an outbound rule, assign a public IP to the VM, or use a NAT gateway for predictable outbound behavior and to avoid connectivity surprises.
Session persistence (session affinity) is configured on load-balancing rules. Options include
None, Client IP, and Client IP and protocol. Choosing a persistence type determines whether successive requests from the same client are sent to the same backend instance—important for stateful applications or sticky sessions.Putting it all together
- Load-balancing rules distribute client traffic across backend instances and use health probes to ensure only healthy instances receive traffic.
- Inbound NAT rules provide direct, port-mapped access to individual VMs for administration or special endpoints.
- Outbound rules govern how backend instances initiate traffic to external networks and provide predictable SNAT behavior.
- Which services need balanced frontend access vs. direct VM access.
- Session persistence requirements for application state.
- Outbound IP predictability and ephemeral port capacity to prevent port exhaustion.
- The Load Balancer SKU you choose (Basic vs. Standard) and its implications for default outbound connectivity.