Search code examples
azurednssubdomaincname

Azure DNS CNAME subdomain


We have two sites:

  • proddomain.com (proddomain.azurewebsites.net)
  • stagingdomain.azurewebsites.net

We need to make stagingdomain.azurewebsites.net a subdomain of proddomain.com, for example stagingdomain.proddomain.com. We added a CNAME of "stagingdomain" to proddomain.com DNS, but when going to the url stagingdomain.proddomain.com, it just gives a 404 blue screen.

When i do DNS check, both stagingdomain.proddomain.com and stagingdomain.azurewebsites.net point to the same IP.


Solution

  • If you want to map a subdomain to web sites in your Azure app service, you could add a CNAME record for your subdomain of proddomain.com. Then add such subdomain hostname in your Azure app service. You could follow this tutorial to Map your domain.

    Probably, in this case, there is missing a hostname like stagingdomain.proddomain.com in the custom domains of app service stagingdomain.azurewebsites.net.

    From this picture, you could follow these steps: app services or web app---custom domains---add hostname---validate---add hostname. enter image description here

    Then, you could verify these DNS records from digwebinterface. You could also run ipconfig /flushdns to clear cache in the command prompt and test DNS resolution again.