我正在创建一个名为“CustomerX-app-001”的 Azure Web 应用程序,Azure 在创建 Azure Web 应用程序后创建的默认自定义域是:“Customerx-app-001.azurewebsites.net”。
在我的手臂模板中,我尝试通过执行以下两个解决方案将此默认主机名更改为“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 名称不存在。
有没有人可以在这里帮助我,或指导我正确的方向?