4
votes

I have a web application that runs on 1500+ on domain names.

Each page load will run Request.ServerVariables["SERVER_NAME"] to identify which domain name is being used and then return the content based on this domain name.

We are using Azure Websites to run the application.

I would like to be able to programmatically add new domain names when we get new clients, ideally through an API.

1

1 Answers

2
votes

I found the answer:

The ARM API calls would be like below:

https://management.azure.com/subscriptions/{subscriptionID}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Web/sites/{WebSiteName}?api-version=2014-06-01

Content-Type: application/json

{
  "location": "<REGION_NAME>",
  "properties": {
    "hostNames": [
      "*.azurewebsites.net",
      "customdomain1",
      "customdomain2"
    ]
  }
}

<REGION_NAME> - available in ENVIRONMENT variables for the site

The value can also be checked at SCM site https://[websitename].scm.azurewebsites.net/Env