How to Create a Traffic Manager profile in Azure

In this article, I will describe how to create a Traffic Manager profile that delivers high availability for our web application.
In these steps, we will read about two instances of a web application. Both Instances are running in a different Azure region. We will create a Traffic Manager profile based on endpoint priority. The profile instructs user traffic to the primary site running the web application. Traffic Manager continuously monitors the web application. If the primary site is unavailable, it provides automatic failover to the (secondary site) backup site.

Sign in to the Azure Portal

Prerequisites

We need two instances of a web application deployed in two different Azure regions (1st in East US and 2nd in West Europe). Each one will serve as primary & failover endpoints for Traffic Manager.

Create a 1st Web App

1- In the Azure Portal screen, select + Create a resource.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

2- Select Web under developer tools.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

3- Click on Web App.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

4- Create a Web App wizard, Basics tab.

Select your Subscription
Resource Group, select Create new
Enter a name (myrg-tm) and then click ok.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

5- Instance Details

Name – Type webappeastus.
Publish – Select Code.
Runtime stack – Select ASP.NET V4.7
Operating System – Select Windows.
Region – Select East US

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

6- App Service Plan – Windows Plan (East US)
Select Create new
Type a name (AppServicePlanEastUS) and then click OK.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

7- SKU and size – Select Standard S1.
Select Next : Monitoring >

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

8- Monitoring Tab
Application Insights
Enable Application Insights select No and then select Review + create

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

9- Review the settings, and then click on Create.
It will create a default web site when the Web App successfully deploys.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

Create a 2nd Web App

SettingsValue
Resource Groupmyrg-tm2
Web App Namewebappweurope
Publishcode
Runtime StackASP.NET v4.7
Operating systemwindows
RegionWest europe
App service planCreate new
NameAppServicePlanWEurope
SKU and sizeStandard S1
Next : Monitoring > 
Enable Application insightsNo
Review + create 
Create 

Now you can see two Web App successfully created.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

Create a Traffic Manager profile

A Traffic Manager Profile that instructs user traffic based on endpoint priority.

1- Type traffic manager profile in Azure search bar then elect Traffic Manager Profiles.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

2- Select the + Add button.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

3- Create Traffic Manager Profiles wizard

Type a name – myTManager
Routing Method – select Priority
Resource group – select myrg-tm and then click create.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

4- Traffic Manager profile successfully created.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

How to Add Traffic Manager Endpoints

Add the website in the target resource (East US) as Primary Endpoint to route all the user traffic. Add the website in target resource “West Europe” as a Failover Endpoint. When the primary endpoint is unavailable, then the traffic automatically routes to the failover endpoint.

1- Select the Traffic Manager profile name that you created in the preceding section.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

In the Traffic Manager profile

2- Select Endpoints under Settings section and then click on + Add.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

3- Type > Select Azure endpoint
Name > Type PrimaryEndpoint
Target resource type > Select App Service
Target resource > select webappeatus (East US)
Priority > Select 1
Select OK.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

Create a failover endpoint for your 2nd Azure region.

1- Click on + Add button again.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

2- Type > Select Azure endpoint
Name > Type FailoverEndpoint
Target resource type > Select App Service
Target resource > select webappweurope (West Europe)
Priority > Select 2
Select OK.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

3- When you are done adding the both endpoints, they are displayed in Traffic Manager profile. Notice that their monitoring status is Online now.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

Test Traffic Manager Profile

In this section, we will check the domain name of our Traffic Manager profile. You will also configure the primary endpoint to be unavailable. Finally, we get to see that the web app is still available. It is because Traffic Manager sends the traffic to the failover endpoint.

Check the DNS name

1- Go to your Traffic Manager profile name that you created in the preceding section.
Select the traffic manager profile and then overview.
In the Traffic Manager profile, you can see the DNS name of your newly created Traffic Manager profile.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

View Traffic Manager in action

2- In the web browser, paste the DNS name of your Traffic Manager profile to view your Web App’s default website.

Note
In this scenario, all requests route to the primary endpoint. Because we set it to Priority 1.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

3- Disable your primary site, to test Traffic Manager Failover:
In the Traffic Manager Profile page, select Endpoint under settings and then select PrimaryEndpoint.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

4- In PrimaryEndpoint, select Disabled and then click on Save.
Close PrimaryEndpoint window.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

5- Notice that the status is Disabled now.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

6- Copy the DNS name of the Traffic Manager Profile from the preceding step to view the website in a new web browser session.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure

7- Verify that the web app is still available.
The primary endpoint is not available, so you were routed to the failover endpoint.

Create a Traffic Manager profile, How to Create a Traffic Manager profile in Azure
Jamil Parvez
Jamil Parvezhttps://www.xpertstec.com
Jamil Pervez works as a Network Administrator, based in Kuwait with a Primary focus on Microsoft technologies. Microsoft Certified MCSE, MCTP, MCITP, CCNP, CCIP, CCVP with 20 years of experience in administering Windows Servers, Exchange, VMWare, Veeam B&R, Veritas BackupExec.

Related Articles

Latest Articles