Use Azure DNS to provide custom domain settings for an Azure service

Azure DNS provides name resolution for any of your Azure resources that support custom domains, or that have a fully qualified domain name (FQDN). For example, you might have an Azure web app you want your users to access using contoso.com or www.contoso.com as the FQDN. This article walks you through configuring Azure DNS to access your Azure service with custom domains.

You can configure a vanity or custom domain for Azure Function Apps, Public IP addresses, App Service (Web Apps), and Blob storage.

Prerequisites

To use Azure DNS for your custom domain, you must first delegate your domain to Azure DNS. See Delegate a domain to Azure DNS for instructions on how to configure your name servers for delegation. Once your domain is delegated to your Azure DNS zone, you now can configure your DNS records needed.

Azure Function App

To configure a custom domain for Azure function apps, a CNAME record is created and configured on the function app itself. A CNAME record maps a domain name to another domain or subdomain. In this case, you create a CNAME in your public domain and provision the CNAME alias to be the FQDN of your custom domain.

  1. Navigate to Function App and select your function app. Select Custom domains under Settings. Note the current url under assigned custom domains, this address is used as the alias for the DNS record created.

    Screenshot of custom domains for function app.

  2. Navigate to your DNS Zone and select + Record set. Enter the following information on the Add record set page and select OK to create it.

    Screenshot of function app add record set page.

    Property Value Description
    Name myfunctionapp This value along with the domain name label is the FQDN for the custom domain name.
    Type CNAME Use a CNAME record is using an alias.
    TTL 1 1 is used for 1 hour
    TTL unit Hours Hours are used as the time measurement
    Alias contosofunction.chinacloudsites.cn The DNS name you're creating the alias for, in this example it's the contosofunction.chinacloudsites.cn DNS name provided by default to the function app.
  3. Navigate back to your function app, select Custom domains under Settings. Then select + Add custom domain.

    Screenshot of add custom domain button for function app.

  4. On the Add custom domain page, enter the CNAME record in the Custom domain text field and select Validate. If the record is found, the Add custom domain button appears. Select Add custom domain to add the alias.

    Screenshot of add custom domain page for function app.

Public IP address

To configure a custom domain for services that use a public IP address resource such as Application Gateway, Load Balancer, Cloud Service, Resource Manager VMs, and, Classic VMs, an A record is used. An A record (address record) maps a domain name to an IP address. In this case, you create a new A record in your public domain and configure it to have an IP address corresponding to the public IP address of your Azure service.

  1. Navigate to the Public IP resource and select Configuration. Note the IP address shown.

    Screenshot of public ip configuration page.

  2. Navigate to your DNS Zone and select + Record set. Enter the following information on the Add record set page and select OK to create it.

    Screenshot of public ip record set page.

    Property Value Description
    Name webserver1 This value along with the domain name label is the FQDN for the custom domain name.
    Type A Use an A record as the resource is an IP address.
    TTL 1 1 is used for 1 hour
    TTL unit Hours Hours are used as the time measurement
    IP Address <your ip address> The public IP address.
  3. Once the A record is created, run nslookup to validate the record resolves.

    Screenshot of nslookup in cmd for public ip.

App Service (Web Apps)

The following steps take you through configuring a custom domain for an app service web app.

  1. Navigate to App Service and select the resource you're configuring a custom domain name, and select Custom domains under Settings. Note the current url under assigned custom domains, this address is used as the alias for the DNS record created.

    Screenshot of custom domains for web app.

  2. Navigate to your DNS Zone and select + Record set. Enter the following information on the Add record set page and select OK to create it.

    Screenshot of web app record set page.

    Property Value Description
    Name mywebserver This value along with the domain name label is the FQDN for the custom domain name.
    Type CNAME Use a CNAME record is using an alias. If the resource used an IP address, an A record would be used.
    TTL 1 1 is used for 1 hour
    TTL unit Hours Hours are used as the time measurement
    Alias contoso.chinacloudsites.cn The DNS name you're creating the alias for, in this example it's the contoso.chinacloudsites.cn DNS name provided by default to the web app.
  3. Navigate back to your web app, select Custom domains under Settings. Then select + Add custom domain.

    Screenshot of add custom domain button for web app.

  4. On the Add custom domain page, enter the CNAME record in the Custom domain text field and select Validate. If the record is found, the Add custom domain button appears. Select Add custom domain to add the alias.

    Screenshot of add custom domain page for web app.

  5. Once the process is complete, run nslookup to validate name resolution is working.

    Screenshot of nslookup for web app.

To learn more about mapping a custom domain to App Service, visit map an existing custom DNS name to Azure Web Apps.

To learn how to migrate an active DNS name, see migrate an active DNS name to Azure App Service.

Blob storage

The following steps take you through configuring a CNAME record for a blob storage account using the asverify method. This method ensures there's no downtime.

  1. Navigate to Storage Accounts, select your storage account, and select Networking under Settings. Then select the Custom domain tab. Note the FQDN in step 2, this name is used to create the first CNAME record.

    Screenshot of custom domains for storage account.

  2. Navigate to your DNS Zone and select + Record set. Enter the following information on the Add record set page and select OK to create it.

    Screenshot of storage account record set page.

    Property Value Description
    Name asverify.mystorageaccount This value along with the domain name label is the FQDN for the custom domain name.
    Type CNAME Use a CNAME record is using an alias.
    TTL 1 1 is used for 1 hour
    TTL unit Hours Hours are used as the time measurement
    Alias asverify.contoso.blob.core.chinacloudapi.cn The DNS name you're creating the alias for, in this example it's the asverify.contoso.blob.core.chinacloudapi.cn DNS name provided by default to the storage account.
  3. Navigate back to your storage account and select Networking and then the Custom domain tab. Type in the alias you created without the asverify prefix in the text box, check Use indirect CNAME validation, and select Save.

    Screenshot of storage account add custom domain page.

  4. Return to your DNS zone and create a CNAME record without the asverify prefix. After that point, you're safe to delete the CNAME record with the asverify prefix.

    Screenshot of storage account record without asverify prefix.

  5. Validate DNS resolution by running nslookup.

To learn more about mapping a custom domain to a blob storage endpoint visit Configure a custom domain name for your Blob storage endpoint

Next steps

Learn how to configure reverse DNS for services hosted in Azure.