7

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?

Sean D'Arcy
  • 211
  • 1
  • 8

4 Answers4

8

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'))]"
],
Erik Steinebach
  • 367
  • 2
  • 14
  • 1
    Thank you! This worked perfectly, but I did miss the fact it needed 3 parameters. I needed to add: "[resourceId('Microsoft.Web/sites/hostNameBindings', parameters('websiteName'), concat(parameters('websiteName'), '.azurewebsites.net'))]" – Karl Gjertsen Apr 23 '20 at 19:10
2

Look like people already notice this issue and trying to fix it. https://status.azure.com/

Azure Status History

Sagar Kulkarni
  • 636
  • 9
  • 24
2

I had the same issue when using the Copy function in order to add multiple Custom Domains. Thanks to David Gnanasekaran's blog I was able to fix this issue.

By default the copy function will execute in parallel. By setting the mode to serial and setting the batchSize to 1 I did not receive any operation is in progress errors.

Here is my piece of ARM template to set the custom domains.

"copy": {
        "name": "hostNameBindingsCopy",
        "count": "[length(parameters('customDomainNames'))]",
        "mode": "Serial",
        "batchSize": 1
      },
      "apiVersion": "[variables('webApiVersion')]",
      "name": "[concat(variables('webAppName'), '/', parameters('customDomainNames')[copyIndex()])]",
      "type": "Microsoft.Web/sites/hostNameBindings",
      "kind": "string",
      "location": "[resourceGroup().location]",
      "condition": "[greater(length(parameters('customDomainNames')), 0)]",
      "dependsOn": [
        "[resourceId('Microsoft.Web/sites', variables('webAppName'))]"
      ],
      "properties": {
        "customHostNameDnsRecordType": "CName",
        "hostNameType": "Verified",
        "siteName": "parameters('webAppName')"
      }
1

This question and answer was useful in troubleshooting an issue I was having deploying multiple custom domains with Bicep. In my case, I was looping through an array of custom domains to create the necessary resources. The problem is, that bicep loops deploy resources in parallel by default. There is however a useful annotation @batchSize(1) that you can place on the line above a looped module or resource that will cause the loop to run sequentially. This solved the issue for me.

renrutsirhc
  • 145
  • 2
  • 10