If you want to use Azure resources for website hosting, one of the essential services is DNS. In this blog post we will migrate a DNS zone to Azure DNS and prepare it for usage with an Azure hosted static website.

This is a multi part article with the following parts:

In this part we will delegate our DNS zone to Azure DNS and prepare it for CDN validation and Function App redirection.

Azure DNS

First we need to migrate the domain to Azure DNS. Therefore we create a DNS Zone:

To delegate the DNS zone ownership to Azure DNS, we have to open the DNS web portal of the domain hoster, where you bought your domain.
In my case, it’s GoDaddy. To delegate DNS zone ownership, the NS records have to be updated to the Azure DNS servers shown in the output above - including the dots at the end of each record.

GoDaddy nameserver entriesGoDaddy nameserver entries

To verify a successful delegation, nslookup can be used to receive the primary nameserver from the SOA record.

We will use the www subdomain as the main website entry point. That means we have to forward all traffic from the zone apex to www and that www also has to point to the CDN endpoint we will create later. For www subdomain and to verify our custom DNS name on the CDN endpoint later, we are going to create the following records for our DNS zone subdomain:

DNS entry type value
www.staticwebsite.de CNAME staticwebsitede.azureedge.net
@ A (FunctionAppIp)
@ TXT (FunctionAppUrl)

As you can see, we add a CNAME pointing to the later created CDN endpoint on the www subdomain. Unfortunately this is not possible for the root domain, as it would contradict to the DNS RFC. This ISC Blogpost explains in detail, why you cannot create CNAME entries in the zone apex.
The two @ entries are reserved for later. We will create a Azure Function to forward traffic from the root domain to www in part 5.

See the next part to learn how to setup the Azure CDN, get a free SSL certificate and use the Verizon rules engine.