We are deploying a Sitecore web application via CI/CD in Octopus to an Azure Staging slot.

The deployment randomly fails with the following error:

 New-AzureRMWebAppSlot : Cannot acquire exclusive lock to create, update or  
 At C:\Octopus\Work\20180727035133-565589-870\Script.ps1:5 char:1 
 + New-AzureRMWebAppSlot -Name TestCM -Slot Staging -ResourceGroupNam ... 
 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
 + CategoryInfo          : CloseError: (:) [New-AzureRmWebAppSlot], CloudException 
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.WebApps.Cmdlets.DeploymentSlots.NewAzureWebAppSlotCmdlet 
The remote script failed with exit code 1 
The action Create and Deploy Staging Slot CM on the Octopus Server failed 

The error does not always occur.

I followed microsoft's docs on checking for locks in Azure Portal and none are showing up.

How do I fix (or prevented) this issue ?

closed as off-topic by Mark Gibbons, Dan Sinclair, Amitabh Vyas, Peter Procházka, Bartłomiej Mucha Nov 7 '18 at 14:45

  • This question does not appear to be about Sitecore CMS and multichannel marketing software, within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Did you stop staging slot before deployment? We use VSTS to do this and never had such issues. We stop, deploy and start staging slot and swap. – Bartłomiej Mucha Jul 27 '18 at 9:53
  • I forgot, after stopping slot we have "Wait" step set to 60 seconds. Sometimes slot is not fully stopped even the stop command returns. – Bartłomiej Mucha Jul 27 '18 at 10:03
  • Someone else mentioned this to me and I confirmed that the staging slots was stopped before retrying (waited 5 minutes between attempts). The same issue persisted. I also tried stopping the main web app as well as all slots and still the same issue. The lock seems to be persisting in the background for a number of hours. – TomT Jul 29 '18 at 10:16
  • 4
    I'm voting to close this question as off-topic because it is not a question about sitecore – Mark Gibbons Nov 7 '18 at 10:26
  • Other Sitecore devs do seem to be hitting this issue. Other questions within the Azure tag along the same lines. e.g. sitecore.stackexchange.com/questions/7816/… – TomT Nov 7 '18 at 22:32

Browse other questions tagged or ask your own question.