Alias records
Azure DNS offers integration with other services hosted in Azure via alias records.
With conventional DNS records, you explicitly specify the target, such as the IP address of an A record. If the IP address changes, you need to update the DNS record accordingly.
Using alias records, you can define the target of the DNS record implicitly by referencing another Azure resource. The value of the DNS record is populated automatically based on the resource it references and is updated automatically if that resource changes.
Alias records can reference three different resource types:
- An A or AAAA These records can reference a public IP address, of type IPv4 or IPv6, respectively.
- A, AAAA, or CNAME These records can reference a Traffic Manager profile. This exposes the dynamic, traffic-managed name resolution of the Traffic Manager directly within a record in your DNS domain. Prior to this feature, you had to create a CNAME record from your domain to a record in the trafficmanager.net domain provided by Azure Traffic Manager.
- An A, AAAA or CNAME These records can also reference another record in the same DNS zone. This lets you create synchronized records with ease.
Alias records are a very useful way to address a number of scenarios.
- First, alias records prevent orphaned DNS records. A common problem with DNS systems is that records are not cleaned up when the services they reference are deleted. The DNS record is left dangling. With alias records, the DNS record no longer resolves once the underlying service is deleted.
- Second, as has already been discussed, by updating automatically when underlying resources change, alias records reduce your management overhead and help you avoid accidental application downtime.
- Third, because alias records enable you to avoid using a CNAME record when using a vanity domain name with Azure Traffic Manager, you can implement a traffic-managed record at the apex of your domain.
Create DNS zones and DNS records using the Azure portal
To create a DNS zone, from the Azure portal, search for DNS Zone. On the DNS Zones blade, click Create to open the Create DNS Zone blade. Specify the DNS domain name as the DNS zone resource name, and select your resource group, as shown in Figure 4-46.
FIGURE 4-46 Creating a DNS zone using the Azure portal
Once the DNS zone has been created, open the DNS zone blade. The Azure DNS name servers assigned to the zone are listed under Essentials, as highlighted in Figure 4-47.
FIGURE 4-47 The DNS zone blade, displaying the Azure DNS name servers assigned to this zone
To set up DNS delegation for the DNS zone, these name servers must be listed in the corresponding NS records in the parent zone. If the domain name was purchased using the Azure App Service Domains service, this will be done automatically. Otherwise, this must be configured at the DNS registrar where the domain name was purchased.
To create a DNS record in a new record set, click +Record Set to open the Add Record Set blade. If there is an existing record with the same name and type as the record you want to create, you should instead click the existing record set and add the new record there. To create a pair of A records with name “www” (giving the fully qualified domain name “www.hugelab. net”), use the following values, as shown in Figure 4-48.
- Name www
- Type A
- Alias Record Set No
- TTL 1 hour (or choose your own value)
- IP Addresses Enter A record IP addresses, one for each DNS record in the record set.
FIGURE 4-48 The Add Record Set blade
Suppose now you want to create a DNS record at the zone apex (so the fully qualified domain name is simply the DNS zone name “hugelab.net”), pointing to a dynamically allocated public IP address. Click +Record Set again and complete the Add Record Set blade with the following settings, as shown in Figure 4-49:
- Name @ (This is a DNS convention for records at the zone apex.)
- Type A
- Alias Record Set Yes
- Choose Subscription Choose the subscription containing the public IP address
- Azure Resource Choose the public IP address resource
- TT 1 hour (or choose your own value)