none
attach os disk to azure rm vm

    Question

  • Hello everybody

    I am considering scenario with moving whole VM from one resource group to another. How could it be achieved easily? My machine has got quite a lot of configuration settings.

    I am able to migrate every resource (using resource api), except VM - because of OS disk - I can't attach OS disk from old machine (my vhd has been just copied within powershell).

    Is there an easy way to do that? Is this possible to just change vhd uri of newly created vm machine? I think it is not possible.

    How to easily migrate VM machine? Which scenario would you choose?

    Regards

    Monday, November 21, 2016 9:29 AM

All replies

  • Hi

    Are the old resource group and the new resource group in one region?

    If the resource groups in the same region, you could continue to use the old storage account. However, it is not recommended by Azure. You had better copy your vhds to your new resource group

    If the resource groups in the different regions, you should use azcopy which could copy vhds to your new storage account.

    Please refer to the steps below.

    Step 1: Stop your VM.

    Step 2: Copy your VHD to new resource group. You could use AzCopy to copy VHD

    AzCopy /Source:https://sourceaccount.blob.core.windows.net/mycontainer1 /Dest:https://destaccount.blob.core.windows.net/mycontainer2 /SourceKey:key1 /DestKey:key2 /Pattern:yourvhd

    Step3: Redeploy your VM by using template.

    https://github.com/Azure/azure-quickstart-templates/tree/master/101-vm-from-user-image

    If you still have questions, welcome to post back here. Thanks.

    Regards,

    Walter


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Tuesday, November 22, 2016 2:44 AM
  • Thank you for advices.

    I have been trying few scenarios..Unfortunately without success. Even the fact I have attached my vhd, I had my vhd but without things installed. It was linux machine and I was unable to login with ssh (I had also problems with things already installed

    Nevermind - I will try your template and report results soon

    Tuesday, November 22, 2016 7:15 PM
  • Hi,

    Was your issue resolved?

    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.

    If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.

    If no, please reply and tell us the current situation in order to provide further help.

    Best Regards,

    Walter


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Thursday, November 24, 2016 6:01 AM