Using Azure DNS to implement custom domain settings
On this page, about custom domain and how Azure DNS provides DNS for a custom domain for any of your Azure resources that maintain custom domains or that have a fully equipped domain name (FQDN). So, let’s begin.
Prerequisites for custom domain
Only if the Azure AD admin was setup for Azure SQL Database, SQL Managed Instance, or Azure Synapse is Azure AD authentication available. Existing Azure Active Directory users established earlier inside SQL Server will no longer be able to login to the database using their Azure Active Directory credentials if the Azure Active Directory admin is removed from the server.
In the same vein, you can configure a vanity or custom domain for Azure Function Apps, Public IP addresses, App Service (Web Apps), Blob Storage, and Azure CDN.
Azure Function App
- In order to configure a custom domain for Azure function apps, create a record called CNAME.
- Now navigate to Function App and select the function app. Click Platform features, then Custom domains under Networking.
Note: This address is used as the alias for the DNS record produced and can be seen on the Custom domains blade.
- Navigate to your DNS Zone and click + Record set. To generate a record set, fill out the following information on the Add record set blade and click OK.
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 | adatumfunction.azurewebsites.net | The DNS name you are creating the alias for, in this example it is the adatumfunction.azurewebsites.net DNS name provided by default to the function app. |
- Go back to your function app, select Platform features, and below Networking click Custom domains, then under Custom Hostnames click + Add hostname.
- Select the CNAME record in the hostname text box on the Add hostname blade and click Validate. To add the alias, click Add hostname.
Public IP address
- To configure a custom domain for services, use load Balancer, Cloud Service, Resource Manager VMs, and, Classic VMs.
- Now, go to Networking > Public IP address, pick the Public IP resource and click Configuration. Notate the IP address shown.
- Move to your DNS Zone and click + Record set. Fill out the following information on the Add record set blade and click OK to create it.
Property | Value | Description |
---|---|---|
Name | mywebserver | 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. |
- Once the A record is created, run
nslookup
to verify the record resolves.
App Service (Web Apps)
The below-mentioned steps will take you through configuring a custom domain for an app service web app.
- Visit the App Service and select the resource you are configuring a custom domain name, and click Custom domains.
- On the Custom domains blade, take note of the current url; this URL will be used as the alias for the DNS record you just established.
- Move to your DNS Zone and click + Record set. Fill out the following information on the Add record set blade and click OK to create it.
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 | webserver.azurewebsites.net | The DNS name you are creating the alias for, in this example it is the webserver.azurewebsites.net DNS name provided by default to the web app. |
- Navigate back to the app service that is configured for the custom domain name. Click Custom domains, then click Hostnames. To add the CNAME record you created, click + Add hostname.
- After the completion of the process, run nslookup to validate name resolution is working.
Blob storage
The asverify method is used to configure a CNAME record for a blob storage account in the steps below. There is no downtime using this strategy.
- Go to Storage > Storage Accounts, click your storage account, and select Custom domain.
- Visit the DNS Zone and click + Record set. After this, fill out the following information on the Add record set blade and click OK to create it.
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.adatumfunctiona9ed.blob.core.windows.net | The DNS name you are creating the alias for, in this example it is the asverify.adatumfunctiona9ed.blob.core.windows.net DNS name provided by default to the storage account. |
- Move back to the storage account by clicking Storage > Storage Accounts, pick the storage account and click Custom domain. Now, type in the alias you created without the asverify prefix in the text box, check to Use indirect CNAME validation and click Save. Once this step is complete, return to your DNS zone and create a CNAME record without the asverify prefix. After that point, you are safe to delete the CNAME record with the cdnverify prefix.
Azure custom domain
The cdnverify method is used to configure a CNAME record for a CDN endpoint in the steps below. There is no downtime using this strategy.
- Navigate to Networking > CDN Profiles, select your CDN profile.
- Select the endpoint you are working with and click + Custom domain. Note the Endpoint hostname as this value is the record that the CNAME record points to.
- Visit your DNS Zone and click + Record set. After that, fill out the following information on the Add record set blade and click OK to create it.
Property | Value | Description |
---|---|---|
Name | cdnverify.mycdnendpoint | 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 | cdnverify.adatumcdnendpoint.azureedge.net | The DNS name you are creating the alias for, in this example it is the cdnverify.adatumcdnendpoint.azureedge.net DNS name provided by default to the storage account. |
- Move back to your CDN endpoint by clicking Networking > CDN Profiles, and select your CDN profile. Click + Custom domain and enter your CNAME record alias without the cdnverify prefix and click Add.
- After completion, return to your DNS zone and create a CNAME record without the cdnverify prefix. After that point, you are safe to delete the CNAME record with the cdnverify prefix.
Reference: Microsoft Documentation