My custom domain will not delete

Eric Beiler 5 Reputation points
2024-06-23T19:35:09.2533333+00:00

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?

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
    2024-06-24T17:11:58.72+00:00

    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
    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.