【问题标题】:ARM template deployment of Microsoft.Web/sites/hostNameBindings keep giving me conflict errorMicrosoft.Web/sites/hostNameBindings 的 ARM 模板部署不断给我冲突错误
【发布时间】:2021-05-14 00:46:07
【问题描述】:

我正在尝试部署应用服务,但部署失败 Microsoft.Web/sites/hostNameBindings

消息:无法修改此站点,因为正在进行另一操作。 OperationName:RegisterTrafficManagerProfile,CreatedTime:5/14/2021 12:03:05 AM,,EntityType:1。 我间歇性地收到此错误。

我阅读了堆栈溢出答案之一,似乎流量管理器导致异步 hostNameBindings 迭代操作出现问题。 这可以通过使用 "mode" 指定同步副本来解决: "serial" mode with "batchsize": 1,

我尝试了这个解决方案,但我仍然得到这个冲突错误,不知道为什么?有人在同步副本后遇到同样的问题吗?

最近我们对模板进行了更改,以将流量管理器端点部署为单独的资源,这导致流程花费更长的时间,流程时间的增加是否会导致冲突?失败的其他原因是什么?

对此的任何见解都会有所帮助。我对使用应用服务臂模板很陌生

编辑我当前的手臂模板我只是显示主机名绑定和流量管理器配置文件 {

 "type": "Microsoft.Web/sites/hostNameBindings",
  "apiVersion": "2016-03-01",
  "copy": {
    "name": "hostNameBindingLoop",
    "mode": "serial",
    "batchSize": 1,
    "count": "[length(variables('appServicePlanLocations'))]"
  },
  "name": "[concat(variables('websiteName') [copyIndex()], '/', parameters('cName'))]",
  "location": "[vaiables('appServicePlanLocations')[copyIndex()]]",
  "properties": {
    "sslState": "SniEnabled",
    "thumbprint": "[reference(resourceId('Microsoft.Web/certificates', variables('xyzCertName')[copyIndex()])).Thumbprint]"
  },
  "dependsOn": [
    "[concat('Microsoft.Web/certificates/',variables('xyzCertName'[copyIndex()])]",
  ],
},
{
   "type": "Microsoft.Network/trafficManagerProfiles",
   "apiVersion": "2018-08-01",
    "name": "[parameters('trafficManagerName')]",
    "location": "global",
   "properties": {
    "profileStatus": "Enabled",
    "trafficRoutingMethod":  "Performance",
    "dnsConfig": {
      "relativeName": "[parameters('uniqueDnsName')]",
      "ttl": 300
    },
    "monitorConfig": {
      "protocol": "HTTPS",
      "port": 443,
      "path": "/"
    }
    "endpoints": [],
    "trafficViewEnrollmentStatus": "Disabled
  }

},

{
  "type": "Microsoft.Network/trafficManagerProfiles/azureEndpoints",
  "apiVersion": "2018-08-01",
  "name": "[concat(variables('trafficManager'),'/',variables('websiteName'),  copyIndex(1))]",
  "location": "global",
  "dependsOn": [
    "[concat('Microsoft.Network/trafficManagerProfiles/', variables('trafficManager'))]"
  ],
  "properties": {
    "targetResourceId": "[concat('Microsoft.Web/sites/',variables('websiteName')[copyIndex()])]",'  
    "endpointStatus": "Enabled",
    "endpointLocation": "[vaiables('appServicePlanLocations')[copyIndex()]]"
      },
 "copy": {
    "name": "trafficManagerEndPointLoop",
    "mode": "serial",
    "batchSize": 1,
    "count": "[length(variables('appServicePlanLocations'))]"
  }
}

【问题讨论】:

    标签: azure azure-web-app-service arm-template cname azure-traffic-manager


    【解决方案1】:

    我假设您希望创建一个 Azure 流量管理器配置文件,并在其背后提供应用服务。 Here 是供您参考的模板。这会在您的 Azure 应用服务的自定义域设置中自动预配自定义域 xxxx.trafficmanager.net

    {
      "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
      "contentVersion": "1.0.0.0",
      "parameters": {
        "uniqueDnsName": {
          "type": "string",
          "metadata": {
            "description": "Relative DNS name for the traffic manager profile, resulting FQDN will be <uniqueDnsName>.trafficmanager.net, must be globally unique."
          }
        },
        "uniqueDnsNameForWebApp": {
          "type": "string",
          "metadata": {
            "description": "Relative DNS name for the WebApps, must be globally unique.  An index will be appended for each Web App."
          }
        },
        "webServerName": {
          "type": "string",
          "metadata": {
            "description": "Name of the App Service Plan that is being created"
          }
        },
        "location": {
          "type": "string",
          "defaultValue": "[resourceGroup().location]"
        },
        "trafficManagerName": {
          "type": "string",
          "metadata": {
            "description": "Name of the trafficManager being created"
          }
        }
      },
    
      "variables": {},
    
      "resources": [
        {
          "type": "Microsoft.Web/serverfarms",
          "apiVersion": "2019-08-01",
          "name": "[parameters('webServerName')]",
          "location": "[parameters('location')]",
          "sku": {
            "name": "S1",
            "tier": "Standard"
          }
        },
        {
          "type": "Microsoft.Web/sites",
          "apiVersion": "2019-08-01",
          "name": "[parameters('uniqueDnsNameForWebApp')]",
          "location": "[parameters('location')]",
          "dependsOn": [
            "[resourceId('Microsoft.Web/serverfarms/',parameters('webServerName'))]"
    
          ],
          "properties": {
            "serverFarmId": "[parameters('webServerName')]"
          }
        },
        {
          "type": "Microsoft.Network/trafficManagerProfiles",
          "apiVersion": "2018-08-01",
          "name": "[parameters('trafficManagerName')]",
          "location": "global",
          "properties": {
            "profileStatus": "Enabled",
            "trafficRoutingMethod": "Priority",
            "dnsConfig": {
              "relativeName": "[parameters('uniqueDnsName')]",
              "ttl": 30
            },
            "monitorConfig": {
              "protocol": "HTTPS",
              "port": 443,
              "path": "/"
            }
          }
        },
        {
          "type": "Microsoft.Network/trafficManagerProfiles/azureEndpoints",
          "apiVersion": "2018-08-01",
          "name": "[concat(parameters('trafficManagerName'),'/',parameters('uniqueDnsNameForWebApp'))]",
          "location": "global",
          "dependsOn": [
            "[resourceId('Microsoft.Network/trafficManagerProfiles/',parameters('trafficManagerName'))]",
            "[resourceId('Microsoft.Web/sites/',parameters('uniqueDnsNameForWebApp'))]"
          ],
          "properties": {
            "targetResourceId": "[resourceId('Microsoft.Web/sites/', parameters('uniqueDnsNameForWebApp'))]",
            "endpointStatus": "Enabled"
          }
        }
      ]
    }
    

    【讨论】:

    • 我添加了当前模板的一部分,它给了我错误,它包括“Microsoft.Network/trafficManagerProfiles”“Microsoft.Network/trafficManagerProfiles/azureEndpoints”资源以及“Microsoft.Web/sites/主机名绑定”。不知道我哪里错了
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-14
    • 2020-12-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多