4

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.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Marcus
  • 675
  • 2
  • 8
  • 24

1 Answers1

2

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

BenV
  • 12,052
  • 13
  • 64
  • 92
Marcus
  • 675
  • 2
  • 8
  • 24