Azure VM Stuck in Stopping State – Disk Lease Fix

Server & Cloud Intermediate 👁 14 views 📅 May 25, 2026

When your Azure VM hangs on 'Stopping', it's usually a disk lease conflict. Here's how to break it in three steps, no portal magic needed.

1. Disk Lease Conflict – The Most Common Cause

What's actually happening here is the Azure Disk Lease service locks the OS or data disk during operations like backup snapshots, migration, or scale sets. When the VM tries to stop, it can't release its disk leases cleanly. The VM process keeps running because the lease manager refuses to let go.

You'll see this on Windows Server 2016, 2019, or 2022 VMs with managed disks, especially after an Azure Backup job or a failed snapshot operation. The VM shows 'Stopping' for 15+ minutes, and the portal just spins.

How to fix it – break the lease

Skip the portal. It's useless here. Use Azure CLI or PowerShell.

Option A: Azure CLI

az vm stop --resource-group MyResourceGroup --name MyVM --no-wait
az vm deallocate --resource-group MyResourceGroup --name MyVM

The --no-wait flag forces the command to return immediately. But the real trick is deallocating – that releases all disk leases.

Option B: PowerShell

Stop-AzVM -ResourceGroupName MyResourceGroup -Name MyVM -Force
Remove-AzVM -ResourceGroupName MyResourceGroup -Name MyVM -Force -NoWait

-Force bypasses the guest shutdown and cuts directly to Hyper-V level. The reason step 3 works is Remove-AzVM doesn't wait for lease release.

Option C: Azure Resource Explorer (plan B)

If CLI fails, go to resources.azure.com, navigate to the VM resource, and click Edit. Change the provisioningState from Stopping to Succeeded. Then hit PUT. This bypasses the lease logic entirely. Risky – do this only if you understand the consequences (orphaned disks possible).

After the lease breaks, the VM transitions to Stopped (Deallocated). You'll see the status change within 2-3 minutes.

2. Guest OS Hung Shutdown Process

If the lease fix doesn't work, the problem isn't Azure – it's Windows. The VM's guest agent is waiting for a service or application to close gracefully, but it's stuck.

Common culprits:

  • Windows Update installing and holding the shutdown.
  • A third-party antivirus (Symantec, McAfee) blocking shutdown.
  • SQL Server or Exchange services hanging on database sync.

Fix – force the guest to release

You can't RDP into a VM that's stopping. But you can use the Serial Console (if enabled) or Azure Bastion.

  1. Open Serial Console in the Azure portal.
  2. Hit Enter to get a SAC prompt.
  3. Type shutdown /s /f /t 0. The /f forces all running apps to close without warning.

If Serial Console isn't enabled, you're stuck. Next time, enable it before you run into this mess. For future protection, set the guest agent's shutdown timeout to 30 seconds instead of the default 5 minutes via registry:

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Value: ShutdownTimeout
Type: REG_DWORD
Data: 30000 (milliseconds)

3. Platform-Level Resource Lock

This one's rare but real. Azure Resource Manager (ARM) holds a lock on the VM resource because of an ongoing policy evaluation or a failed operation from a template deployment. The VM sees 'Stopping' but the platform won't release the lock.

You'll notice it because the VM's status stays 'Stopping' even after you run deallocate commands. The portal might show a generic error like 'The operation cannot be performed because the resource is locked.'

Fix – remove the lock

az lock delete --name MyLock --resource-group MyResourceGroup

If you don't know the lock name, list all: az lock list --resource-group MyResourceGroup. The lock is often named LockResource or ReadOnlyLock. Delete it, then retry the deallocate.

After the lock is gone, run az vm deallocate. The VM should transition to Stopped (Deallocated) within a minute.

Quick-Reference Summary

CauseSymptomFix
Disk lease conflictVM stuck 'Stopping' for 15+ mins, no guest activityDeallocate with --force or break lease via ARM Explorer
Guest OS hung shutdownVM stuck, but activity in guest (updates, services)Serial Console > shutdown /s /f /t 0
Platform resource lockVM stuck, operation fails with 'resource is locked'Find and delete the lock via CLI

Was this solution helpful?