I successfully managed to transfer my Windows Azure Virtual Machine to a different subscription without losing any files with minimal downtime.
How did I do it?
I followed the steps on the Windows Azure Documentation: How to Capture an Image of a Virutal Machine Running Windows Server
- Ran sysprep on my Windows VM (C:\Windows\System32\Sysprep\Sysprep.exe)
- Waited about 10 minutes for operation to complete and system shutdown
- Clicked Capture
Then UH OH! You’re going to delete my virtual machine? But that means I will lose my IP address because there will be no VMs running under that domain. THERE HAS GOT TO BE A BETTER WAY.
In fact there is. So what I did was:
- Created a new extra small Ubuntu virtual machine and added to an existing virtual machine (the one I was about to capture).
- Added Apache quickly to host a web server letting people know I’m down. (sudo apt-get install apache2)
- Modified the default index.html (sudo vim /var/www/index.html) and created a nice maintenance message.
- Created a new endpoint for port 80 temporarily to the Ubuntu virtual machine.
- Back on the primary machine. Started the Capture.
- When the capture was finished. I created a new virtual machine utilizing the image I just captured and set the subscription to the one wanted to move too.
- VM booted up. I had to re-add my attached disk
- Removed Port 80 endpoint from the Ubuntu virtual machine and applied it to the newly created Windows machine.
- Shutdown Ubuntu VM (I will keep you around for future maintenance since you no longer cost me money except the small storage charge)
BAM! Site migrated to the new subscription and website is up and running without any loss to data.