Tutorial: Create an alias record to refer to a zone resource record

Alias records can reference other record sets of the same type. For example, you can have a DNS CNAME record set be an alias to another CNAME record set of the same type. This capability is useful if you want to have some record sets as aliases and some as non-aliases in terms of behavior.

In this tutorial, you learn how to:

  • Create a resource record in the zone.
  • Create an alias record for the resource record.
  • Test the alias record.

If you don’t have an Azure subscription, create a free account before you begin.

Prerequisites

  • 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.

Note

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.

Create an alias record

Create an alias record that points to a resource record in the zone.

Create the target resource record

  1. 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.

  2. In the Overview page, select the + Record set button.

  3. In the Add record set, enter server in the Name.

  4. Select A for the Type.

  5. Enter 10.10.10.10 in the IP address.

  6. Select OK.

    Screenshot of adding the target record set in the Add record set page.

Create the alias record

  1. In the Overview page of contoso.com DNS zone, select the + Record set button.

  2. In the Add record set, enter test in the Name.

  3. Select A for the Type.

  4. Select Yes for the Alias record set, and then select the Zone record set for the Alias type.

  5. Select the server record for the Zone record set.

  6. Select OK.

    Screentshot of adding the alias record set in the Add record set page.

Test the alias record

After adding the alias record, you can verify that it's working by using a tool such as nslookup to query the test A record.

Tip

You may need to wait at least 10 minutes after you add a record to successfully verify that it's working. It can take a while for changes to propagate through the DNS system.

  1. From a command prompt, enter the nslookup command:

    nslookup test.contoso.com
    
  2. Verify that the response looks similar to the following output:

    Server:  UnKnown
    Address:  40.90.4.1
    
    Name:    test.contoso.com
    Address:  10.10.10.10
    
  3. In the Overview page of contoso.com DNS zone, select the server record, and then enter 10.11.11.11 in the IP address.

  4. Select Save.

  5. Wait a few minutes, and then use the nslookup command again. Verify the response changed to reflect the new IP address:

    Server:  UnKnown
    Address:  40.90.4.1
    
    Name:    test.contoso.com
    Address:  10.11.11.11
    

Clean up resources

When no longer needed, you can delete all records created in this tutorial by following these steps:

  1. On the Azure portal menu, select All resources.
  2. Select contoso.com DNS zone.
  3. On the Overview page, select the server record.
  4. Select Delete and then Yes.
  5. Repeat last two steps with test record.

Next steps

In this tutorial, you learned the basic steps to create an alias record to refer to a resource record within the Azure DNS zone. To learn how to create an alias record that references an Azure public IP address resource, continue with the next tutorial: