In this series, we are discussing about Azure traffic manager basic concepts. We also have created a traffic manager profile in last post. If you want to go through the posts, you can find them at:
- Azure Traffic Manager – Getting Started
- Azure Traffic Manager – Routing Methods Overview
- Azure Traffic Manager – Create new profile
In this post, we will add endpoints to the Azure traffic manager and verify that traffic manager setup works.
Prerequisites
You would need an active Azure subscription. If you don’t have an Azure subscription, create a free account now.
Create Web Apps
Create two instances of Azure web apps. Both of them should be in separate Azure regions. Let’s say first Azure web app is created in region East US
while the other one is created in Central India
region. The two URLs for those apps would be:
demo-app-east-us.azurewebsites.net
demo-app-central-india.azurewebsites.net
In real world, both web apps should host the same application. For this demo, we will not deploy any application. When an Azure web app instance is created, the default page is shown. We will use that page for verifying that Azure traffic manager settings are working.
We have assigned Priority based routing method to Azure traffic manager profile. So, for verifying, we will assign priority 1 to East US
and priority 2 to Central India
.
Because East US
has priority 1, all requests would go to East US
endpoint. And then we will try to disable one East US
app and then we will try to access the app using DNS name. As the Central India
app is still available, the default page should still be presented to the client.
Add Endpoints
Login to Azure Portal. Search for traffic manager profiles and open the newly created traffic manager profile demo-tm
. Then select Endpoints from the left navigation and then click on Add. This will open Add endpoint panel. Provide below inputs on the panel:
- Type, select
Azure endpoint
option as we are targeting the Azure web app - Name, the name of this endpoint.
- Target resource type, select
App Service
as the web apps we want to load balance are deployed as App service. - Target resource, select the app service name
demo-app-east-us
- Priority, set priority to 1 for East US endpoint
- Custom Header settings, let it be empty. It is not required for demo.
After providing inputs, click on Add to save the endpoint.
Once this endpoint is created, create another endpoint for the second region Central India
and set its priority to 2.
Verification
Now, lets navigate to Azure traffic manager profile and get the DNS name.
If we access the application using this DNS name, the default app service page should be presented. This is coming from East US
app, because it is the primary endpoint with priority 1.
Now, disable the app service from East US region. As shown in snapshot below, the priority 1 web app is stopped.
Now again try to access the traffic manager profile DNS name. This would still show the same default page as the app in Central India
Azure region is still running. Hence, we have setup the priority based routing using Azure traffic manager successfully.
I hope you found this information useful. Let me know your thoughts.