How to Create a managed image of a generalized VM in Azure

To create a managed image of a generalized VM in Azure.

Introduction:

A generalization is a process of creating custom images for a virtual machine. To create an image, all the software configurations of a virtual machine would be included in the image. By using the base image, we can create new Virtual Machines, which would have the default software configuration specified in the image.

Step 1: Log in to Azure Portal as shown in the below image

Step 2: Select your VM as shown in the below image

Step 3: Start the Virtual machine as shown in the below image

Step4: Click connect, select RDP and Download the RDP file as shown in the below image

Step 5: Open the RDP file and Enter the Username and password as shown in the below image

Step 6: Through RDP we can use windows virtual machine

Step 7: Next, now I am going to create and install some software and directory as shown in the below image.

Step 8: After Install the software’s go to run as shown in the below image. (C:\Windows\System32\Sysprep\sysprep.exe). Make sure to select Generalize and to set the Shutdown Option to Shutdown

Step 9: After the Virtual Machine has been turned off. De-allocated the Virtual Machine (select it in the Azure Portal and click Stop). After the Virtual Machine has the de-allocated status, go the Overview blade, and click Capture as shown in the below image

Step 10: Give this Capture / Image a name and select the replica details as shown in the below image.

Step 11: Select and fill the tag details and finally review and create the image as shown in the below image.

Step 12: Next go to the azure compute gallery can see your machine image as shown in the below image.

Step 13: Click the Create VM as shown in the below image.

Step 14: Enter and check the Project details Instance Details and Administration account details as shown in the below image

Step 15: Enter the Disk Details and click next as shown in the below image

Step 16: check the Networking Interface Details as shown in the below image

Step 17: Set to Default configuration in management, advanced and tags tab as shown in the below image

Step 18: Review and Click Create to create the virtual machine as shown in the below image

Step 19: The Deployment is successful

Step 20: Click connect, select RDP and Download the RDP file as shown in the below image

Step 21: Open the RDP file and Enter the Username and password as shown in the below image

Step 22: Through RDP we can use windows virtual machine

Step 23: All tests are successful now you can delete the old Virtual machines.

Step 24: Go to azure portal stop your virtual machine as shown in the below image.

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to create a managed image of a generalized VM in Azure. Your feedback is much welcome.

FAQ
Q
Can we delete VMs permanently in Azure?
A
You can use the portal or PowerShell to remove your VM and its dependencies. In the case where you cannot delete the resource group, either the dependencies are not in the same resource group, or there are other resources, follow the steps below: Open the Azure Stack user portal. Select Virtual machines.
Q
How many times can you Sysprep?
A
There is no limit to the number of times that the Sysprep command can run on a computer. However, the clock for Windows Product Activation begins its countdown the first time Windows starts. You can use the sysprep /generalize command to reset Windows Product Activation a maximum of three times.
Q
Can you Sysprep a virtual machine?
A
Sysprep will force Windows to re-discover devices and hardware. If Windows is in a state where it cannot be booted, it is possible to boot Windows in a Virtual Machine such as VMware Fusion, run Sysprep, and then boot directly to Windows.
Q
What is a generalized VM image?
A
Generalization is the process of creating custom Images on a Virtual Machine. The Image would have all the software configuration of a virtual machine that is used to create an image. Using this base image we can create new Virtual Machines which would have default software configuration as per the Virtual Machine image.
Q
What is the difference between an image and a snapshot?
A
A snapshot reflects the contents of a persistent disk in a concrete instant in time. An image is the same thing, but includes an operating system and boot loader and can be used to boot an instance. Images and snapshots can be public or private.