Sandbox question about A record and CNAME.

Xu Chen 85 Reputation points
2024-04-08T17:04:05.93+00:00

I think the "Correct Answer" of below question isn't correct as well. In either way, the A record must be updated in order to let App1 remain accessible. Isn't it? If the IP address changes, a CNAME entry is still valid, doesn't mean the App can remain accessible. Please kindly advise. Thanks.

You have an Azure subscription that contains a web app named App1.

You configure App1 with a custom domain name of webapp1.contoso.com.

You need to create a DNS record for App1. The solution must ensure that App1 remains accessible if the IP address changes.

Which type of DNS record should you create?

Your Answer

  • A

This answer is incorrect.

Correct Answer

  • CNAME

This answer is correct.

For web apps, you create either an A (Address) record or a CNAME (Canonical Name) record. An A record maps a domain name to an IP address. A CNAME record maps a domain name to another domain name. DNS uses the second name to look up the address. Users still see the first domain name in their browser. If the IP address changes, a CNAME entry is still valid, whereas an A record must be updated.

Configure Azure App Service - Training | Microsoft Learn

Create custom domain names - Training | Microsoft Learn

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,937 questions
0 comments No comments
{count} votes

Accepted answer
  1. Lex Li (Microsoft) 6,037 Reputation points Microsoft Employee
    2024-04-09T03:50:01.2066667+00:00

    The "Correct Answer" tries to reveal the actual workflow to all readers.

    • Any Azure app products give the user a usable URL from a Microsoft owned domain (varied by products). For example, my custom Container App URL looks like this xxx.yyy-zzz.eastus.azurecontainerapps.io.
    • To add custom domain (like test.mycompany.com), clearly you should then add a CNAME record on mycompany.com's DNS table for test and map to xxx.yyy-zzz.eastus.azurecontainerapps.io, not an A record.

    You shouldn't set an A record because the IP address of xxx.yyy-zzz.eastus.azurecontainerapps.io might change (due to redeployment in most cases). However, the CNAME record hides such IP changes properly.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.