Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 907
Sean D'Arcy Avatar asked Sep 27 '19 09:09

Sean D'Arcy


People also ask

Is arm template deployment task the same as Azure Resource Group deployment?

I couldn't find a task with "Azure resource group deployment" name. But I found "ARM Template Deployment" task. Since it's settings was similar to "Azure resource group deployment" task, I assumed they are the same, and it might have been changed since the tutorial's date.

Why is my arm template not working in the release pipeline?

According to your description, it appears that you didn't set the correct Artifacts source for the release pipeline. If you are using the published build artifacts from previous build pipeline as the source, then please make sure the ARM template is successfully copied and published to the build artifact.

What does a template deployment error mean?

A template deployment error means that your template syntax has been approved, but an error has occurred while provisioning the resources. TIP: If a template validation error occurs, no deployment record will be available in the history of the resource group deployments– because the deployment never actually started.

How to fix the arm template error in PowerShell?

We could then go fix the ARM template by adding the missing field. You can do the same thing in PowerShell by running the following command to retrieve that activity log entry by correlation ID. Substitute the GUID in this command with the one provided to you in the error message you received.


3 Answers

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'))]"
],
like image 92
Erik Steinebach Avatar answered Oct 16 '22 04:10

Erik Steinebach


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

Azure Status History

like image 26
Sagar Kulkarni Avatar answered Oct 16 '22 03:10

Sagar Kulkarni


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')"
      }
like image 27
Mathijs Vlasveld Avatar answered Oct 16 '22 03:10

Mathijs Vlasveld