由于身份不匹配,ARM部署有时会失败

时间:2019-07-25 09:22:13

标签: azure azure-devops azure-web-sites arm-template

我有一个ARM模板,该模板部署具有两个插槽(生产和暂存)的Windows Web App。 该模板与Azure DevOps构建和发布管道集成在一起,并使用 Azure资源组部署任务进行部署。

我遇到的问题是,当模板部署时,管道偶尔会失败,并显示以下错误消息

2019-07-25T07:49:22.3093628Z There were errors in your deployment. Error code: MismatchingResourceIdentityPrincipalId.
2019-07-25T07:49:22.3213510Z ##[error]The principalId '5e7127c4-5a72-49b4-9747-7311e984e1c8' on the resource's Identity property is invalid and must be empty or match the existing principalId of '0471a448-0e77-48cd-b39a-01d8d1f3c5e3'.
2019-07-25T07:49:22.3221635Z ##[error]Task failed while creating or updating the template deployment.

作为参考,这是在ARM模板中配置身份的方式

...

"resources": [{
  "type": "Microsoft.Web/sites",
  "apiVersion": "2016-08-01",
  "name": "myApp",
  "kind": "app",
  "identity": {
    "principalId": "0471a448-0e77-48cd-b39a-01d8d1f3c5e3",
    "tenantId": ".......",
    "type": "SystemAssigned"
},
{
  "type": "Microsoft.Web/sites/slots",
  "apiVersion": "2016-08-01",
  "name": "myApp/Staging",
  "dependsOn": [
    "[resourceId('Microsoft.Web/sites', 'myApp')]"
  ],
  "kind": "app",
  "identity": {
    "principalId": "5e7127c4-5a72-49b4-9747-7311e984e1c8",
    "tenantId": "......",
    "type": "SystemAssigned"
  },
...

0 个答案:

没有答案