通过 Azure Powershell 为 Azure 网站设置主机名 [英] Setting Host Names for Azure Websites via Azure Powershell

查看:14
本文介绍了通过 Azure Powershell 为 Azure 网站设置主机名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 PowerShell 将主机分配给 Azure 网站实例.我已经验证了我要添加的域/主机是否有效,甚至去 Azure 门户验证它是否将新域识别为有效.但是由于某种原因,下面的脚本没有像我认为的那样设置 HostNames,当我在为 HostNames 设置新值后检查时,它与以前完全相同.谁能告诉我我在脚本中做错了什么?

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.

推荐答案

原来您不应该包含 azure 分配的主机名 (mysite.azurewebsites.net),而只包含您自己的自定义主机.它不会出错,如果您包含 azure 分配的主机,它就不会做任何事情.

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.

这篇关于通过 Azure Powershell 为 Azure 网站设置主机名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