Download this sample using the download button below.
Basic Steps for Cross Account VHD Copy:
- Shut down your Virtual Machine.
- Delete your Virtual Machine.
- Delete the associated Image or Disk inside the Virtual Machine Portal. This does not remove the underlying blob of the vhd.
- Copy the blog from one storage account to another.
- Add your vhd back and recreate the virtual machine.
Known Issues (per my research) with VHD Copying– make sure you understand these issues and limitations. I assume most are related to preview issues.
- If you copy a vhd that is Leased (configured as an Image or Disk inside the Virtual Machine Portal) the Source Disk will become unusable.
- If you copy a vhd that is Leased (configured as an Image or Disk inside the Virtual Machine Portal) the Destination Disk will likely not work. I would say about 75% of the time they do not work. I just re-tested this tonight and they worked.
- Copying from one data center to another seems to be as slow as downloading the file.
- When downloading the file, make sure you do not close the form or the download will stop.
- Copy Status does not seem to be working. I either get NULL or Pending all the time. Probably a user error on my part…. The best way to find out if the copy is complete is to check the file size on the destination. It is 0 MB until the copy is complete.
- Visual view of vhds contained inside a Storage Account
- Simple, one click Delete of vhds
- Simple, one click Lease Break of vhds (for orphaned vhds – see more here)
- One click download of a vhd, tested to work with Hyper-V (downloads at a rate of about 3 MB/sec)
- Support for easily making a copy of a VHD within the same Azure account
- Support for making a vhd copy across Window Azure Accounts within the same region within a few seconds
- Support for making a vhd copy to any account in any region (slow when out of region)
- Prevents you from making a copy of a vhd with an existing Lease
- Uses the Windows Azure Storage API version 1.7.1 (github)
Advanced Features (with REST API Management Certificate):
- Visual view of all vhds contained inside a single Windows Azure Account
- See a “***” by vhds inside the Source storage account
- List all custom user images inside a single Windows Azure Account
Missing Features (i.e. items I hope to add later):
- Ability to upload a vhd
- Ability to get details on an Image
How to work with just one Storage Account:
Set just a Source Configuration inside the app.config file. I also have a check box for “source only” that will try to auto determine what you want to do. The default is Source Only.
How to Copy a vhd into the same account:
Inside the app.config file for the tool, set the Source and Destination to the same Storage Account.
How to Copy a vhd into another account in the same region (inter-account or cross-account):
Inside the app.config file for the tool, set the Source to the Storage Account that has the source vhd and set Destination to Storage Account that you want for the Destination. The destination container vhds does not need to exist. The tool will create it for you. Click “Copy”. The Destination list should refresh and the copy already be compete. You will know it is complete when the size of the vhd is not 0.
How to Copy a vhd cross region:
Inside the app.config file for the tool, set the Source to the Storage Account that has the source VHD and set Destination to Storage Account that you want for the Destination. The destination container vhds does not need to exist. The tool will create it for you. Select a vhd in the List box that is not lease. Change the vhd name if you wish. Click “Copy”. Click on “List All VHDS” on the top right until you see the file size of the Destination change from 0 to the size of the VHD. This will take a long time, up to 8 hours. I would not close the form until I have confirmed it was completed.
How to Download a Source vhd:
Inside the app.config file for the tool, set the Source to the Storage Account that has the source VHD. Click on “List All VHDS”. Select the VHD you want to download inside the List Box. Click on “Download”. You will be prompted for the download location. Make sure you have enough disk space. Leave the tool open until you see a Completed notice on the top right of the tool. This will take up to 8 hours. Do not close the form or the download will stop.
How to Break a Lease or Delete a vhd on the Source or Destination:
Inside the app.config file for the tool, set the Source and Destination to the Storage Accounts that has the VHDS. Click on “List All VHDS”. Using the List Box, select a single vhd from the list. Click on “Break VHD Lease” to break the existing lease or “Delete VHD” to delete the vhd. Note: this operations are not undoable. Using these incorrectly can result in loss of data or vhds.