MigrationState stuck at Preparing RRS feed

  • Question

  • I wanted to migrate a VM from classic mode to ARM:

    Move-AzureService -Prepare -ServiceName $serviceName -DeploymentName $deploymentName -CreateNewVirtualNetwork

    The operation failed with an error message. Fine, I don't care.

    However, now I can not do anything with my machine. I can not start it because it says:

    Deployment VMName in HostedService CloudServiceName is in the process of being migrated and hence cannot be changed

    When I do this:

    $vmName = "<vm-name>"
    $vm = Get-AzureVM -ServiceName $serviceName -Name $vmName
    $migrationState = $vm.VM.MigrationState

    I get : Preparing

    It is stuck. How can I cancel the migration process ? 

    Thank you

    Friday, July 8, 2016 8:55 PM

All replies

  • Hello,

    Thank you for posting here!

    Check the configuration for the prepared resources by using either PowerShell or the Azure portal.

    If you are not ready for migration and you want to go back to the old state, use the following command.

    Move-AzureService -Abort -ServiceName $serviceName -DeploymentName $deploymentName

    If the prepared configuration looks good, you can move forward and commit the resources by using the following command.

    Move-AzureService -Commit -ServiceName docmigtest1 -DeploymentName docmigtest1

    For more information, kindly refer the link given below:


    Hope this helps.





    If a post answers your question, please click Mark as Answer on that post and Vote as Helpful.

    Saturday, July 9, 2016 5:47 AM
  • When a VM is stuck in Preparing state, the following command gives an error that virtual network needs to be migrated first.

    Move-AzureService -Abort -ServiceName $serviceName -DeploymentName $deploymentName

    Looks like it stuck in some sort of loop.

    Below is the error:

    Move-AzureService : BadRequest: Deployment <<Deployment Name>>in HostedService <<ServiceName>> belongs to Virtual Network
    *******. Please migrate Virtual Network ******to migrate this HostedService

    Any work around to bring the VM out of that Preparing state?

    Tuesday, April 23, 2019 4:05 PM
  • Found the workaround.

    If the VM is stuck in the Preparing state and Move-AzureVM gives error then run the following command to revert to the old state:

    Move-AzureVirtualNetwork -Abort -VirtualNetworkName <<ClassicVirtualNetworkName>>.

    The above command will bring all the VMs along with the Vnet to Old state and one can then resolve the issues and proceed with Migration.

    Happy Migration :)...

    Tuesday, April 23, 2019 4:19 PM