Open In App

How to Set Up Azure Traffic Manager: A Step-by-Step Guide

Last Updated : 22 Aug, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Azure Traffic Manager (ATM) is a powerful Azure service to manage user traffic and distributes it to service endpoints using various routing methods. In this article, I will be guiding you with the process of creating a web app till setting up an Azure Traffic Manager.

Primary Terminologies

  • Azure: Azure is a cloud computing platform developed by Microsoft that provides a range of tools and services to help developers build, deploy, and manage applications.
  • Azure Endpoint: An Azure service that is exposed to the internet and is responsible for receiving user traffic.
  • DNS: It translates readable domain names to IP addresses that a computer can understand.
  • Azure Web App: It allows us to build and deploy web apps efficiently.

Prerequisites and Initial Setup

  1. Login to your Azure portal
  2. GitHub repository with your web app code
  3. DNS Zone Creation ( eg- GoDaddy)

Steps to Create and Deploy Scalable Applications on Azure

Step 1: Login into your Azure account

Step 2: Click on Create a resource

Create resource

Step 3: Click on Web App and fill the details

  • Resource Group: (Give any name related to the web app)
  • Name: (Give any unique name to the web app , this will be a part of the URL)
  • Publish: Code
  • Runtime Stack: ASP.NET V4.8
  • Sku and size: Free F1 ( you can choose a paid plan too)

Step 4: Click on Review + Create and then click on create again.

Deployment complete

Step 5: Click on Go to Resource and then Click on the Azure Cloud Shell logo.

Azure cloud shell

Step 6: Write the Bash Code

git clone <github repository url>git config --global user.email "<your email> "
git config --global user.name "<your name>"
cd <path to the code file>

Step 7: Git Deployment

git init
git add .
git commit -m "<commit message>"

Step 8: Configure App Service

 az webapp deployment source config-local-git --name <name of web app> --resource-group <resource group name>

Step 9: Deploy Web App

After running the above command you'll be getting a Json output in which there will be a predefined URL "scmURi:" you have to copy that URL and we will add this as a remote into our local github repository.

git remote add azure '<paste the url here> '
git push azure master

Your code will be deployed and you just have to refresh your web page.

Azure Traffic Manager Routing Methods

  1. Priority Routing- It has a priority list of service endpoints where the primary service endpoint has the highest priority.
  2. Weighted Routing - It is used to distribute traffic evenly across a set of endpoints.
  3. Performance Routing- It is used when we want to improve the response time of applications by routing traffic to the location nearest to the user,
  4. Geographics Routing- In this the endpoint associated with a traffic manager profile must have a pre defined geographic region assigned to it.
  5. Multivalue Routing- It returns multiple endpoint for a single query, it can only be set to IPv4/IPv6 addresses as endpoints.
  6. Subnet Routing- It maps a set of users IP address to a specific endpoint.

Step-by-Step Process to Setup Azure Traffic Manager

Creating a Azure Traffic Manager Profile

Step 1: Login into your Azure portal.

Step 2: Search "Traffic Manager Profile" in the search bar and Click on it.

Traffic Manager profile

Step 3: Click on "Create traffic manager profile"

  • Name- <Write a unique name>
  • Routing method- Priority
  • Subscription- Free Trial
  • Resource group- Click on Create New and write "My RG"
  • Resource group location- Central US
  • Click on Create (at bottom left corner)
Create traffic

Deploying DNS

Step 1: Search "DNS Zones" in the search bar and Click on it.

Step 2: Click on Create DNS

  • Subscription- Free Trial
  • Resource group- MyRG (you had created this above)
  • Name - <Write any name>.com example-gfgexample.com
  • Resource group location- Central US
  • Click on "Review+Create"

Register a DNS

Step 1: Go to GoDaddy or a similar website.

Step 2: Click on your Profile Name> Manage Domains

Step 3: Click on DNS > Manage Zones

Step 4: Search for the Domain Name you wrote while Deploying DNS example- gfgexample.com

Step 5: Scroll down to find Nameservers and Click on Changes

Step 6: Open Azure Portal > Overview

Step 7: Copy Name Server 1 and paste it in GoDaddy NameServers (Step5) similarly for Name server 2

  • Make sure you remove the dot in the end while pasting a name server
DNS Management

Step 8: Click on Save and with that we have created two Virtual Machines (Endpoint).

Configuring Traffic Routing Methods

Step 1: Search "Virtual Machine" in the search bar and Click on it.

Step 2: Click on VM1 and then Click on Networking.

Step 3: Click NIC Public IP address.

VM networking

Step 4: Click on Configure.

Step 5: Write a Unique name in DNS name label and Click on Save.

Step 6: Follow the same steps to configure the other Virtual Machines on public IP address.

Adding Endpoints to Your Traffic Manager Profile

Step 1: Search "Traffic Manager Profile" in the search bar and Click on it.

Step 2: Click on the Traffic Manager Profile you created above.

Step 3: Click on Endpoint and Click on Add.

  • Type: Azure endpoint
  • Name: VM1
  • Target resource type: Public IP address
  • Public IP address: (Select VM1 from dropbox)
  • Priority: 1
Add Endpoint

Step 4: Click on Save and Follow the same steps to add the second endpoint.

  • Type: Azure endpoint
  • Name: VM2
  • Target resource type: Public IP address
  • Public IP address: (Select VM2 from dropbox)
  • Priority: 2

Creating a DNS Record

Step 1: Search "Traffic Manager Profile" in the search bar and Click on it.

Step 2: Click on the Traffic Manager Profile you created above.

Step 3: Click on Overview and Copy the DNS name.

Step 4: Search for "DNS Zone" in the search bar.

Step 5: Click on the DNS Zone you've created and Click on Record set.

atm7

Step 6: Fill in the Details in Record Set.

  • Name: www
  • Type: CNAME
  • Alias Record set: No
  • TTL: 1
  • TTL unit: Hours
  • Alias: <Paste Copied DNS Name> (Remove "https://" if shows an error message)

Step 7: Click on OK and the whole process is complete and ready to work.


Next Article
Article Tags :

Similar Reads