Azure VM – How to create your own virtual machine image?
In previous article Azure VM – Minutes to set-up Windows 10 in Azure, I introduced you how to create a virtual machine with Windows 10. I also installed Visual Studio 15 Preview into my machine. In this article. I would like to provide the guideline to use CAPTURE feature to create your own images from existing VM so you can use it like a template to create other virtual machines.
Creating your own image with CAPTURE feature
First of all, you need to login to created virtual machine via the Remote Desktop session then you must run sysprep.exe to prepare base VM for imaging.
You can run sysprep.exe by access to C:/Windows/System32/Sysprep location.
In System Cleanup Action, please make sure you select Enter System Out-of-Box Experience (OOBE), Generalize check-box is checked and Shutdown option is Shutdown.
Or execute the following command.
sysprep /generalize /shutdown /oobe
Select your virtual machine in Azure Management Portal then click CAPTURE (make sure that your VM is stopped).
Provide a useful name and description to your CAPTURE image. Before you add a Windows image to your set of custom images, it must be generalized by running Sysprep.exe as instructed in the previous steps. Click I have run Sysprep on the virtual machine to indicate that you have done this.
After creating your own image your current machines will be deleted and you can re-create the new one from the gallery.
Why do we need to run sysprep.exe?
Sysprep.exe (System Preparation) helps to prepare a Windows installation for imaging and allowing you to capture a customized installation. Sysprep.exe provides the following features:
- Removes PC-specific information from the Windows image, including the PC’s security identifier (SID). This allows you to capture the image and apply it to other PCs. This is known as generalizing the PC.
- Uninstalls PC-specific drivers from.
- Prepares the PC for delivery to a customer by setting the PC to boot to OOBE.
- Allows you to add answer file (unattended) settings to an existing installation.
Sysprep.exe helps you to solve business goals such as:
- Helps you manage multiple PCs by creating a generic image that can be used across multiple hardware designs.
- Deploy PCs by capturing and deploying images with unique security identifiers.
- Fine-tune setup of individual PCs by adding apps, languages, or drivers in audit mode. For more information, see Audit Mode Overview.
- Provide more reliable PCs by testing in audit mode before delivering them to customers.