hung-doan / .bookmarks

My life bookmarker
0 stars 0 forks source link

How to move Virtual Machine between subscriptions #9

Open hung-doan opened 8 years ago

hung-doan commented 8 years ago

Type: Guide Descriptions: In some case you have to move your current VM to another subscription (because of billing problem or ...) Unfortunately, Up to now (2015 Dec 21st), Ms Azure haven't had any plan to support to change the service subscription. So, you have to do it manually follow this step:

  1. Capture your current VM from subcription A
  2. Copy Images to subcription B
  3. Copy storage from subcription A to subcription B (If It is required)

Solutions: Requirement

Prepare

BEGIN [Step 01] Capture VM01 image

[Step 02] Re-create your VM from your captured-image

    AzCopy /Source:https://vm01store.blob.core.windows.net/system/SourceType:Blob /SourceKey:put_your_key_here /Dest:https://vm01newstore.blob.core.windows.net/system /DestType:Blob /DestKey:put_your_key_here
    azure vm create --image-urn  https://vm01store.blob.core.windows.net/system/Microsoft.Compute/Images/vhds/captured_osDiskName.vhd  --storage-account-name vm01newstore yourGroupName newm01 "Southeast Asia" "Windows"

NOTE Now you can remote to your new VM. But after create your new VM you can receive error: VM has been created, but there was an error during provisioning. It's ok, keep go ahead.

[Step 03] Move data from old subscription.

Ref: [1] azure-cli-arm-commands [2] HOW TO CREATE A VIRTUAL MACHINE FROM A CUSTOM IMAGE USING ARM API AND POWERSHELL [3] Using CLI to Capture and Deploy VMs [4] How to capture a classic Linux virtual machine as an image [5] Storage use AzCopy [6] Image capture issue / VM unexpectedly started after guest-initiated shutdown [7] Capture an image of an Azure Windows virtual machine created with the classic deployment mode