Implementing Traffic Manager Profile In Azure

Introduction

Microsoft Azure uses a DNS-based load balancer called Traffic Manager to control how users are routed to their services' endpoints across multiple data centers. This tool can protect your services from subpar availability and response times in Azure's global regions.

In this article, we will learn how to create a Traffic Manager profile that provides high availability for our web application.

We have already created two instances of a web application. Both instances are located in different regions.

  • WebApp1- technetCentralUS - Primary Site
  • WebApp2- technetWestEurope - Backup / Failover Site

Based on endpoint priority, we will create a Traffic Manager profile. The profile directs user traffic to the main site (Primary site) that hosts the web application. The web application is constantly monitored by Traffic Manager. If the primary site is unavailable, it automatically switches to the backup site (secondary site).

Step 1

On the Azure Portal, Click + Create, and in the search bar, type Traffic Manager Profile. Then, select Traffic Manager Profile, and click Create.

Step 2

Enter the name for Traffic Manager, select the routing method as Priority, and then click Create.

Routing Methods

Priority routing: Our primary endpoints prioritize traffic, and the secondary endpoints will route traffic in case of failover.

Step 3

Select Endpoints under Settings, and then click + Add.

Step 4

Enter the name for the endpoint as "Primary Site" in the Target resource group. Select App Service, Target resource, then select our primary site (technetCentralUS) and set the priority as 1. Then, click Add.

Step 5

Enter the name for the endpoint as "Failover Site" in the Target resource group, select App Service, Target resource Then, select our Secondary site (technetWestEurope), set the priority as 2, and then click Add.

Step 6

In the Traffic Manager profile, copy the DNS name.

Step 7

When we paste the DNS name into the web browser, we will see our Primary site is working.

Step 8

Let's check how our Failover is working. Select the Endpoints under the settings, and then select Primary Site.

Step 9

Switch to the Disabled Status and click Save.

The Primary Site is Disabled.

Step 10

When we refresh the web browser, the Secondary site (Failover site) will be automatically activated, and we will see that the secondary site is online. The primary endpoint was unavailable, but the traffic was routed to the failover endpoint to allow the website to remain live.

Summary

In this article, we learned about deploying and managing Azure Traffic Manager. If you have any questions, feel free to comment under my article.


IFS R&D International (Private) Limited
IFS is a global enterprise software vendor providing solutions that help companies get better return