Static Web App custom domain stuck in "Deleting" — cannot remove

Théo Mouchabac 60 Reputation points
2026-07-08T07:42:01.1566667+00:00

Hi,

Free tier, West Europe. Added a custom domain (cname-delegation, DNS correct and propagated). Creation failed on Azure's side with:

"An unknown error has occurred while adding your custom domain. Please try again later."

The custom domain has been stuck in "Deleting" for 24h+ and won't clear. Every delete attempt fails:

  • az staticwebapp hostname delete → no effect, stays "Deleting"
  • az resource delete on the resource ID → returns "Operation returned an invalid status 'OK'", stays "Deleting"
  • Delete from the Azure Portal → error
  • Deleting the parent Static Web App (Portal and CLI) → hangs and times out, blocked by this wedged child

An Azure-side failure has left a resource that can't be created, deleted, or re-added — and it also blocks deleting the parent. DNS and setup are correct; the SWA serves fine on its default host. Every self-service removal path I know of is exhausted.

Could someone from the team look into the stuck resource? I can share the subscription and resource IDs privately.

Thanks.

Azure Static Web Apps
Azure Static Web Apps

An Azure service that provides streamlined full-stack web app development.

0 comments No comments

Answer accepted by question author
Saritha Bandaru 665 Reputation points Microsoft External Staff Moderator
2026-07-08T08:07:21.3366667+00:00

Hello @Théo Mouchabac

Welcome to the Microsoft Q&A and thank you for reaching out.

I understand that you’re on the Free tier in West Europe. You attempted to add a custom domain using CNAME delegation (DNS is correctly set up and propagated), but the creation failed with an “unknown error.” The domain has now been stuck in a “Deleting” state for over 24 hours. Attempts to remove it via az staticwebapp hostname delete, az resource delete, the Azure Portal, and even deleting the parent Static Web App all fail or time out. This wedged resource is blocking further operations on the parent app, even though the default hostname works fine.

This is a backend synchronization issue with Static Web Apps custom domains.

Recommended Steps:

  1. Fully clean your DNS records — Remove all CNAME, A/ALIAS, TXT, and any other records associated with the domain. Wait 30–60 minutes for global propagation, then retry the delete.
  2. CLI retry:
       az staticwebapp hostname delete \
         --name <YOUR_SWA_NAME> \
         --resource-group <YOUR_RG> \
         --hostname <yourdomain.com> \
         --yes
    
  3. PowerShell retry loop ( run in Cloud Shell):
       $rg = "<your-resource-group>"
       $name = "<your-static-web-app-name>"
       $domain = "<your-custom-domain.com>"
       $domains = Get-AzStaticWebAppCustomDomain -ResourceGroupName $rg -Name $name
       while ($domains.Name -contains $domain) {
           Remove-AzStaticWebAppCustomDomain -ResourceGroupName $rg -Name $name -DomainName $domain -NoWait -Force
           Write-Host "Delete attempted for $domain..."
           Start-Sleep -Seconds 10
           $domains = Get-AzStaticWebAppCustomDomain -ResourceGroupName $rg -Name $name
       }
       Write-Host "Done!"
    

Please let us know if this helps or need more assistance.

Thanks

Was this answer helpful?

1 person found this answer helpful.

Answer accepted by question author
Senthil kumar 2,410 Reputation points
2026-07-08T07:52:01.78+00:00

Hi @Théo Mouchabac

open your azure power shell and paste 1 command. then replace the names and try.

az staticwebapp list --query "[].{name:name, group:resourceGroup}" -o table
az staticwebapp hostname delete --name YOUR-APP-NAME --resource-group YOUR-RESOURCE-GROUP --hostname yourwebsite.com

try the above command it will delete.

Thanks.

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.