将流量管理器部署到具有自定义域的Web应用程序的ARM模板失败

时间:2018-04-06 16:43:03

标签: azure-web-sites arm-template azure-traffic-manager

我有一个ARM模板和参数文件here,我试图用它来创建一个功能网络应用程序,包含流量管理器和自定义主机名。它目前只是一个网络应用程序。但是,一旦我开始工作,计划就是打破这个模板,并根据环境将其他网络应用添加到链接模板。

我在尝试部署它时遇到错误(通过powershell)。

5:13:13 PM - Resource Microsoft.Web/sites/hostNameBindings 'siteapidev2-lbxvta4fkayk6-site-0/domain-dev-tm.trafficmanager.net' failed with message '{ "Code": "Conflict", "Message": "Cannot modify this site because another operation is in progress. Details: Id: 9be2181b-16c3-4141-a4fa-80bc331d5f3c, OperationName: RegisterTrafficManagerProfile, CreatedTime: 4/6/2018 4:13:07 PM, RequestId: 1a1debb6-bba2-487d-a2cf-b49f671f8a52, EntityType: 1", "Target": null, "Details": [ { "Message": "Cannot modify this site because another operation is in progress. Details: Id: 9be2181b-16c3-4141-a4fa-80bc331d5f3c, OperationName: RegisterTrafficManagerProfile, CreatedTime: 4/6/2018 4:13:07 PM, RequestId: 1a1debb6-bba2-487d-a2cf-b49f671f8a52, EntityType: 1" }, { "Code": "Conflict" }, { "ErrorEntity": { "ExtendedCode": "59203", "MessageTemplate": "Cannot modify this site because another operation is in progress. Details: {0}", "Parameters": [ "Id: 9be2181b-16c3-4141-a4fa-80bc331d5f3c, OperationName: RegisterTrafficManagerProfile, CreatedTime: 4/6/2018 4:13:07 PM, RequestId: 1a1debb6-bba2-487d-a2cf-b49f671f8a52, EntityType: 1" ], "Code": "Conflict", "Message": "Cannot modify this site because another operation is in progress. Details: Id: 9be2181b-16c3-4141-a4fa-80bc331d5f3c, OperationName: RegisterTrafficManagerProfile, CreatedTime: 4/6/2018 4:13:07 PM, RequestId: 1a1debb6-bba2-487d-a2cf-b49f671f8a52, EntityType: 1" } } ], "Innererror": null }' At D:\path\deploy.ps1:110 char:5 + New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGr ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

我认为此错误是由流量管理器无法完成导致的,因为它所依赖的网站尚未完成。

我之前收到的另一个错误看起来很像这样: awverify error

在我看来,这似乎是因为Web应用程序创建过程试图添加未绑定的自定义域名。之所以发生这种情况,是因为在网络应用创建时,流量管理器进程尚未将其作为CNAME的DNS主机名插入到网络应用中。

这导致我在trafficManager的hostNameBinding和流量管理器配置文件本身之间创建依赖关系(参见模板的第349行)。

因此似乎存在某种依赖循环。什么是实现这一目标的最佳方式:

  1. 创建网络应用
  2. 创建流量管理员个人资料并将CNAME添加到网络应用
  3. 添加自定义域名的网络应用绑定。我已经在自定义域中添加了一个指向流量管理器配置文件的CNAME记录。
  4. 如果我手动创建webapp和流量管理器,我可以执行这些步骤。但是,当我从门户网站下载模板时,它无法正常工作。

    我还发现如果我从模板中删除第349行并运行模板两次,第一次生成错误,第二次成功。

    感谢

    我把头发撕掉了。

1 个答案:

答案 0 :(得分:0)

有点晚了,但是供以后参考。

我已经看到在单个App Service中使用多个hostnameBindings时会发生此错误。据我所知,您正在向App Service部署3种不同的hostnameBinding资源(第320至367行)。

为了解决该问题,您应该使用SO answer中所述的copy函数。

当然,模板中可能还存在其他错误,但这对我来说是最明显的,并且肯定会有所作为!