我正在创建一个名称为“ 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名称不存在。
有没有人可以在这里帮助我,或向正确的方向引导我?
您只能使用一个*.azurewebsites.net
DNS名称,并且它是自动生成的。您只能在您拥有的域上添加dns名称(并且您必须首先对其进行验证)。