5
votes

I'm attempting to use PowerShell to assign hosts to an Azure Website instance. I've verified the domain/host I want to add is valid and even went to the Azure portal to verify it identified the new domain as valid. For some reason though, the below script is not setting the HostNames as I believe it's supposed to and when I check after setting a new value to HostNames, it's the exact same as it was before. Can someone tell me what I'm doing wrong in the script?

$newHosts = @("mysite.azurewebsites.net","www.mysite.com")

$result = Get-AzureWebsite -Name mysite | Set-AzureWebsite -HostNames $newHosts

I've abstracted away my real instance and domain names for the example.

1
I actually referenced that question originally and am doing roughly the same thing but it isn't working.James Alexander

1 Answers

4
votes

Turns out you are not supposed to include the azure assigned host name (mysite.azurewebsites.net) and only include your own custom hosts. It doesn't error, it just won't do anything if you include the azure assigned host.