How to Create a Traffic Manager profile in Azure

traffic manager profile

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.

microsoft azure portal

2- Select Web under developer tools.

azure create a resource

3- Click on Web App.

azure create a resource web app

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.

azure create web app basic

5- Instance Details

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

azure web app instance details

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

azure app service plan

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

azure app service plan sku

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

azure create web app monitoring

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

azure create web app review

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.

azure app service directory

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.

microsoft azure search bar

2- Select the + Add button.

azure traffic manager profile

3- Create Traffic Manager Profiles wizard

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

create traffic manager profile

4- Traffic Manager profile successfully created.

azure traffic manager profile directory

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.

azure traffic manager profile

In the Traffic Manager profile

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

azure traffic manager profile endpoint

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.

azure traffic manager add endpoint

Create a failover endpoint for your 2nd Azure region.

1- Click on + Add button again.

azure traffic manager profile endpoint

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.

azure traffic manager add endpoint

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

azure traffic manager profile endpoint

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.

azure traffic manager profile overview

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.

internet explorer azure app service

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

azure traffic manager profile endpoint

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

azure traffic manager endpoint

5- Notice that the status is Disabled now.

azure traffic manager endpoint

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

azure traffic manager profile overview

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

internet explorer azure app service

Comments

Leave a Reply