Before you work with Azure resources, get familiar with the deployment models: Resource Manager, and classic. This article covers creating resources with the classic deployment model.
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 template.
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.
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:
This process deletes the original virtual machine after it's captured, and is not intended as a way to back up a virtual machine. One possible way to do that is Azure Backup, which is available as a preview in certain regions. 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.
In the Azure portal, Connect to the virtual machine. For instructions, see How to sign in to a virtual machine running Windows Server.
Open a Command Prompt window as an administrator.
Change the directory to
%windir%\system32\sysprep, and then run sysprep.exe.
The System Preparation Tool dialog box appears. Do the following:
Sysprep shuts down the virtual machine, which changes the status of the virtual machine in the Azure portal to Stopped.
In the Azure portal, click Virtual Machines and select the virtual machine you want to capture.
On the command bar, click Capture.
The Capture the Virtual Machine dialog box appears.
In Image Name, type a name for the new image.
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.
Click the check mark to capture the image. The new image is now available under Images.
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 custom virtual machine running Windows.