将 cloninginfo 属性 添加到 arm 模板部署槽资源中断了在部署槽上设置用户定义的托管标识

Adding cloninginfo property to arm template deployment slot resource breaks setting user defined managed identity on deployment slot

我发现了一些东西,我认为这是 ARM 模板中的一个错误。

我有一个用于创建应用服务和部署槽的模板。现在我想确保部署槽从父应用程序服务克隆应用程序设置,所以我使用 cloningInfo 节点为克隆设置源应用程序服务。但是一旦我这样做了,在部署槽上设置用户定义的托管身份就停止工作了,而它存在于模板中。我的(简化)模板:

resources: [
{
      "apiVersion": "2018-11-01",
      "name": "MyAppservice",
      "type": "Microsoft.Web/sites",
      "location": "[resourceGroup().location]",
      "kind": "app",
      "identity": {
        "type": "userAssigned",
        "userAssignedIdentities": {
          "<some id>": {}
         }
      }
},

{
  "type": "Microsoft.Web/sites/slots",
  "apiVersion": "2018-11-01",
  "name": "['MyAppservice','/secondslot')]",
  "location": "[resourceGroup().location]",
  "dependsOn": [
    "[resourceId('Microsoft.Web/sites', 'MyAppservice')]"
  ],
  "kind": "app",
  "identity": {
    "type": "userAssigned",
    "userAssignedIdentities": {
      "<some id>": {}
    },
   "properties": {
      "cloningInfo": {
      "sourceWebAppId": "[resourceId('Microsoft.Web/sites', 'MyAppservice')]"
    }
   }
  }

]

因此,当我使用上述基础部署模板时,用户定义的托管身份未在部署槽中设置。当我删除 cloningInfo 属性 时,设置了用户定义的托管标识,但未复制父应用服务的应用设置。

我是不是做错了什么或者这是一个错误?我知道(出于某种原因)使用定义的托管标识不会复制到部署槽是设计使然,因此我假设在从现有应用程序服务克隆时手动设置它时,克隆设置不会覆盖用户定义的托管身份。

我们承认这是当前的一个问题,如果设置了克隆信息,它会忽略其余的有效负载。在修复之前,解决方法是进行 2 个单独的更新(一个用于克隆,一个用于 MSI)。