Unable to Add Custom Domain to Azure Static Web App

Sathish Mugite 0 Reputation points
2024-06-03T04:05:48.37+00:00

We have purchased our domain(example.com) from external dns provider infomaniak. We have two static web apps created in our azure account, one for dev and other for stage environment.

We have added CNAME records in our external dns provider portal for both dev.example.com and stg.example.com

When I tried adding custom domain name stg.example.com for stage static web app and it was created successfully, but adding custom domain name dev.example.com for dev static web app failed with error Could not add custom domain. Please ensure the custom domain is not linked to another app or that a previous implementation is not still being cleaned up.

Note: It's been more than 24 hours that we have added our CNAME records in our external dns provider portal.

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
968 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. brtrach-MSFT 16,586 Reputation points Microsoft Employee
    2024-06-04T05:24:58.2+00:00

    @Sathish Mugite I understand that there might be two issues here.

    1. The stg.example.com custom domain has not been added. Can you confirm the status of this site?
    2. You are receiving an error for the second site, dev.example.com when adding the same root custom domain used in the staging app.

    While we await your reply for number 1, I want to confirm that the error message that you shared is correct. You cannot use the same root custom domain across multiple Azure Static Web Apps.

    There are two alternatives to achieve what you are looking for. The first is to use Azure Static Web Apps Preview Environment feature. This feature allows you to view your changes before completing the pull request. This would eliminate the need for a dev/staging separate apps. See here for more information on this feature: https://learn.microsoft.com/en-us/azure/static-web-apps/preview-environments

    The second workaround would be to use Azure Front Door. This would allow you to create an environment in Azure Front Door for the example.com domain. You could then create and assign subdomains to different Azure Static Web Apps to get around the error.

    Please let us know if you have any questions or concerns.


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.