Static Web Apps: Can't remove, can't delete.

_kjkent 21 Reputation points
2022-09-26T09:58:31.5+00:00

Hi there,

Having some issues with Static Web Apps the last two days. I was trying to add a custom domain which was repeatedly failing with a misleading/non-descriptive error: "domainName is invalid. The domain name given was not found." However, after some digging I found that the same domain name was present in another SWA in our tenancy.

Prior to this, I deleted the SWA giving the error thinking that re-provisioning the resource may move the bug. But the resource won't delete. It sits for a while, gives a "deleted successfully" response, then remains in the resource group/tenancy. The same happens if you try to delete individual custom domains from the resource.

Thinking this resource was bugged, I instead chose to delete the domain from the other offending SWA. Same deal there -- can't delete the resource, can't remove the custom domain. It thinks, says it's done, then nothing.

I would like to report this blocking bug, but I'm not sure how without paying for a support package. I even had to agree to marketing emails to join these forums :(
244813-microsoftteams-image.png

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,178 questions
0 comments No comments
{count} votes

Accepted answer
  1. VenkateshDodda-MSFT 25,111 Reputation points Microsoft Employee Moderator
    2022-09-27T08:56:57.237+00:00

    @_kjkent Thank you for reaching out to Microsoft Q&A. Sorry to hear about the Q&A platform issues, I have reported/relayed this to our Q&A platform team.

    Based on the shared information I have understood that you are trying to add the custom domain to a new static webapp, and it is failing since this domain is already part of another static webapp and also you have tried to deleted that new static web app.

    • After the delete operation is successful are you still seeing those resources under the resource group? If yes, have you tried logging into portal from different browser do you observe the same behavior?
    • Which method you are using to delete the static web app through Azure CLI bash cmdlets/PowerShell cmdlets or through static web apps Rest API?

    custom domain binding operations should take normally around 20 minutes. Overall, TXT record validation and DNS record propagation will affect this amount of time but around 20 minutes should be the expected norm. If the custom domain deletion operation is failing or taking longer than expected, the workaround is to re-try the delete operation until get succeeded using the below PowerShell script.

    $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!";  
    

    If you want to delete the static web app you refer to brtrach-msft answer using azure resource explorer as mentioned in this similar thread Static Web App custom domain does not delete - Microsoft Q&A

    Feel free to reach back to me if you have any further questions on this.


0 additional answers

Sort by: Most helpful

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.