【发布时间】:2020-05-25 19:15:05
【问题描述】:
我正在创建一个名为“CustomerX-app-001”的 Azure Web 应用程序,Azure 在创建 Azure Web 应用程序后创建的默认自定义域是:“Customerx-app-001.azurewebsites.net”。
在我的 arm 模板中,我尝试通过执行以下 2 个解决方案将此默认主机名更改为“Customerx-app.azurewebsites.net”:
在 microsoft.web/sites 的资源块中添加主机名绑定资源
"resources": [
{
"type": "hostNameBindings",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('CustomHostname'), '.azurewebsites.net')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('siteName'))]"
],
"properties": {
"siteName": "[parameters('siteName')]"
}
},
**在外部添加主机名绑定资源作为新资源块**
{
"type": "Microsoft.Web/sites/hostNameBindings",
"apiVersion": "2018-11-01",
"name": "[concat(parameters('siteName'), '/', parameters('CustomHostname'), '.azurewebsites.net')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('siteName'))]"
],
"properties": {
"siteName": "[parameters('siteName')]",
"hostNameType": "Verified"
}
}
CustomHostname 为:“Customerx-app”,站点名称为“Customerx-app-001”
两种解决方案都给了我同样的错误:
"Code": "BadRequest",
"Message": "Too many (2) hostnames in the default DNS zone. Limit is 1.",
"Target": null,
"Details": [
{
"Message": "Too many (2) hostnames in the default DNS zone. Limit is 1."
},
{
"Code": "BadRequest"
},
{
"ErrorEntity": {
"ExtendedCode": "04017",
"MessageTemplate": "Too many ({0}) hostnames in the default DNS zone. Limit is {1}.",
"Parameters": [
"2",
"1"
],
"Code": "BadRequest",
"Message": "Too many (2) hostnames in the default DNS zone. Limit is 1."
}
}
我在这个问题上停留了一段时间,并找出问题发生的原因。 我认为 azure web 应用程序有 1 个您无法更改的默认 DNS 名称,它始终是 web 应用程序的名称。如果需要添加另一个 DNS 名称,则应创建新的 DNS 记录,并且可以将此记录添加到 Web 应用程序。但是解决方案 2 正是这样做的,唯一的区别是 DNS 名称不存在。
有没有人可以在这里帮助我,或指导我正确的方向?
【问题讨论】:
-
下面4c74356b41的答案是正确的。但是您可以通过配置一个名为 Customerx-app 的新 Azure Web 应用程序来完成同样的事情。这将为您提供您正在寻找的 Customerx-app.azurewebsites.net 的域名。
-
好吧,假设应用服务名称可用@RobReagan :)
标签: azure dns azure-web-app-service arm-template azure-dns