I am experiencing what appears to be a backend state issue with Azure Static Web Apps.
I originally had a Static Web App with a custom domain attached. The custom-domain operation failed, and after attempting to remove it, the custom domain became stuck in the Deleting state.
I then created a replacement Static Web App. The replacement app itself deploys correctly, but adding a custom domain to it fails with:
An unknown error has occurred while adding your custom domain. Please try again later.
The replacement custom-domain resource ends up in the Failed state.
What I have already verified
The DNS is hosted by an external provider.
The CNAME for the new www hostname correctly resolves to the replacement Static Web App's *.azurestaticapps.net hostname.
I verified this using dig, including public DNS resolvers.
I also checked CAA records and found no CAA restrictions that should prevent Azure from issuing its managed certificate.
HTTPS currently reaches Azure, but Azure has not provisioned/bound a certificate containing the custom hostname, which is consistent with the custom-domain operation having failed.
Azure Portal attempts
I tried:
Removing the custom domain from the original Static Web App.
Waiting for deletion to complete.
Creating a replacement Static Web App.
Adding the www hostname to the replacement app using CNAME validation.
Retrying the failed custom-domain operation after DNS propagation had completed.
Deleting the original Static Web App.
Finally, attempting to delete the entire resource group.
The original custom domain remains stuck in Deleting.
The replacement custom domain remains in Failed.
The original Static Web App deletion was accepted but did not complete, and now deletion of the resource group is also taking an unusually long time.
PowerShell / Azure CLI troubleshooting already attempted
I first attempted to remove the old domain using Azure PowerShell:
Remove-AzStaticWebAppCustomDomain `
-ResourceGroupName "<resource-group>" `
-Name "<static-web-app>" `
-DomainName "<custom-domain>" `
-NoWait `
-Confirm:$false
I repeatedly checked the state with:
Get-AzStaticWebAppCustomDomain `
-ResourceGroupName "<resource-group>" `
-Name "<static-web-app>"
The custom domain did not disappear and eventually remained in the Deleting state.
I also inspected the resources using Azure CLI:
az staticwebapp hostname list `
--resource-group "<resource-group>" `
--name "<static-web-app>" `
--output table
The old custom domain reports:
Status: Deleting
with an error similar to:
An unknown error has occurred while adding your custom domain.
Please try again later.
For the replacement Static Web App I retried the custom-domain operation directly through the CLI:
az staticwebapp hostname set `
--resource-group "<resource-group>" `
--name "<replacement-static-web-app>" `
--hostname "<www-custom-domain>" `
--validation-method cname-delegation
The command waits for validation but ultimately returns the domain resource with:
Status: Failed
and:
An unknown error has occurred while adding your custom domain.
Please try again later.
I also confirmed the resulting state with:
az staticwebapp hostname show `
--resource-group "<resource-group>" `
--name "<replacement-static-web-app>" `
--hostname "<www-custom-domain>" `
--output jsonc
Activity Log
I inspected the Azure Activity Log as well.
The custom-domain write operation for the replacement app is accepted by ARM:
Microsoft.Web/staticSites/customdomains/write
Status: Accepted
HTTP status: Accepted
but the asynchronous operation subsequently results in the custom-domain resource entering Failed.
Similarly, deletion of the original Static Web App shows:
Microsoft.Web/staticSites/delete
Status: Accepted
HTTP status: Accepted
but the deletion does not complete.
There are repeated subsequent reads/polls of the original Static Web App, but I do not see a successful completion of the delete operation.
Resource group
I then attempted to delete the entire resource group.
The Static Web Apps are still visible within it when checking with:
az resource list `
--resource-group "<resource-group>" `
--output table
so the resource-group deletion also appears to be waiting on the Static Web Apps resources/backend state.
Why I believe this requires backend intervention
At this point:
DNS resolution is correct.
CNAME validation prerequisites are satisfied.
There are no CAA restrictions.
The operations are accepted by Azure Resource Manager.
The failure occurs asynchronously afterward.
One custom domain is stuck in Deleting.
A second custom domain on a replacement app enters Failed.
Deleting the original Static Web App does not complete.
Deleting the containing resource group also does not complete.
This appears to be a server-side Static Web Apps resource/custom-domain state problem rather than something I can resolve through DNS, the Azure Portal, PowerShell, or Azure CLI.
I do not have a paid Azure technical support plan.
Could a Microsoft moderator please escalate this to the Azure Static Web Apps product/backend team and advise whether the stuck custom-domain/resource state requires server-side cleanup?