Wednesday, 18 March 2015

Configuring Azure Traffic Manager to Load Balance Azure Websites

An Azure Traffic Manager is a Network Service that can be used to distribute incoming traffic between two "endpoints" within the Azure cloud. This is done to increase performance, improve availability or load balance Azure Websites. It can also be used by Azure VM's....
In the context of Azure Websites (or endpoints) the website instances should be provisioned in two separate regions or locations. If you are trying to load balance between two Azure websites running in the same region you will be stopped when you add the endpoints to the Traffic Manager.

Azure Website instances are only supported if they are on the Standard Web Hosting Plan Mode. This can be done using the Scale tab from the Website pane in the Management Portal.

The first step is to create a Traffic Manager, click on the New button. Then click Network Services, then Traffic Manager, then Quick Create. From here you must give your Traffic Manager a globally unique name and choose a Load Balancing Method. I have chosen Round Robin in this example, the other options are Performance and Failover. Click Create.

Scroll down from the list of Azure services and click on Traffic Manager, you will be presented by the following screen that lets you add endpoints to the Traffic Manager. Click Add Endpoints.

Choose Website from the Service Type, and tick the option to enable the Service Endpoints for the Azure Website instances. You will notice the warning that states you cannot have two website endpoints from the same region configured within the same Traffic Manager. 

By default a Traffic Manager is created with your unique name with the FQDN of trafficmanager.net so for example mine in this example is rbetts-lm.trafficmanager.net.
To have your clients connect to a DNS name from your own domain you can recreate a CNAME record to point to the Traffic Manager, for example;
CNAME weblb > rbetts-lm.trafficmanager.net.