Tutorial: Create an alias record to support apex domain names with Traffic Manager
You can create an alias record for your apex domain name to reference an Azure Traffic Manager profile. Instead of using a redirecting service, you configure Azure DNS to reference a Traffic Manager profile directly from your zone.
In this tutorial, you learn how to:
- Create a virtual network and a subnet.
- Create a web server virtual machine with a public IP.
- Add a DNS label to a public IP.
- Create a Traffic Manager profile.
- Create an alias record.
- Test the alias record.
If you don’t have an Azure subscription, create a free account before you begin.
- An Azure account with an active subscription.
- A domain name hosted in Azure DNS. If you don't have an Azure DNS zone, you can create a DNS zone, then delegate your domain to Azure DNS.
In this tutorial,
contoso.com is used as an example domain name. Replace
contoso.com with your own domain name.
Sign in to Azure
Sign in to the Azure portal at https://portal.azure.com.
Create the network infrastructure
Create a virtual network and a subnet to place your web servers in.
In the Azure portal, enter virtual network in the search box at the top of the portal, and then select Virtual networks from the search results.
In Virtual networks, select + Create.
In Create virtual network, enter or select the following information in the Basics tab:
Setting Value Project Details Subscription Select your Azure subscription. Resource Group Select Create new. In Name, enter TMResourceGroup. Select OK. Instance details Name Enter myTMVNet. Region Select your region.
Select the IP Addresses tab or select the Next: IP Addresses button at the bottom of the page.
In the IP Addresses tab, enter the following information:
Setting Value IPv4 address space Enter 10.10.0.0/16.
Select + Add subnet, and enter this information in the Add subnet:
Setting Value Subnet name Enter WebSubnet. Subnet address range Enter 10.10.0.0/24.
Select the Review + create tab or select the Review + create button.
Create web server virtual machines
Create two Windows Server virtual machines, and install IIS web server on them, and then add DNS labels to their public IPs.
Create the virtual machines
Create two Windows Server 2019 virtual machines.
In the Azure portal, enter virtual machine in the search box at the top of the portal, and then select Virtual machines from the search results.
In Virtual machines, select + Create and then select Azure virtual machine.
In Create a virtual machine, enter or select the following information in the Basics tab:
Setting Value Project Details Subscription Select your Azure subscription. Resource Group Select TMResourceGroup. Instance details Virtual machine name Enter Web-01. Region Select (US) East US. Availability options Select No infrastructure redundancy required. Security type Select Standard. Image Select Windows Server 2019 Datacenter - Gen2. Size Select your VM size. Administrator account Username Enter a username. Password Enter a password. Confirm password Reenter the password. Inbound port rules Public inbound ports Select None.
Select the Networking tab, or select Next: Disks, then Next: Networking.
In the Networking tab, enter or select the following information:
Setting Value Network interface Virtual network Select myTMVNet. Subnet Select WebSubnet. Public IP Select Create new, and then enter Web-01-ip in Name. Select Basic for the SKU, and Static for the Assignment. NIC network security group Select Basic. Public inbound ports Select Allow selected ports. Select inbound ports Select HTTP (80), HTTPS (443) and RDP (3389).
Select Review + create.
Review the settings, and then select Create.
Repeat previous steps to create the second virtual machine. Enter Web-02 in the Virtual machine name and Web-02-ip in the Name of Public IP. For the other settings, use the same information from the previous steps used with first virtual machine.
Each virtual machine deployment may take a few minutes to complete.
Install IIS web server
Install IIS on both Web-01 and Web-02 virtual machines.
In the Connect page of Web-01 virtual machine, select RDP and then Download RDP File.
Open Web-01.rdp file, and select Connect.
Enter the username and password entered during virtual machine creation.
On the Server Manager dashboard, select Manage then Add Roles and Features.
Select Server Roles or select Next three times. On the Server Roles screen, select Web Server (IIS).
Select Add Features, and then select Next.
Select Confirmation or select Next three times, and then select Install. The installation process takes a few minutes to finish.
After the installation finishes, select Close.
Go to C:\inetpub\wwwroot and open iisstart.htm with Notepad or any editor of your choice to edit the default IIS web page.
Replace all the text in the file with
Hello World from Web-01and save the changes to iisstart.htm.
Open a web browser. Browse to localhost to verify that the default IIS web page appears.
Repeat previous steps to install IIS web server on Web-02 virtual machine. Use
Hello World from Web-02to replace all the text in iisstart.htm.
Add a DNS label
Public IP addresses need DNS labels to work with Traffic Manager.
In the Azure portal, enter TMResourceGroup in the search box at the top of the portal, and then select TMResourceGroup from the search results.
In the TMResourceGroup resource group, select the Web-01-ip public IP address.
Under Settings, select Configuration.
Enter web01pip in the DNS name label.
Repeat the previous steps for the Web-02-ip public IP address and enter web02pip in the DNS name label.
Create a Traffic Manager profile
In the Overview page of Web-01-ip public IP address, note the IP address for later use. Repeat this step for the Web-02-ip public IP address.
In the Azure portal, enter Traffic Manager profile in the search box at the top of the portal, and then select Traffic Manager profiles.
Select + Create.
In the Create Traffic Manager profile page, enter or select the following information:
Setting Value Name Enter TM-alias-test. Routing method Select Priority. Subscription Select your Azure subscription. Resource group Select TMResourceGroup.
After TM-alias-test deployment finishes, select Go to resource.
In the Endpoints page of TM-alias-test Traffic Manager profile, select + Add and enter or select the following information:
Setting Value Type Select External endpoint. Name Enter EP-Web01. Fully qualified domain name (FQDN) or IP Enter the IP address for Web-01-ip that you noted previously. Priority Enter 1.
Repeat the last two steps to create the second endpoint. Enter or select the following information:
Setting Value Type Select External endpoint. Name Enter EP-Web02. Fully qualified domain name (FQDN) or IP Enter the IP address for Web-02-ip that you noted previously. Priority Enter 2.
Create an alias record
Create an alias record that points to the Traffic Manager profile.
In the Azure portal, enter contoso.com in the search box at the top of the portal, and then select contoso.com DNS zone from the search results.
In the Overview page of contoso.com DNS zone, select the + Record set button.
In the Add record set, leave the Name box empty to represent the apex domain name. An example is
Select A for the Type.
Select Yes for the Alias record set, and then select the Azure Resource for the Alias type.
Select the TM-alias-test Traffic Manager profile for the Azure resource.
Test the alias record
- From a web browser, browse to
contoso.comor your apex domain name. You see the IIS default page with
Hello World from Web-01. The Traffic Manager directed traffic to Web-01 IIS web server because it has the highest priority. Close the web browser and shut down Web-01 virtual machine. Wait a few minutes for the virtual machine to completely shut down.
- Open a new web browser, and browse again to
contoso.comor your apex domain name.
- You should see the IIS default page with
Hello World from Web-02. The Traffic Manager handled the situation and directed traffic to the second IIS server after shutting down the first server that has the highest priority.
Clean up resources
When no longer needed, you can delete all resources created in this tutorial by following these steps:
- On the Azure portal menu, select Resource groups.
- Select the TMResourceGroup resource group.
- On the Overview page, select Delete resource group.
- Enter TMResourceGroup and select Delete.
- On the Azure portal menu, select All resources.
- Select contoso.com DNS zone.
- On the Overview page, select the @ record created in this tutorial.
- Select Delete and then Yes.
In this tutorial, you learned how to create an alias record to use your apex domain name to reference a Traffic Manager profile.
Submit and view feedback for