Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 930
James Alexander Avatar asked Sep 29 '22 01:09

James Alexander


1 Answers

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.

like image 52
James Alexander Avatar answered Oct 05 '22 06:10

James Alexander