问题描述
我想在两个不同的环境中创建相同命名的插槽。不同之处在于在 Integration
上我想启用自动交换。我尝试使用 condition
执行此操作,如下所示,但这没有通过验证,因为我有两个同名的资源。
"resources": [
{
"condition": "[equals(parameters('env'),'Integration')]","apiVersion": "2018-11-01","name": "staging",<----------------- HERE
"type": "slots","location": "[resourceGroup().location]","identity": {
"type": "SystemAssigned"
},"dependsOn": [
"[variables('webApiWebSiteName')]"
],"properties": {
"siteConfig": {
"autoSwapSlotName": "production" <----------------- only difference
}
}
},{
"condition": "[equals(parameters('env'),'Production')]","properties": {
}
}
]
解决方法
您只能创建具有唯一名称 across all of Azure 的网络应用程序,因为它会生成指向您网站的端点。
关于插槽,您也可以查看链接中的表格。它们可以在不同站点(应用服务)之间使用相同的名称,但不能在一个站点下使用相同的名称。不确定你说的环境,如果是开发环境和暂存环境,这两个槽还是在一个应用服务下。