Capture an image of an Azure Windows virtual machine created with the classic deployment model.

Important

Azure has two different deployment models for creating and working with resources: Resource Manager and Classic. This article covers using the Classic deployment model. Microsoft recommends that most new deployments use the Resource Manager model. For Resource Manager model information, see Create a copy Windows VM running in Azure.

This article shows you how to capture an Azure virtual machine running Windows so you can use it as an image to create other virtual machines. This image includes the operating system disk and any data disks that are attached to the virtual machine. It doesn't include networking configurations, so you'll need to configure those when you create the other virtual machines that use the image.

Azure stores the image under My Images. This is the same place where any images you've uploaded are stored. For details about images, see About images for virtual machines.

Before you begin

These steps assume that you've already created an Azure virtual machine and configured the operating system, including attaching any data disks. If you haven't done this yet, see these instructions:

Warning

This process deletes the original virtual machine after it's captured.

Prior to caputuring an image of an Azure virtual machine, it is recommended the target virtual machine be backed up. Azure virtual machines can be backed up using Azure Backup. For details, see Back up Azure virtual machines. Other solutions are available from certified partners. To find out what’s currently available, search the Azure Marketplace.

Capture the virtual machine

  1. In the Azure classic portal, Connect to the virtual machine. For instructions, see How to sign in to a virtual machine running Windows Server.
  2. Open a Command Prompt window as an administrator.
  3. Change the directory to %windir%\system32\sysprep, and then run sysprep.exe.
  4. The System Preparation Tool dialog box appears. Do the following:

    • In System Cleanup Action, select Enter System Out-of-Box Experience (OOBE) and make sure that Generalize is checked. For more information about using Sysprep, see How to Use Sysprep: An Introduction.
    • In Shutdown Options, select Shutdown.
    • Click OK.

    Run Sysprep

  5. Sysprep shuts down the virtual machine, which changes the status of the virtual machine in the Azure classic portal to Stopped.
  6. In the Azure classic portal, click Virtual Machines and select the virtual machine you want to capture.
  7. On the command bar, click Capture.

    Capture virtual machine

    The Capture the Virtual Machine dialog box appears.

  8. In Image Name, type a name for the new image.
  9. Before you add a Windows Server image to your set of custom images, it must be generalized by running Sysprep as instructed in the previous steps. Click I have run Sysprep on the virtual machine to indicate you did that.
  10. Click the check mark to capture the image. The new image is now available under Images.

    Image capture successful

Next steps

The image is ready to be used to create virtual machines. To do this, you'll create a virtual machine by using the From Gallery menu item and selecting the image you just created. For instructions, see Create a virtual machine from an image.