My custom domain will not delete

Eric Beiler 5 Reputation points


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?

User's image

Thank you!

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

2 answers

Sort by: Most helpful
  1. Eric Beiler 5 Reputation points

    So it looks like the custom domain finally deleted through the script after several tries.

    1 person found this answer helpful.

  2. SnehaAgrawal-MSFT 20,241 Reputation points

    @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 = "";  
    $domains = Get-AzStaticWebAppCustomDomain -ResourceGroupName $rg -Name $name;  
    $len = $domains.Length;  
    while($len -eq $domains.Length){  
            foreach($item in $domains){  
                if($ -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-

    Hope this helps, Let us know.