How do i remove or delete a assigned custom domain in Azure Web App?

Colin Matthias 21 Reputation points
2022-08-25T15:52:48.057+00:00

I recently tested Azure Web Apps with Traffic Manager when accessing the web app via the traffic manager DNS name i got a blue screen in the browser 404 error and it said i need to configure a custom domain please see attached. I then assigned to custom domain for the web App but i now cannot remove the custom domain from the web App any ideas how i can do this?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,335 questions
{count} votes

Accepted answer
  1. SnehaAgrawal-MSFT 20,241 Reputation points
    2022-08-26T14:00:47.077+00:00

    Thanks for reaching here! If I have understood right you want to remove your assigned custom domain name if so you may refer to below steps:

    Using Azure portal:

    If your hostname has SSL bindings you first need to remove that then delete the hostname.

    Go to web app -> Custom Domains -> App Service Domains -> Click on the domain -> Delete it.

    235277-screenshot-2022-08-26-192559.png

    Use below PowerShell script to Remove all custom domain:

    $webApp = Get-AzWebApp -ResourceGroupName "<Resource-Group-Name>" -Name "<App-Name>";  
    $webApp.HostNames.Clear();  
    $webApp.Hostnames.Add($webApp.DefaultHostName);  
    Set-AzWebApp `  
      -ResourceGroupName "<Resource-Group-Name>" `  
      -Name <App-Name> `  
      -HostNames $webApp.HostNames;  
    

    This will remove all custom hostnames and leave only the default one.

    If you want to remove a specific hostname for the collection you could use:

    $webApp.HostNames.Remove("your_hostname_goes_here")  
    

    Please let us know if further query or issue remains.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful