How to capture an image of an Azure Windows Server virtual machine the safe way
February 2, 2014 Leave a comment
Customers can create custom made Windows Server images in Windows Azure based on their own created baseline Windows Server image. A custom made image provides a way to deploy virtual machines which are identically configured.
Windows Azure currently has issues which can cause unwanted lost of a baseline image resulting in lost of work. This is because the server on which sysprep is exectuted is not shutdown but rebooted by Azure.
This blogpost describes a workaround.
The procedure to create an image is simple:
- Deploy a virtual machine using a Microsoft supplied image or your own image
- customize the guest operating system
- execute sysprep
- capture the guest operating system OS disk and publish it as an image
Sysprep should be performed by selecting ‘shutdown’. Because of an issue in Windows Azure in certain circumstances Azure restarts the guest when a guest initiated shutdown is selected.
This results is customers not being able to Capture the virtual machine because it is still running in a state waiting for input after the reboot.
This issue is hard to reproduce. In many cases customers will not encounter an issue. However I encountered this issue 4 times in a row on 4 different servers.
Microsoft does planned maintenance on Windows Azure for installation of bug fixes and new features. These updates are done in batches which means at any given time some hosts are running as non-patched and some are patched. When Microsoft has patched all hosts this problem will not occur.
The workaround is simple: in Sysprep select Quit instead of Shutdown. Then do a Shutdown initiated from the Azure Management Console.When the VM has stopped a capture can be performed.
This blogpost has all the details.