Is it possible to have the same custom domain with Azure-managed certificate on both an app service and a Front Door endpoint?

James Munro 45 Reputation points
2025-04-07T13:44:43.45+00:00

I have an app service with a custom domain and an Azure managed certificate, which has worked fine for years. Recently I added a Front Door profile and of course added the same custom domain to that, with a certificate created by Azure Front Door.

In this process the DNS records for the domain were updated so that the A record is now an ALIAS to the AFD resource, and the CNAME for www points to the AFD endpoint.

However, recently Azure reported this error on the app service:

Auto-Renewal Failed... for Apex domain we must have the A record mapped to the webapp IP. For subdomain, we must have CNAME mapped to the webapp name.

This seems to imply that once Front Door is deployed, the web app itself can no longer have a custom domain. But there is advice from MS online that you should "Preserve the original HTTP host name between a reverse proxy and its back-end web application".

MS also states that "For HTTPS connections, Azure Front Door expects that your origin presents a certificate from a valid certificate authority (CA) with a subject name matching the origin hostname."

So I am confused about how to do this. (Maybe I have misunderstood.)

Can I have a custom domain with an Azure managed certificate on both AFD and the app service? If not, how do I meet the best practice on ensuring the original HTTP host name requested by the user also matches the app service host name?

Azure Front Door
Azure Front Door
An Azure service that provides a cloud content delivery network with threat protection.
851 questions
{count} votes

Accepted answer
  1. Ganesh Patapati 6,915 Reputation points Microsoft External Staff Moderator
    2025-04-07T16:53:15.7566667+00:00

    Hello James Munro

    Azure Front Door (AFD) and Azure App Service can both use Azure-managed certificates for custom domains. However, when AFD is introduced, it becomes the primary endpoint for your custom domain. This means:

    • The DNS records (A and CNAME) are updated to point to AFD.
    • The App Service custom domain binding may no longer work as expected because the DNS no longer points directly to the App Service.
    • The error you encountered, "Auto-Renewal Failed," occurs because Azure App Service requires the A record (for apex domains) or CNAME (for subdomains) to point directly to the App Service for the managed certificate to renew. When the DNS points to AFD instead, this requirement is not met.

    To meet the best practice of preserving the original HTTP host name between AFD and the App Service:

    • Configure AFD to forward the original host name in the Host header to the App Service. This ensures that the App Service sees the original custom domain in requests.
    • Ensure that the App Service has a valid TLS certificate for the custom domain. Since the Azure-managed certificate cannot auto-renew in this setup, you may need to use a custom certificate (e.g., from a third-party CA) and manually upload it to the App Service.

    Refer: https://learn.microsoft.com/en-us/azure/frontdoor/standard-premium/how-to-configure-https-custom-domain

    Refer: https://learn.microsoft.com/en-us/azure/app-service/tutorial-secure-domain-certificate


    If above is unclear and/or you are unsure about something add a comment below.

    Just checking in to see if below information was helpful. If you have any further updates on this issue, please feel free to post back.

    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.