dstj
dstj

Reputation: 5230

Azure "Conflict: Cannot modify this site because another operation is in progress." error from Powershell command

I keep getting this error on two of my four Azure webapps when trying to run my Powershell script to swap my preprod and prod slots.

The command Start-AzureWebsite -Name $WebSiteName -Slot $SourceSlotName results in the following error:

Conflict: Cannot modify this site because another operation is in progress. Details: Id: b98d4832-5f6b-4bad-9c4e-470a2d0d100c, OperationName: SwapSiteSlots, CreatedTime: 2/1/2016 9:30:54 PM, WebSystemName: websites, SubscriptionName: bd3570da-d430-485a-a83c-d4ef448b865e, WebspaceName: *******EastUSwebspace, SiteName: *******, SlotName: preprod, ServerFarmName: At C:\dev\...\scripts\Swap-AzureWebApp.ps1:18 char:1 + Start-AzureWebsite -Name $WebSiteName -Slot $SourceSlotName + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Start-AzureWebsite], CloudException + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Websites.StartAzureWebsiteCommand

No operation is in progress, but I did Git push to my preprod slot some 30 minutes ago...

It looks likes this question, but it is from Powershell, not visual studio, and I'm trying to start a preprod slot, then swap it.

Upvotes: 7

Views: 11338

Answers (7)

JegorK
JegorK

Reputation: 1

Using Bicep I was deploying multiple hostname bindings with the array syntax.

Adding @batchSize(1) solved the issue.

@batchSize(1)
resource backendDomainBinding 'Microsoft.Web/sites/hostNameBindings@2022-03-01' = [
  ...
]

Upvotes: 0

Mitko Keckaroski
Mitko Keckaroski

Reputation: 1040

For Terraform: add depends on

source "azapi_update_resource" "elastic_web_app_scale" {
  type      = "Microsoft.Web/sites@2022-09-01"
  name      = azurerm_windows_web_app.resourceApp.name
  parent_id = azurerm_resource_group.resource.id
  body = jsonencode({
    properties = {
      siteConfig = {
        minimumElasticInstanceCount = 1  # Always ready instances
        elasticWebAppScaleLimit     = 10 # Maximum scale limit
      }
    }
  })
 depends_on = [azurerm_service_plan.resourceApp]
}

Upvotes: 0

Rachel
Rachel

Reputation: 1294

I got this error when deploying an ARM template with 2 hostNameBindings resources to the same site. Added a dependency to one like below, and resolved.


            "dependsOn": [
                "[resourceId('Microsoft.Web/sites', variables('sites_name'))]",
                "[resourceId('Microsoft.Web/sites/hostNameBindings', variables('sites_name'), variables('defaultHostNameBinding'))]"
            ],

Upvotes: 2

Jaryn
Jaryn

Reputation: 486

I used Pulumi Native to create a webapp resource. I got this error and I waited 4 days according to dstj's answer. It didn't help. I found was is wrong in another way.

  1. Go to: Azure Support
  2. Hit troubleshoot on a resource where you have a problem:enter image description here
  3. Go to Configuration and Management
  4. View details: enter image description here
  5. In my case I got error: enter image description here
  6. As it turn out, the error wasn't related to FUNCTIONS_WORKER_RUNTIME per se. It was missing propety in Pulumi code: Kind = "FunctionApp". At least I got some info that I've got something wrong with my code and the problem is not related with Azure service.

Upvotes: 2

Madushan
Madushan

Reputation: 7468

  • Go to each 'slot' on the portal. (Each slow shows up as a separate app service in your resource group named "appservice-name/slot-name" format)
  • on each 'slot' app service, go to deployment slots blade
  • On the top, click on 'Complete Swap', then select 'Cancel Swap' in the drop down
  • Click 'Cancel Swap'

Only one of these operations will succeed, and others will show the same error.

If you don't see the "Complete Swap" button, you'll just have to wait, think up to one hour.

Once succeeded, wait a few minutes before attempting to deploy/start to app service again.

Upvotes: 1

Shabar
Shabar

Reputation: 2823

I also faced the same issue when try to swap the app from staging to production in CD pipeline. As a solution deleted the staging slot and re deployed.

Then it worked.

Upvotes: 1

dstj
dstj

Reputation: 5230

It resolved itself, sigh. :/

Both of my Webapps that had errors with my scripts now swap without any error (using the same script).

I waited for about 1h...

Upvotes: 5

Related Questions