Migrate an active DNS name to Azure App Service

This article shows you how to migrate an active DNS name to Azure App Service without any downtime.

When you migrate a live site and its DNS domain name to App Service, that DNS name is already serving live traffic. You can avoid downtime in DNS resolution during the migration by binding the active DNS name to your App Service app preemptively.

If you're not worried about downtime in DNS resolution, see Map an existing custom DNS name to Azure Web Apps.

Prerequisites

To complete this how-to:

Bind the domain name preemptively

When you bind a custom domain preemptively, you accomplish both of the following before making any changes to your DNS records:

  • Verify domain ownership
  • Enable the domain name for your app

When you finally migrate your custom DNS name from the old site to the App Service app, there will be no downtime in DNS resolution.

Access DNS records with domain provider

Sign in to the website of your domain provider.

Find the page for managing DNS records. Every domain provider has its own DNS records interface, so consult the provider's documentation. Look for areas of the site labeled Domain Name, DNS, or Name Server Management.

Often, you can find the DNS records page by viewing your account information, and then looking for a link such as My domains. Go to that page and then look for a link that is named something like Zone file, DNS Records, or Advanced configuration.

The following screenshot is an example of a DNS records page:

Example DNS records page

In the example screenshot, you select Add to create a record. Some providers have different links to add different record types. Again, consult the provider's documentation.

Note

For certain providers, such as GoDaddy, changes to DNS records don't become effective until you select a separate Save Changes link.

Create domain verification record

To verify domain ownership, Add a TXT record. The TXT record maps from awverify.<subdomain> to <appname>.azurewebsites.net.

The TXT record you need depends on the DNS record you want to migrate. For examples, see the following table (@ typically represents the root domain):

DNS record example TXT Host TXT Value
@ (root) awverify <appname>.azurewebsites.net
www (sub) awverify.www <appname>.azurewebsites.net
* (wildcard) awverify.* <appname>.azurewebsites.net

In your DNS records page, note the record type of the DNS name you want to migrate. App Service supports mappings from CNAME and A records.

Enable the domain for your app

In the Azure portal, in the left navigation of the app page, select Custom domains.

Custom domain menu

In the Custom domains page, select the + icon next to Add hostname.

Add host name

Type the fully qualified domain name that you added the TXT record for, such as www.contoso.com. For a wildcard domain (like *.contoso.com), you can use any DNS name that matches the wildcard domain.

Select Validate.

The Add hostname button is activated.

Make sure that Hostname record type is set to the DNS record type you want to migrate.

Select Add hostname.

Add DNS name to the app

It might take some time for the new hostname to be reflected in the app's Custom domains page. Try refreshing the browser to update the data.

CNAME record added

Your custom DNS name is now enabled in your Azure app.

Remap the active DNS name

The only thing left to do is remapping your active DNS record to point to App Service. Right now, it still points to your old site.

Copy the app's IP address (A record only)

If you are remapping a CNAME record, skip this section.

To remap an A record, you need the App Service app's external IP address, which is shown in the Custom domains page.

Close the Add hostname page by selecting X in the upper-right corner.

In the Custom domains page, copy the app's IP address.

Portal navigation to Azure app

Update the DNS record

Back in the DNS records page of your domain provider, select the DNS record to remap.

For the contoso.com root domain example, remap the A or CNAME record like the examples in the following table:

FQDN example Record type Host Value
contoso.com (root) A @ IP address from Copy the app's IP address
www.contoso.com (sub) CNAME www <appname>.azurewebsites.net
*.contoso.com (wildcard) CNAME * <appname>.azurewebsites.net

Save your settings.

DNS queries should start resolving to your App Service app immediately after DNS propagation happens.

Next steps

Learn how to bind a custom SSL certificate to App Service.