Tutorial: Create a cross-region Azure Load Balancer

A cross-region load balancer ensures a service is available globally across multiple Azure regions. If one region fails, the traffic is routed to the next closest healthy regional load balancer.

In this tutorial, you learn how to:

  • Create cross-region load balancer.
  • Create a backend pool containing two regional load balancers.
  • Create a load balancer rule.
  • Test the load balancer.

You can use the Azure portal, Azure CLI, or Azure PowerShell to complete this tutorial.

Prerequisites

Create cross-region load balancer

In this section, you create a cross-region load balancer with a public IP address, a frontend IP configuration, a backend pool with region load balancers added, and a load balancer rule.

Important

To complete these steps, ensure that two regional load balancers with backend pools have been deployed in your subscription. For more information, see, Quickstart: Create a public load balancer to load balance VMs using the Azure portal.

Create the load balancer resource and other resources

  1. Sign in to the Azure portal.

  2. In the search box at the top of the portal, enter Load balancer. Select Load balancer in the search results.

  3. In the Load balancer page, select Create.

  4. In the Basics tab of the Create load balancer page, enter, or select the following information:

    Setting Value
    Project details
    Subscription Select your subscription.
    Resource group Select Create new and enter CreateCRLBTutorial-rg in the text box.
    Instance details
    Name Enter myLoadBalancer-cr
    Region Select (US) East US.
    Type Select Public.
    SKU Leave the default of Standard.
    Tier Select Global

    Create a cross-region load balancer

  5. Select Next: Frontend IP configuration at the bottom of the page.

  6. In Frontend IP configuration, select + Add a frontend IP.

  7. Enter LoadBalancerFrontend in Name in Add frontend IP address.

  8. Select IPv4 or IPv6 for IP version.

  9. In Public IP address, select Create new. Enter myPublicIP-cr in Name. Select Save for the Add Public IP Address Dialog.

  10. Select Save.

  11. Select Next: Backend pools at the bottom of the page.

  12. In Backend pools, select + Add a backend pool.

  13. Enter myBackendPool-cr in Name in Add backend pool.

  14. In Load balancers, select myLoadBalancer-r1 or your first regional load balancer in the Load balancer pull-down box. Verify the Frontend IP configuration and IP address correspond with myLoadBalancer-r1.

  15. Select myLoadBalancer-r2 or your second regional load balancer in the Load balancer pull-down box. Verify the Frontend IP configuration and IP address correspond with myLoadBalancer-r2.

  16. Select Add.

  17. Select Next: Inbound rules at the bottom of the page.

  18. In Inbound rules, select + Add a load balancing rule.

  19. In Add load balancing rule, enter or select the following information:

    Setting Value
    Name Enter myHTTPRule-cr.
    IP Version Select IPv4 or IPv6 for IP Version.
    Frontend IP address Select LoadBalancerFrontend.
    Protocol Select TCP.
    Port Enter 80.
    Backend pool Select myBackendPool-cr.
    Session persistence Select None.
    Idle timeout (minutes) Enter or move the slider to 15.
    TCP reset Select Enabled.
    Floating IP Leave the default of Disabled.
  20. Select Add.

  21. Select Review + create at the bottom of the page.

  22. Select Create in the Review + create tab.

    Note

    Cross region load-balancer deployment is listed to specific home Azure regions. For the current list, see Home regions in Azure for cross region load balancer.

Test the load balancer

In this section, you test the cross-region load balancer. You connect to the public IP address in a web browser. You stop the virtual machines in one of the regional load balancer backend pools and observe the failover.

  1. Find the public IP address for the load balancer on the Overview screen. Select All services in the left-hand menu, select All resources, and then select myPublicIP-cr.

  2. Copy the public IP address, and then paste it into the address bar of your browser. The default page of IIS Web server is displayed on the browser.

    Test load balancer

  3. Stop the virtual machines in the backend pool of one of the regional load balancers.

  4. Refresh the web browser and observe the failover of the connection to the other regional load balancer.

    Test load balancer after failover

Clean up resources

When no longer needed, delete the resource group, load balancer, and all related resources.

To do so, select the resource group CreateCRLBTutorial-rg that contains the resources and then select Delete.

Next steps

In this tutorial, you:

  • Created a cross-region load balancer.
  • Added regional load balancers to the backend pool of the cross-region load balancer.
  • Created a load-balancing rule.
  • Tested the load balancer.

For more information on cross-region load balancer, see: