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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With