I think the official Azure instructions on how to capture a VM image must be either incorrect or incomplete. I've run a variety of tests myself (detailed below) and more than two dozen people have complained on the page that the instructions don't work and/or damage their VM's. Surely something is missing from the instructions because people must be able to capture images from Azure VM's.
http://www.windowsazure.com/en-us/manage/windows/how-to-guides/capture-an-image/
The instructions on the page are pretty simple:
It sounds simple but the VM never actually shuts down so you can't actually click the capure button. If you manually shutdown the instance, even after waiting many hours, the resulting image fails to work and the original vhd is destroyed in the process.
Can anyone confirm you are able to capture a running Azure instance using either this workflow or some other workflow? If so, can you tell me what you're doing differently from what I'm doing?
Details - The tests I've run are as follows:
TEST 1 - Win2k8 R2 on Small instance
TEST 2 - Win2k8 R2 on Large instance
TEST 3 - Win2k12 Data Center Edition on small instance
TEST 4 - Win2k8 R2 on Small instance with Windows update
TEST 5 - Win2k8 R2 on Small instance with Visual Studio 2012 Update 3
TEST 6 - Win2k8 R2 on Large instance with fully configured IIS server
TEST 7 - Win2k8 R2 on Large instance with fully configured IIS server
Make one simple change to your workflow: during sysprep, choose to Quit instead of shutdown. This completes the sysprep process but then just exits the sysprep app.
tl;dr: run the following on the command line:
c:\windows\system32\sysprep\sysprep.exe /generalize /oobe /quit
At this point, you can simply select your running VM in the portal and shut it down (which only takes a few moments). You can then view it, which will be shown as stopped (deallocated). At that point, create the image as described in the tutorial you pointed to. You'll give it a name (e.g. "my specialized image"), click the checkbox stating it's been sysprepped, and click Ok. Your image is created, your original vhd is removed (as now you have a generic version of it), the image is registered in your subscription as a choosable image in the gallery (this takes a few minutes), and you're done.
At this point, create a new image from gallery. View MY IMAGES - you'll see your brand new image listed (you may have to wait a minute or so before attempting this - it might not appear immediately in the list).
Now just give it a username and password, and you should be all set.
Note: If you're worried about losing your VM in this step (e.g. something goes wrong), you can always make a copy of your vhd first. You'll need to use PowerShell (or the cross-platform Node-based command line tool), both downloadable from the windowsazure.com downloads page. You can then copy the vhd to a brand new blob, which essentially makes a backup for you. Should something go wrong, you can either use the backed-up image as the basis for a new virtual machine (which won't be sysprepped yet), or make a copy of it (and so on). To do this, you'll need the url to the vhd, which is displayed in the Disks section of the Dashboard page of your running VM.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With