简体   繁体   中英

Azure Web Site App with multiple custom domains

I have a web app service set up in Azure. With the default auto generated name it is working fine.

I need to add several custom domain I've purchased. Let's say domain1.com, domain2.com, etc.

I went to my App Service > Custom domains > + Add host > Validated domain1.com succesfuly. I clicked on "Add host name" button, and domain1.com was successfuly added to my Azure Web App.

The thing is that, when I follow all the same steps to add domain2.com, Azure alerts states that domain2.com was successfuly added, but in fact it wasn't added at all.

I tried several times now. It always says it was added, but the second domain name does not appear listed along with the first one.

Any thoughts?

Thank you!!

According to your description, I have mapped multiple custom domains to my web app. It works well, the result as below:

在此处输入图片说明

I suggest you could try another way(use code or powershell) to list your current web app's hostname.

If the hostname has been already set, but the portal doesn't show it, I suggest you firstly refresh your web browser. If this operation is useless, I suggest you could send the feedback to azure support team and delete the hostname by code or powershell. At last, you could try to bind the hostname again.

More details about how to list the hostname and delete the hostname by code(Using azure management fluent api which could be downloaded from Nuget), you could refer to below codes:

Using this way, you need firstly create an Azure Active Directory application and service principal. After you generate the service principal, you could get the applicationid,access key and talentid. More details, you could refer to this article .

  string subscription = "subscriptionid";
            string client = "clientid";
            string key = "clientkey";
            string tenant = "tenantid";

            var credentials = SdkContext.AzureCredentialsFactory.FromServicePrincipal(client,key,tenant,AzureEnvironment.AzureGlobalCloud);

            var azure = Azure
                .Configure()
                .WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic)
                .Authenticate(credentials)
                .WithDefaultSubscription();

            //List the hostname
            var resut = azure.WebApps.GetByResourceGroup("ResourceGroupName", "WebappName").EnabledHostNames; ;



            var app1 = azure.WebApps.GetByResourceGroup("ResourceGroupName", "WebappName");

            //Delete the hostname
            app1 = app1.Update().WithoutHostnameBinding("yourCustomDomain").Apply();

Result: 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM