Configuring Azure Traffic Manager

Azure Traffic Manager refers to a network service which can be used to route users to website deployments or endpoints in possibly varying datacenters across the world. You can enhance accessibility, user-friendliness and load balance traffic through these services and settings. The Azure traffic manager is operated by a policy engine to DNS queries for the domain titles of your website. To empower the various features of Azure Traffic Manager, you may want to have more than two deployments of your website. These deployments can either be in the same location or across multiple locations around the world.

The implementation of an application will significantly determine how Azure Traffic Manager can be used for the particular application. If you intend to deploy the website to multiple locations, you need to consider whether the application is designed for multiple deployments. Also, you need to make sure whether the information is managed and available on the website, whether an application state is a factor and other crucial application design aspects which must be reviewed. Traffic Manager is one of the most important services in the Azure platform which should be reviewed by the application owners before they configure Traffic Manager for the application.

Following are the steps to configure Azure Traffic Manager:

  1. Create an Azure Traffic Manager profile.

    The foremost step is to choose a unique DNS title for your profile. Every Azure Traffic Manager profile shares a common domain *.trafficmanager.net. For that reason, you must choose a matchless DNS title as it will create an Azure Traffic Manager domain title that you will be using while updating your DNS records. As an example, a DNS name for Contoso might be contoso-web-tm.trafficmanager.net.

    Related to the DNS name setting is the DNS time-to-live (TTL), which tells DNS clients and resolvers on DNS servers how long to cache the name resolved by Azure Traffic Manager. The default value for this setting is five minutes.

    It’s important to choose a load balancing technique. Some of the load balancing options are listed below::

    • Performance: You can opt for this option when your website is deployed in several regions and you may want users to be directed to the nearest data center from where you have deployed to.
    • Round Robin: You can preferably choose this option when your website is deployed in the similar or various regions from where you want to share the load across a number of deployments.
    • Failover: This option is recommended when your website is deployed in the same or various regions and you want only one primary deployment for all traffic and the others to be accessible as a backup in case the primary deployment is unavailable. For more than two deployments, you can categorize the order of the deployments that you want Traffic Manager to failover with.

    If you want to determine the performance of your website deployments, you will need to adjust some basic monitoring settings so the Azure Traffic Manager can request your endpoints. It will find out whether an endpoint should be taken out of the rotation. The monitoring settings comprise the following:

    • Protocol: This can be either HTTP or HTTPS.
    • Port: You are required to use standard HTTP and HTTPS ports such as 80 and 443.
    • Relative Path And File Name: This is the particular path and file name in the application from where the monitoring service performs an HTTP recieve request. This is the root of the application such as “/”. You may call it a particular health check page which will be accessible as /Healthcheck.aspx.

    There are certain websites offering a health check page as a component of the application such as Healthcheck.aspx. The benefits of the health check page are that it checks the health of services that the application is dependent e.g. SQL database connections, web service availability, and internal metrics which the application developers have incorporated as health monitoring and management of the application. If a request for a page such as a rook returns an HTTP 200 (OK), it may not means the application is healthy. You can precisely determine the health of the application instance and return an error code (HTTP 503: Service unavailable), you can use a custom health check page. Subsequently, the Azure Traffic Manager removes the deployment from the rotation to the application instance returns HTTP 200 (OK).

    For creating an Azure Traffic Manager profile with management portal, you will need to give an unique DNS title as well as the load balancing procedure. Afterward, organize the settings for the profile. Figure 1 illustrates the configured page for an Azure Traffic Manager Profile

    Azure Traffic Manager 1

    FIGURE 1 Configuring the Azure Traffic Manager profile

    If you want to develop a Traffic Manager profile with Azure PowerShell, you may want to use the New-AzureTrafficManagerProfile cmdlet. For instance, this code can create a profile name ContosoTM along with a domain name of contoso-web-tm.trafficmanager.net and a failover load balancing procedure.

    New-AzureTrafficManagerProfile -Name ContosoTM ` -DomainName contoso-web-tm.trafficmanager.net -LoadBalancingMethod Failover ` -MonitorPort 80 -MonitorProtocol Http -MonitorRelativePath “/” -Ttl 30

  2. Add endpoints to the Azure Traffic Manager profile.

    Azure Traffic Manager resolves DNS queries for your domain where the endpoints are present. Once you create the Azure Traffic Manager profile, you need to add the endpoints to the profile from which Azure Traffic Manager resolves the DNS queries. Using management portal, you can add, remove and disable the endpoints on the endpoints page of the Azure Traffic Manager profile as demonstrated in Figure 2.

    Azure Traffic Manager 2

    FIGURE 2 Adding, deleting, and disabling endpoints in an Azure Traffic Manager profile

    You can use Azure PowerShell to add an endpoint by using the Get-AzureTrafficManagerProfile, Add-AzureTrafficManagerEndpoint, and Set-AzureTrafficManagerProfile cmdlets, as shown in
    the following code.

    $tmProfile = Get-AzureTrafficManagerProfile -Name "ContosoTM"
    Add-AzureTrafficManagerEndpoint -TrafficManagerProfile $tmProfile `
    -DomainName "contoso-web-west.azurewebsites.net" -Type AzureWebsite `
    -Status Enabled |
    Set-AzureTrafficManagerProfile

    To remove an endpoint, use the Remove-AzureTrafficManagerEndpoint cmdlet as shown here.

    $tmProfile = Get-AzureTrafficManagerProfile -Name "ContosoTM"
    Remove-AzureTrafficManagerEndpoint -TrafficManagerProfile $tmProfile `
    -DomainName "contoso-web-west.azurewebsites.net" |
    Set-AzureTrafficManagerProfile
    To disable an endpoint, use the Set-AzureTrafficManagerEndpoint cmdlet as shown here.
    $tmProfile = Get-AzureTrafficManagerProfile -Name "ContosoTM"
    Set-AzureTrafficManagerEndpoint -TrafficManagerProfile $tmProfile `
    -DomainName "contoso-web-west.azurewebsites.net" -Status Disabled |
    Set-AzureTrafficManagerProfile

    You need to ensure that the Azure website is in the Standard mode to be added as an endpoint to the Azure Traffic Manager profile.

  3. Update DNS records for your custom domain.

    The final step to configure Azure Traffic Manager is to update your custom domain using a CNAME record. For example, suppose your custom domain is contoso.com and your Azure Traffic Manager DNS tittle is contoso-webtm. trafficmanager.net. Table 1 demonstrates how the CNAME record can be configured for this scenario.
    TABLE 1  Example DNS record for a custom domain and an Azure Traffic Manager DNS name

    RECORD TYPENAMEVALUE
    CNAMEwww.contoso.comcontoso-web-tm.trafficmanager.net
    CNAMEwww.contoso.comcontoso-web.azurewebsites.net

    Users will not find any actual traffic directed through Traffic Manager while navigating to an application configured with Azure Traffic Manager. When you search through a website configured with an Azure Traffic Manager, the user’s DNS server will provide a new DNS query to the DNS name for the Traffic Manager profile. Afterward, the Traffic Manager DNS name servers will receive this query. Depending on the load balancing procedure in the Azure Traffic Manager profile, the Traffic Manager chooses an endpoint from the profile and goes back to a CNAME record drawing to the DNS name for the chosen endpoint. The user’s DNS server will resolve the endpoint DNS name to an IP address and get back to the user. The user’s search browser uses the IP address to call the selected website. Lastly, the domain and IP address are collected on the client machine to send the subsequent requests directly to the website to the local DNS cache expires.

This article is a part of 70-533 Implementing Microsoft Azure Infrastructure Solutions Prep course.

More Articles included in this course are

article

Creating an Azure website

Creating an Azure website using  Portal, Powershell and CLI Creating an Azure website on Microsoft Azure Cloud starts with creating ...
Read More
article

Deployment slots in Azure website

Defining deployment slots in Azure website Deployment slots in Azure website are collection of individual Azure website linked to your ...
Read More
article

Publishing an Azure website

Publishing an Azure website using various methods For publishing an Azure website, the web application or code needs to be ...
Read More
article

WebJobs in Azure website

Introduction to WebJobs in Azure website and Deployment using Portal and Powershell Web Jobs in Azure websites are exclusive applications ...
Read More
article

Azure website settings

Introduction to Configuring the azure website settings The first step you will need to follow for an Azure website is to ...
Read More

Practice Tests in this course are

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 1

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 1 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 2

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 2 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 3

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 3 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 4

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 4 This page shows the instructions for Exam 70-533 ...
Read More

70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 5

Instructions for Exam 70-533 Implementing Microsoft Azure Infrastructure Solutions Practice Test 5 This page shows the instructions for Exam 70-533 ...
Read More