ARM 模板部署为流量管理器生成冲突错误

问题描述 投票:0回答:2

我参与了一个通过模板进行 ARM 部署的项目,该项目已经运行了几个月,直到最近一切都正常运行:

Successful deployments

但是随后,某些事情发生了变化,大多数(但不是全部)部署开始失败:

Unsuccessful deployments

报错为:

{  
 "code": "Conflict",
 "message": "Conflicting changes were detected when processing the request. This can happen when there are multiple requests trying to update one profile at the same time. Please retry your request."
}

然而,这是当时唯一正在运行的部署。现在,我已经通过向流量管理器资源添加

dependsOn
来设法避免这个问题:

{
  "apiVersion": "2015-11-01",
  "type": "Microsoft.Network/trafficManagerProfiles",
  "name": "[variables('traffic-manager-name')]",
  "location": "global",
  "properties": {
    "profileStatus": "Enabled",
    "trafficRoutingMethod": "Priority",
    "dnsConfig": {
      "relativeName": "[variables('traffic-manager-name')]",
      "ttl": 30
    },
    "monitorConfig": {
      "protocol": "HTTP",
      "port": 80,
      "path": "/"
    },
    "endpoints": [
      {
        "name": "[variables('traffic-manager-endpoint')]",
        "type": "Microsoft.Network/trafficManagerProfiles/azureEndpoints",
        "properties": {
          "endpointStatus": "Enabled",
          "targetResourceId": "[resourceId('Microsoft.Web/sites', variables('web-app-name'))]",
          "target": "[concat(variables('web-app-name'), '.azurewebsites.net')]",
          "weight": 1,
          "priority": 1,
          "endpointLocation": "[resourceGroup().location]"
        }
      }
    ]
  },
  "dependsOn": [
    "[resourceId('Microsoft.Web/Sites', variables('web-app-name'))]"
  ]
}

但我担心这样做可能只是混淆了仍然需要解决的真正问题。如果有人知道更多有关该错误的信息,或者为什么它可能会突然发生,我很想知道!

azure-resource-manager azure-deployment azure-rm-template
2个回答
0
投票

使用 ARM 模板部署流量管理器时,返回 409 冲突错误“处理请求时检测到冲突的更改。当有多个请求同时尝试更新一个配置文件时,可能会发生这种情况。请重试您的请求.”,因为 ARM 模板部署旨在创建新资源,因此它使用 PUT 请求。如果流量管理器配置文件已存在,则当模板进行会更改或影响现有配置文件的更改时,它将返回。部署之前,创建了流量管理器,因此模板因冲突错误而失败。要解决或克服该问题,请确保在 ARM 部署之前未创建 TM 配置文件。然后重新测试部署。

希望这有帮助!干杯!


0
投票

你找到答案了吗?

© www.soinside.com 2019 - 2024. All rights reserved.