Azure – Networking – Part 19 – Azure Traffic Manager 2 -Create Traffic Manager Profile using (Cloud Shell) PowerShell

Hello Everybody,

In our last article, we have discussed about the basics of Azure Traffic Manager. Today in this article we will continue our journey with Azure Traffic Manager and create Traffic Manager Profile using PowerShell.

Tool Installation Articles :

  1. Configure Azure Command Line Interface ( Azure CLI) On Windows
  2. Configure PowerShell For Microsoft Azure Az Module On Windows

Previous Azure Series :

  1. Learn Basics Of Azure Networking In 100 Hours
  2. Learn Basics Of Microsoft Azure Storage services
  3. Learn Basic Of Azure Active Directory And Azure Identity And Access Management
  4. Azure DevOps – Learn at one place
  5. Learn Basics Of Lift-And-Shift Migration To Azure

If you have missed our previous articles on azure networking, please check it in following links.

Part 1 – Basics of Azure Networking

  • *
  • *
  • *

Part 12 – Azure VPN Network Gateway

Part 13 – Configure Azure Point-to-Site VPN

Part 14 – Configure Azure VNet-to-VNet Connection

Part 15 – Configure Azure Site-to-Site VPN Connection

Part 16 – Azure Virtual Network (VNet) peering

Part 17 – VNet Peering 2 – Hub-spoke VNet topology

Part 18 – Azure Traffic Manager 1

Next Article : Azure – Networking – Part 20 – Azure Route Table

Use Case Of Azure Traffic Manager :

Without taking much of your time, I am starting with create a new Azure Traffic Manager Profile using PowerShell. Initially my plan was to take a little complex use case for our hands-on but due to some technical issue, I am not able to connect to any of my VM. So in last moment decided, to take a very simple use case for our hands-on. Here we will configure two App service as endpoints for Traffic Manager and one will be the Primary and the other one as secondary/failover end-point. We will see how Traffic Manager redirect traffics to the failover/secondary end-point if the primary end-point is not available.

How To Use PowerShell In Azure :

Azure hosts, Azure Cloud Shell, an interactive shell environment that we can use through our browser. We can use either Bash or PowerShell with Cloud Shell to work with Azure services. In this case we don’t have to install PowerShell module locally.

If we want to install and use PowerShell locally, we need to install Azure PowerShell module on our machine. For guidance see Install Azure PowerShell module. I am going to use browser based cloud shell. There are following two ways to open the command prompt in browser

1. Select the Cloud Shell button on the top-right menu bar in the Azure portal.

Figure 1 : Azure-Cloud Shell from portal

2. Lunch Cloud Shell from browser by opening http://shell.azure.com as shown in the following figure.

Figure 2 : Azure- lunch Cloud Shell from browser

Configure Traffic Manager Profile :

So far so good. If we are ready with our command prompt, let’s start with our hands-on 🙂 and follow the steps.

Step 1 : Create new Traffic Manager Profile

As shown in the following figure create a new Traffic Manager Profile.

Figure 3 : Azure Networking – Create Traffic manager profile

Step 2 : Create two new App Service Plan for both end point

In next step, lets create two Azure App Service Plan using New-AzAppServicePlan in different location as shown in the following figure. This command creates two App Service plan name started from “Manas_AppServicePlan” in the resource group named “KJ_TrafficManagerRG” in Geo location West Europe and East US

Figure 4 : Azure Networking – Create App service plan

Step 3 : Create two new Web App in New App Service Plans

After creating the App service plan , let’s create two App Service under both App service plan using New-AzWebApp, as shown in the following figures. later we will configure those web app as end points of the traffic manager profile. After creating two web app, using KUDO tool , I have modified it’s default landing page, so that we can understand, which web app is responding our requests.

Figure 5 : Azure Networking – Created two new Web app in both App service plan
Figure 6 : Azure Networking – Created two new Web app service
Figure 6 : Azure Networking – Details of a web app

Step 4 : Configure Traffic Manager Profile Endpoints

Add the two App services as Traffic Manager endpoints using New-AzTrafficManagerEndpoint to the Traffic Manager profile as shown in the following figures.

