Edit

Azure resource move fails because a virtual machine extension is in a failed state

Applies to: ✔️ Windows VMs ✔️ Linux VMs

Summary

This article helps you troubleshoot Azure resource move failures caused by a virtual machine (VM) extension that is in a Failed or Transitioning provisioning state.

Symptoms

When you try to move a VM to a different resource group or subscription, the move validation fails and returns an error message that resembles the following example.

The resource '<vm-name>' has a failed extension '<extension-name>'. 
Resolve the extension provisioning failure before attempting to move this resource.

Or the move appears to succeed, but the VM is inaccessible after the move because an extension that was in a Transitioning state during the move left the VM in an inconsistent configuration.

Cause

Azure Resource Manager (ARM) validates the provisioning state of all VM extensions before it allows a move to proceed. Any extension that isn't in the Succeeded provisioning state blocks the move. This condition includes:

  • Extensions that are stuck in a Failed state after a failed installation or update
  • Extensions that are stuck in a Transitioning or Creating state during an ongoing operation
  • Extensions that lost communication with the VM agent (VMAgentStatusCommunicationError)

Resolution

Step 1: Identify extensions in a failed state

Use the Azure portal, Azure PowerShell, or Azure CLI to list all extensions and their provisioning states.

Follow these steps:

  1. In the Azure portal, go to Virtual machines, and then select your VM.
  2. In the left menu, under Settings, select Extensions + applications.
  3. Review the Status column for each extension. Look for any extension that shows Failed, Transitioning, or Provisioning failed.

For more information, see View available extensions.

Before you move the resources, resolve any extension that shows a state other than Succeeded.

Step 2: Resolve the extension failure

Use the Azure portal, Azure PowerShell, or Azure CLI to apply the method that matches the extension state.

Method A: Force-update the extension from the portal

This method works for most extensions that are in a Failed state. Follow these steps:

  1. In the Azure portal, go to the VM and select Extensions + applications.
  2. Select the failed extension.
  3. Select Uninstall, and wait for the uninstall process to finish.
  4. Select Add, and reinstall the extension from the extension gallery.
  5. Wait for the provisioning state to reach Succeeded before you try the move.

Method B: Force-update the extension

Force-updating a VM extension by removing and reinstalling it by using a command-line tool isn't available in the Azure portal. To force-update extensions programmatically, use Azure PowerShell or Azure CLI.

Method C: If you can't recover the extension, remove it before the move

If the extension isn't required for the move to succeed, use the Azure portal, Azure PowerShell, or Azure CLI to remove it. Then, complete the move and reinstall the extension at the destination.

Follow these steps:

  1. Go to Virtual machines > your VM > Extensions + applications.
  2. Select the extension, and then select Uninstall.

For more information, see Azure VM extensions and features.

Note

Some extensions are required for platform features, such as Azure Monitor, Azure Backup, and Microsoft Defender for Cloud. If you remove these extensions, the related features stop reporting until you reinstall the extension at the destination.

Method D: Extensions stuck in Transitioning

If an extension is stuck in a Transitioning state, a background platform operation might still be running. Do the following:

  1. Wait 15 minutes, and then recheck the provisioning state.
  2. If the state doesn't change, use the Azure portal, Azure PowerShell, or Azure CLI to stop, deallocate, and restart the VM.

Follow these steps:

  1. Go to Virtual machines > your VM.
  2. Select Stop and wait for the VM to deallocate.
  3. Select Start.

For more information, see Azure VM extensions and features.

  1. After a restart, recheck the extension state. The platform cleans up stuck operations during VM restart in most cases.

Step 3: Verify that all extensions are in Succeeded state

After you resolve each failed extension, use the Azure portal, Azure PowerShell, or Azure CLI to verify that all extensions are healthy before you retry the move.

Follow these steps:

  1. In the Azure portal, go to Virtual machines, and then select your VM.
  2. In the menu, in Settings, select Extensions + applications.
  3. Verify that the Status column for every extension shows Provisioning succeeded. If any extension shows a different state, resolve it before you retry the move.

For more information, see View available extensions.

Step 4: Retry the move

When all extensions are in the Succeeded state, retry the move operation. For a full pre-move verification, see Pre-flight checklist for moving Azure VM resources.

Extension-specific notes

The following table summarizes common extension-specific failure causes and notes for handling them.

Extension Common failure cause Notes
MicrosoftMonitoringAgent / AzureMonitorWindowsAgent Workspace key rotation or connectivity loss Remove before move. The Log Analytics workspace connection is reestablished after reinstallation at the destination.
BGInfo Display driver unavailability during move Benign. Remove if it blocks the move. Reinstallation is optional.
IaaSDiagnostics Storage account key change Update the extension settings by using the current storage key before you retry.
CustomScriptExtension Script failure, extension left in Failed state Remove after you verify the script output. Don't reinstall unless the script is needed again.
DependencyAgentWindows Agent version mismatch Update to the latest version. Don't remove because removal breaks VM Insights.

References

Third-party information disclaimer

The third-party products that this article discusses are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, about the performance or reliability of these products.