Search code examples
jsonazureazure-devopsazure-rm-template

Deploying ARM template with 2 hostnamebindings returns conflict error can't modify because another operation is in progress


I am trying to deploy an ARM template through Azure DevOps. I've tried doing a test deployment (Test-AzResourceGroupDeployment) through PowerShell without any issues.

This issue has persisted for several weeks, and i've read some posts stating it dissapeared after a few hours or after a day, however this has not been the case for me.

In Azure DevOps my build is succeeding just fine. But when i try to create a release through my release pipeline using the resource "Azure resource group deployment" it will fail stating the error:

"Code": "Conflict",
  "Message": "Cannot modify this site because another operation is in progress. Details: Id: 4f18af87-8848-4df5-82f0-ec6be47fb599, OperationName: Update, CreatedTime: 9/27/2019 8:55:26 AM, RequestId: 691b5183-aa8b-4a38-8891-36906a5e2d20, EntityType: 3"

Update

I have later noticed that the error surfaces when trying to deploy my hostNameBindings for the site.

I have 2 different hostNameBindings in my template which causes the failure.

It fails apparently because it tries to deploy both of them at the same time, though i am not aware of an apparent fix for this so any help would still be appreciated!

I tried to use the copy function but as far as i know that will make an exact copy for both hostNameBindings which is not what i need. first of all they have different names and properties, anyone got a fix for this?


Solution

  • Make the one hostNameBindings depend on the other host name binding. Then they will be executed 1 after another and you should not get the same error message.

    "dependsOn": [
      "[resourceId('Microsoft.Web/sites/', variables('websitename'))]",
      "[resourceId('Microsoft.Web/sites/hostNameBindings/',variables('websitename'), variables('firstbindingame-aftertheslash-sowithoutthewebsitename'))]"
    ],