2
votes

I've got an ARM template and parameter file here, that I'm trying to use to create a function web app, with traffic manager and custom hostname. It's only a single web app at the moment.

However, once I get this working, the plan is to break up this template and add additional web apps to linked templates depending on the environment.

I get the error when trying to deploy it (via 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

I think this error is caused by the Traffic Manager not being able to complete because the web site on which it depends has not yet complete either.

I was previously getting another error which looks a lot like this: awverify error

This seems to me to be occurring because the web app creation process was trying to add a custom domain name to which it was not bound. This was happening because at the web app creation time, the traffic manager process had not yet inserted it's DNS hostname as a CNAME to the web app.

This caused me to create a dependency between hostNameBinding for the trafficManager and the traffic manager profile itself (see line 349 of the template).

There therefore seems to be some kind of dependency loop. What's the best way to accomplish this:

  1. Create the web app
  2. Create the traffic manager profile and add CNAME to the web app
  3. Add a web app binding to the custom domain name. I have already in my custom domain added a CNAME record pointing back to traffic manager profile.

I am able to carry out these steps if I create the webapp and traffic manager manually. However, when I download the template from the portal, it doesn't work.

I've also discovered that if I remove line 349 from the template and run the template twice, first time generates an error, second time is successful.

1
All I can suggest to anyone that see this question is to try and play around with the dependsOn attribute in the template. I managed to get things to work intermittently (i.e. retry the same template 5 times and the last time it was successful for some reason!). I raised a Microsoft support incident about this issue. Hope to get a response soon.ossentoo

1 Answers

0
votes

A bit late, but for future reference.

I've seen this error occur when using multiple hostnameBindings for a single App Service. From what I can see, you are deploying 3 different hostnameBinding resources to the App Service (line 320 to 367).

In order to overcome the issue you should use the copy function as explained in this SO answer.

Of course, there might be other things wrong in the template also, but this one is the most obvious to me and will surely make a difference!