1
votes

I have an Azure Web App with lots of custom domains (50+).

I'm setting up a BCDR clone of the app, but when using the Azure Web App "Clone" tool, Custom domains are explicitly excluded from the cloning process.

Is there a more automated way of copying all the custom domains (as well as SSL certificates) over to another Web App (in a different region, if it matters)?

Ideally, I'd like to be able to sync the two Web Apps up periodically, as I often add new domains (it's a multi-tenant site).

Thanks!

1

1 Answers

0
votes

You could assign a custom domain to a web app using PowerShell and bind a custom SSL certificate to a web app using PowerShell. Also, you will find the same function commands in Azure CLI.

You could find the sample code in that links.

# Add a custom domain name to the web app. 
Set-AzWebApp -Name $webappname -ResourceGroupName $webappname `
-HostNames @($fqdn,"$webappname.azurewebsites.net")

# Upload and bind the SSL certificate to the web app.
New-AzWebAppSSLBinding -WebAppName $webappname -ResourceGroupName $webappname -Name $fqdn `
-CertificateFilePath $pfxPath -CertificatePassword $pfxPassword -SslState SniEnabled

Another option is to use ARM template. You could export the template from your app service---settings, then edit some codes to meet your requirements to deploy the new web app service with custom domains. For more references, you could see Azure Resource Manager templates for App Service