unable to delete custom domain from static web app

Haopeng Huang 11 Reputation points
2022-07-12T11:52:41.587+00:00

Hi,

I created a static web app from Azure and added a custom domain. But I put in the wrong name. When trying to delete the screen shows 'Deleting' with spinning icon for several dates and never complete. can someone help? thanks.

219913-screenshot-2022-07-12-214827.png

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,173 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Rachel Gomez 166 Reputation points
    2022-09-29T10:00:18.35+00:00

    In order to delete a custom domain mapping from your app, your account must have the App Engine Admin role (roles/appengine.appAdmin) or a custom role that contains the appengine.applications.update permission.

    In the Google Cloud console, do the following:

    Go to the Custom Domains tab of the App Engine Settings page.

    Go to the Custom Domains page

    Select the custom domain name and click Delete.

    Alternatively, you can use gcloud commands or the Admin API to delete custom domains.

    Regards,
    Rachel Gomez

    0 comments No comments

  2. Mike Rogers 36 Reputation points
    2022-09-29T12:15:00.847+00:00

    Courtesy of @VenkateshDodda-MSFT

    This script worked for me to remove the custom domain. Warning it can take a while!

       $name = "yourstaticwebapp";  
       $rg = "yourresourcegroup"  
       $remove_me = "yourcustomdomain";  
       $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!";
    
    0 comments No comments

Your answer

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