Search code examples
azurednshostingazure-cdn

How to properly configure Azure DNS to route all traffic to CDN Profile


I purchased a domain yesterday through Azure and noticed that there are two places I can modify DNS record entries and they do not seem to be in sync with each other.

Within App Service Domains there is an option to "Manage DNS Records" where I can add various record types. However there is also the "Advanced Management Portal" where I can go into DNS Zones and add records. When I add a record in one area, it doesn't reflect in the other.

When I try to add a CNAME record of www and alias to "mycdn.azureedge.net" the CDN profile is unable to find this record whether it is in the Manage DNS Zone, Advanced Management, or both.

I'm unsure where I should be creating this record since it seems I can do it in two places.


Solution

  • I solved my own issue. It appears that Azure advanced DNS management takes precedence over DNS zone management when you've transferred the domain to azure.

    I was never able to make the CDN profile actually recognize any CNAME records I created, but I was using the CDN to alias to a Static Web App, and once I configured a custom domain in the static web app using a www root that worked. Additionally I needed to add domain forwarding to the Advanced DNS Zone management to forward the apex domain to the www domain.

    Because this was a React SPA using React Router I also needed to create a Routes.json file to send all traffic to the index.html file.