Add custom domain to Static Web App fails - domainName is invalid. The domain name given was not found.

Ronny Forberger 45 Reputation points
2023-07-26T09:49:28.9366667+00:00

I am trying to add a dns domain to an Azure Static Web App, but it fails with the error message

domainName is invalid. The domain name given was not found.

doing this in the portal.

Bildschirmfoto 2023-07-26 um 11.45.31

The DNS domain was added to another SWA before, but I deleted the respective tenant.

Doing this with terraform, I get the error

Error: creating Static Site Custom Domain: (Custom Domain Name "ronnyforberger.business" / Static Site Name "ronnyforberger-business" / Resource Group "ronnyforberger-business"): web.StaticSitesClient#CreateOrUpdateStaticSiteCustomDomain: Failure sending request: StatusCode=409 -- Original Error: Code="Conflict" Message="Request Envelope is invalid.  Please ensure the custom domain is not linked to another site." Details=[{"Message":"Request Envelope is invalid.  Please ensure the custom domain is not linked to another site."},{"Code":"Conflict"},{"ErrorEntity":{"Code":"Conflict","ExtendedCode":"51021","Message":"Request Envelope is invalid.  Please ensure the custom domain is not linked to another site.","MessageTemplate":"{0} is invalid.  {1}","Parameters":["Request Envelope","Please ensure the custom domain is not linked to another site."]}}]

Could you please help me what I should do?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,933 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,173 questions
{count} votes

1 answer

Sort by: Most helpful
  1. SnehaAgrawal-MSFT 22,706 Reputation points Moderator
    2023-07-27T16:00:55.93+00:00

    @Ronny Forberger thanks for reply!

    So, when you delete an Azure tenant, it may take some time for all associated resources, including the domain, to be fully released for reuse. If you encounter an error stating that the domain is already connected to another tenant while trying to link it to a new Azure tenant, follow these steps:

    Wait for domain release: Allow some time after deleting the old Azure tenant for the domain to be fully released. This could take several hours or up to 72 hours in certain cases. During this period, the domain is still considered associated with the deleted tenant.

    Verify domain status: Confirm that the domain is no longer associated with the old tenant. Perform a WHOIS lookup or contact your domain registrar to check the domain's status and ownership.

    Retry domain connection: Once the domain is released and disconnected from the old tenant, attempt to connect it to the new Azure tenant again. In the Azure portal, navigate to the Azure Active Directory section and select "Custom domain names." Follow the steps to add and verify the domain in the new tenant.

    1. Contact Azure Support: If you've waited an appropriate amount of time, verified the domain's release, and still encounter issues connecting the domain to the new tenant, contact Azure Support for further assistance. They can investigate the domain's status and provide personalized guidance.

    Please let us know if further query or issue remains.


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.