This guide will walk you through the process of creating and configuring an Azure Load Balancer using the Azure Portal. Load balancers distribute network traffic across a group of backend resources, enhancing availability and performance.
Prerequisites
An active Azure subscription.
Familiarity with Azure Virtual Machines and Virtual Networks.
In the portal's search bar at the top, type "Load balancers" and select Load balancers from the services list.
Step 2: Create a New Load Balancer
On the "Load balancers" page, click on + Create.
You'll be taken to the "Create load balancer" page. Fill in the following details:
Subscription: Select your Azure subscription.
Resource group: Choose an existing resource group or click Create new to create a new one.
Name: Provide a unique name for your load balancer (e.g., my-azure-lb).
Region: Select the Azure region where you want to deploy your load balancer.
SKU: Choose between Standard (recommended for production) or Basic.
Type: Select Public for internet-facing traffic or Internal for traffic within your virtual network. For this quickstart, we'll assume a Public load balancer.
Click Next: Frontend IP configuration >.
Step 3: Configure Frontend IP Address
In the "Frontend IP configuration" tab:
Click + Add a frontend IP configuration.
Name: Give your frontend IP a name (e.g., my-frontend-ip).
IP version: Choose IPv4 or IPv6.
IP assignment: Select Dynamic or Static. For a public load balancer, a static IP is often preferred for predictability.
Public IP address: Click Create new to create a new public IP address or select an existing one if available.
If creating a new one, provide a Name for the public IP (e.g., my-public-ip), choose its SKU (matching your load balancer SKU), and click OK.
Click Add to save the frontend IP configuration.
Click Next: Backend pools >.
Step 4: Configure Backend Pool
In the "Backend pools" tab:
Click + Add a backend pool.
Name: Provide a name for your backend pool (e.g., my-backend-pool).
Virtual network: Select the virtual network where your backend virtual machines reside.
Backend Pool Configuration: Choose how you want to associate resources. For this quickstart, we'll use NIC.
Virtual machines: Click + Add to select the virtual machines you want to include in this pool.
Select your desired virtual machines and click Add.
Click Add to save the backend pool.
Click Next: Health probes >.
Step 5: Configure Health Probe
In the "Health probes" tab, a health probe checks the health of your backend instances. If an instance fails the probe, it's removed from load balancer rotation.
Click + Add a health probe.
Name: Give your probe a name (e.g., my-health-probe).
Protocol: Choose the protocol (e.g., TCP, HTTP, HTTPS).
Port: Specify the port to probe (e.g., 80 for HTTP).
Interval: The time in seconds between probe attempts.
Unhealthy threshold: The number of consecutive probe failures before an instance is considered unhealthy.
Click Add.
Click Next: Load balancing rules >.
Step 6: Configure Load Balancing Rule
In the "Load balancing rules" tab, you define how traffic is directed to the backend pool.
Click + Add a load balancing rule.
Name: Give your rule a name (e.g., my-lb-rule).
IP version: Match your frontend IP version.
Protocol: Choose the protocol for incoming traffic (e.g., TCP).
Port: The port clients will connect to (e.g., 80).
Backend port: The port on which your backend services are listening (often the same as the frontend port, e.g., 80).
Backend pool: Select the backend pool you created.
Health probe: Select the health probe you created.
Session persistence: Choose how to handle client sessions (e.g., None, Client IP affinity, Client IP and port affinity).
Timeout: The idle timeout for TCP connections.
Floating IP (direct server return): Enable if required by your scenario.
Click Add.
Click Next: Inbound NAT rules > (Optional).
Click Next: Outbound rules > (Optional).
Click Review + create.
Step 7: Review and Create
Review all the configurations you've made. If everything looks correct, click Create.
Azure will now deploy your load balancer. This process may take a few minutes.
Congratulations! You have successfully created an Azure Load Balancer. Your backend virtual machines are now accessible through the public IP address of your frontend configuration, with traffic distributed and health checked automatically.
Next Steps
Test your load balancer by accessing its public IP address.
Explore advanced features like Network Security Groups (NSGs) for traffic control.
Consider creating an Internal Load Balancer for traffic within your VNet.