James Alexander
James Alexander

Reputation: 6302

Setting Host Names for Azure Websites via Azure Powershell

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.

Upvotes: 5

Views: 1828

Answers (1)

James Alexander
James Alexander

Reputation: 6302

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.

Upvotes: 4

Related Questions