So, I have got a Windows Server setup in Windows Azure and I want to create more of these with the same settings. For example, in the initial Windows Server, I already have configured IIS and Sql Server and firewall and now I want create more servers with the same configuration. To achieve this in Windows Azure, I will need to basically create an image of the existing server and then use that image to create more servers. So, what is an image – an image is a template of the server that is currently running and is a virtual hard disk that can be later used to create more windows servers.
To create an image of the server, I will log on to the server and then run sysprep command with administrative privilege within command prompt. To run sysprep, change current folder to %windir%\system32\sysprep and run sysprep.exe .
The System Preparation Tool options will appear. Choose “Entire System Out of Box Experience” in “System Cleanup Action” and select “Generalize”. In the “Shutdown Options” select “Shutdown”. The screen shot for this is below.
Click OK. Sysprep shuts down the virtual machine. At this stage, I cannot connect to the virtual machine using remote desktop which is the right behavior. However, the machine appears to be running from the Windows Azure portal. This is a bug in Windows Azure portal and at this stage I cannot capture the image of the virtual machine.
So, I chose the shut down option for the virtual machine and then clicked on the Capture button in the portal.
While clicking Capture a popup will appear suggesting that the currently running virtual machine will be deleted and I need to accept that before continuing. This, to me, is a poor experience as I don’t necessarily want to kill the virtual machine and this works better in AWS. In next step, I got a prompt to name the image name to continue. This will create the image for the current virtual machine.
Cool, if you have any better ways of doing it, please comment on this post.