So it looks like the custom domain finally deleted through the script after several tries.
My custom domain will not delete
Hello,
I have tried deleting my custom domain twice now. It just remains there for hours on Deleting and never completes. What can I do to fix this?
Thank you!
2 answers
Sort by: Most helpful
-
-
SnehaAgrawal-MSFT 21,771 Reputation points
2024-06-24T11:09:26.28+00:00 @Eric Beiler thanks for asking question- Try using below PowerShell script to delete custom domain of static web app this script will retry the delete operation until it gets succeeded.
You can run this script from cloud shell in the portal if you don't have PowerShell locally installed.
$name = "<static-webapp>"; $remove_me = "sub.domain.com"; $domains = Get-AzStaticWebAppCustomDomain -ResourceGroupName $rg -Name $name; $len = $domains.Length; while($len -eq $domains.Length){ foreach($item in $domains){ if($item.name -eq $remove_me){ $err = Remove-AzStaticWebAppCustomDomain -DomainName $remove_me -Name $name -ResourceGroupName $rg -NoWait; $domains = Get-AzStaticWebAppCustomDomain -ResourceGroupName $rg -Name $name; if($domains.Length -gt 0){ Write-Host "$remove_me still exists. Retrying..."; Start-Sleep -s 10; } } } } Write-Host "Success!";
You may also refer to similar thread answered by brtrach- https://learn.microsoft.com/en-us/answers/questions/989954/static-web-app-custom-domain-does-not-delete
Hope this helps, Let us know.