@Chai Seng Loi Thanks for your swift response you can use the 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!";
Feel free to reach back to me if you have any further queries on this.