Hello, @sns !
How do I take a snapshot of a VM VHD?
A snapshot is a full, read-only copy of a virtual hard disk (VHD). You can use a snapshot as a point-in-time backup, or to help troubleshoot virtual machine (VM) issues. You can take a snapshot of both operating system (OS) or data disk VHDs.
https://learn.microsoft.com/en-us/azure/virtual-machines/snapshot-copy-managed-disk?tabs=portal
- In the Azure portal, select Create a resource.
- Search for and select Snapshot.
- In the Snapshot window, select Create. The Create snapshot window appears.
- For Resource group, select an existing resource group or enter the name of a new one.
- Enter a Name, then select a Region and Snapshot type for the new snapshot. If you would like to store your snapshot in zone-resilient storage, you need to select a region that supports availability zones. For a list of supporting regions, see Azure regions with availability zones.
- For Source subscription, select the subscription that contains the managed disk to be backed up.
- For Source disk, select the managed disk to snapshot.
- For Storage type, select Standard HDD, unless you require zone-redundant storage or high-performance storage for your snapshot.
- If needed, configure settings on the Encryption, Networking, and Tags tabs. Otherwise, default settings are used for your snapshot.
- Select Review + create.
How does sysprep work?
Running sysprep.exe /oobe /generalize /shutdown
is part of generalizing a VM that removes all your personal account and security information, and then prepares the machine to be used as an image (this is not necessary for creating an image in an Azure Compute Gallery). This process is not reversible.
After you have run Sysprep on a VM, that VM is considered generalized. The VM will shut down and cannot be restarted. If you need to keep the original VM functioning, you should create a snapshot of the OS disk, create a VM from the snapshot, and then generalize that copy of the VM.
- Remove machine specific information by deprovisioning or generalizing a VM before creating an image
- Sysprep (System Preparation) Overview
What if things go wrong with sysprep?
It's rare for errors to occur when running sysprep but be sure to read through unsupported sysprep scenarios:
Creating a snapshot of the original VM (as covered above) and generalizing the snapshot is recommended if you want to keep the original VM functioning.
I hope this has been helpful! Your feedback is important so please take a moment to accept answers.
If you still have questions, please let us know what is needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!