I support an existing Azure web-app that is linked to a custom domain. App Service Certificates are used to for the Web Apps TLS settings and bind to the custom domain.
There is now a requirement to register a new custom domain (using Azure is OK), un-link the exsiting domain and config-link the new custom domain to the existing Azure web-app.
I am trying to figure out a logical ordering of steps to achieve this. The Azure web-app is live however over the weekend the web-app is not in use. There are 3 non-production environments to test out the sequence of steps to ensure the web-site still remains accessible after the change.
Can you help with the sequence of steps to achieve the above?
Regards
There are 2 ways to add a new custom domain in the Azure Web Application:
Way 1: A) Remove the existing Custom Domain:
If your hostname has SSL bindings, remove them first and then delete the hostname.
Using PowerShell: If the web application having multiple custom domain names/
$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
The above cmdlets will remove the all custom hostnames except the default one.
To remove a specific hostname for the collection:
$webApp.HostNames.Remove("your_hostname_goes_here")
To know the limitations in deleting a custom domain name, please refer this MS Doc.
B) Adding a New Custom Domain:
<Your App Service>
> Custom domains - Copy CDV ID
and IP address.The above documentation also contains the information of securing the custom DNS with a TLS/SSL binding and migration of domain from one to another App.
Way 2: Using Deployment Slots
az webapp config hostname add [--hostname]
[--ids]
[--resource-group]
[--slot]
[--subscription]
[--webapp-name]
For more information, you can refer this MS Doc of Set up Deployment Slot Environments in Azure App Service and an Stackify article of azure deployment slots.