Figure 7 : Azure Networking – Configure Primary End Point
Figure 8 : Azure Networking – Configure failover End Point
Figure 9: Azure Networking – Traffic Manager configured with two End points

Testing Azure Traffic Manager :

We have done with all of our configuration and now time comes for testing.

Step 1 : Collect Traffic Manager Full DNS Name

Using Get-AzTrafficManagerProfile we can get RelativeDnsName value as shown in the below figure.

Figure 10: Azure Networking – Traffic Manager relative DNS Name

Once we got RelativeDnsName value, let’s construct the full DNS name by post-fixing ” .trafficmanager.net ” to it. In our case the RelativeDnsName is “kj-trafficmanagerprofile” and the full DNS name would be http://kj-trafficmanagerprofile.trafficmanager.net. We can also get the DNS full name from portal in overview section as shown in the following figure.

Figure 11: Azure Networking – Traffic Manager full DNS Name

Step 2 : Browse full DNS name in browser

In a web browser, let’s browse our DNS name, in our case the URL will be http://kj-trafficmanagerprofile.trafficmanager.net and we received the result as shown in the following figure.

we can see all the traffics redirected to “MAnas_App1-WestEurope ” End Point by traffic manager because the priority of this end point set to 1, as shown in the following figure.

Figure 12: Azure Networking – Traffic Manager End Point Priority

Step 3: Disable Primary End Point

We have seen that, traffic manager is redirecting all traffics based on the priority of the end-point. As per the priority, in this scenario it redirecting all traffic to “MAnas_App1-WestEurope “. To test, if the failover end-point working or not, let’s disable “MAnas_App1-WestEurope ” end-point as shown in the following figure and see what is happening when we browse traffic manager DNS name ( http://kj-trafficmanagerprofile.trafficmanager.net/ ).

Figure 13: Azure Networking – Traffic Manager End Point Disabling
Figure 14: Azure Networking – Traffic Manager End Point Disabled

After disabling the primary end-point, let’s browse traffic manager DNS name ( http://kj-trafficmanagerprofile.trafficmanager.net/ ). Now we can see the traffic is still served and the web app is still available. This time traffic manager redirect all traffics to failover/secondary end-point (Manas-App2-EastUS) as we can see in the following figure.

Figure 14: Azure Networking – Traffic Manager redirect to failover End-Point

Release Resources :

After we have done with our hands-on, let’s clean up resources using using Remove-AzResourceGroup.

Hope this article helps you with your hands on. we can download the complete script here. In next article I will come up with a new Azure networking concept so thanks for reading 🙂 and my next article is Azure – Networking – Part 20 – Azure Route Table.

Keep reading, share your thoughts, experiences. Feel free to contact us to discuss more.

If you have any suggestion / feedback / doubt, you are most welcome. Stay tuned on Knowledge-Junction, will come up with more such articles.

Thanks for reading  🙂 .

Manas Ranjan Moharana

I'm a proud Indian, Son, Husband, Father, Author, Blogger, Self motivated person. I lives in Pune, Maharashtra and working for TietoEvry.pvt.ltd, to build Azure Solutions and Share Point Solutions.Microsoft certified Professional with 14 years of IT experience. Interest in learning and sharing something new, to be healthy.

You may also like...

6 Responses

  1. kanjuspua says:

    good

  2. Anil says:

    Awesome Articles, thanks lot sir

  1. July 2, 2020

    […] a very important azure networking concept Azure Route Table .In our last article we have covered Azure Traffic Manager. In this article we have tried to summarized the basics of Azure Route Table. Most of the […]

  2. December 2, 2021

    […] Part 19 – Azure Traffic Manager 2 -Create Traffic Manager Profile using (Cloud Shell) […]

  3. December 4, 2021

    […] Part 19 – Azure Traffic Manager 2 -Create Traffic Manager Profile using (Cloud Shell) […]

  4. December 8, 2021

    […] Part 19 – Azure Traffic Manager 2 -Create Traffic Manager Profile using (Cloud Shell) […]

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: