Edit

Share via


Create a custom image for an Azure DevTest Labs virtual machine from a VHD file

In this article, you learn how to create an Azure DevTest Labs virtual machine (VM) custom image by using a virtual hard disk (VHD) file. This article describes how to create a custom image in the Azure portal. You can also use PowerShell to create a custom image.

In Azure DevTest Labs, you can use custom images to:

  • Create a VM from a VHD file that has all the software you need preinstalled.
  • Create VMs quickly, because you don't have to install all the required software on the target machines.
  • Clone a VM by creating a custom image from a VM, and then creating VMs based on that image.

Prerequisites

Create the custom image

To create a custom image for DevTest Labs from a VHD file, follow these steps:

  1. In the Azure portal, go to the lab that has the uploaded VHD file.

  2. On the lab Overview page, select Configuration and policies in the left navigation.

  3. On the Configuration and policies page, select Custom images under Virtual machine bases in the left navigation.

  4. On the Custom images page, select Add.

    Screenshot that shows the Custom image page with the Add button.

  5. Fill out the Custom image page as follows:

    • Name: Enter a name for the custom image to display in the list of base images for creating a VM.
    • Description: Enter an optional description to display in the base image list.
    • OS type: Select whether the OS for the VHD and custom image is Windows or Linux.
      • If you choose Windows, select the checkbox if you ran sysprep on the machine when you created the VHD file.
      • If you choose Linux, select the checkbox if you ran deprovision on the machine when you created the VHD file.
    • VHD Generation: Select whether you have a V1 (VHD) or V2 (VHDX) file.
    • VHD: Select the uploaded VHD file for the custom image from the dropdown menu.
    • Plan name, Plan offer, and Plan publisher: If the VHD isn't a licensed image published by Microsoft, optionally enter the name of the Marketplace image or SKU used to create the VHD, a product or offer name, and the plan publisher. If the image is a licensed image, these fields are prepopulated with the plan information.
  6. Select OK.

    Screenshot that shows the Custom image page.

After creation, the custom image is stored in the lab's storage account. The image appears on the lab Custom images page and on the list of VM base images for the lab. Lab users can create new VMs based on the custom image.

Screenshot that shows the Custom images available in the list of base images.