Уреди

Делите путем


Prepare generalized image from Windows VHD to deploy VMs on Azure Stack Edge Pro GPU

APPLIES TO: Yes for Pro GPU SKUAzure Stack Edge Pro - GPUYes for Pro 2 SKUAzure Stack Edge Pro 2Yes for Pro R SKUAzure Stack Edge Pro RYes for Mini R SKUAzure Stack Edge Mini R                  

To deploy VMs on your Azure Stack Edge Pro GPU device, you need to be able to create custom VM images that you can use to create VMs. This article describes how to prepare a generalized image from a Windows VHD or VHDX, which you can use to deploy virtual machines on Windows Stack Edge Pro GPU devices.

To prepare a generalized VM image using an ISO, see Prepare a generalized image from an ISO to deploy VMs on Azure Stack Edge Pro GPU.

About VM images

A Windows VHD or VHDX can be used to create a specialized image or a generalized image. The following table summarizes key differences between the specialized and the generalized images.

Image type Generalized Specialized
Target Deployed on any system. Targeted to a specific system.
Setup after boot Setup required at first boot of the VM. No setup needed.
Platform turns on the VM.
Configuration Hostname, admin-user, and other VM-specific settings required. Preconfigured.
Used when Creating multiple new VMs from the same image. Migrating a specific machine or restoring a VM from previous backup.

Workflow

The high-level workflow to prepare a Windows VHD to use as a generalized image, starting from the VHD or VHDX of an existing virtual machine, has the following steps:

  1. Prepare the source VM from a Windows VHD:
    1. Convert the source VHD or VHDX to a fixed-size VHD.
    2. Use that VHD to create a new virtual machine.
  2. Start the VM, and install the Windows operating system.
  3. Generalize the VHD using the sysprep utility.
  4. Copy the generalized image to Blob storage.

Prerequisites

Before you prepare a Windows VHD for use as a generalized image on an Azure Stack Edge Pro GPU device, make sure that:

  • You have a VHD or a VHDX containing a supported version of Windows.
  • You have access to a Windows client with Hyper-V Manager installed.
  • You have access to an Azure Blob storage account to store your VHD after it is prepared.

Prepare source VM from Windows VHD

When your VM source is a Windows VHD or VHDX, you first need to convert the Windows VHD to a fixed-size VHD. You will use the fixed-size VHD to create a new virtual machine.

Important

These procedures do not cover cases where the source VHD is configured with custom configurations and settings. For example, additional actions may be required to generalize a VHD containing custom firewall rules or proxy settings. For more information on these additional actions, see Prepare a Windows VHD to upload to Azure - Azure Virtual Machines.

Convert source VHD to a fixed-size VHD

For your device, you'll need fixed-size VHDs to create VM images. You'll need to convert your source Windows VHD or VHDX to a fixed VHD.

Follow these steps:

  1. Open Hyper-V Manager on your client system. Go to Edit Disk.

    Open Hyper-V manager

  2. On the Before you begin page, select Next>.

  3. On the Locate virtual hard disk page, browse to the location of the source Windows VHD or VHDX that you wish to convert. Select Next>.

    Locate virtual hard disk page

  4. On the Choose action page, select Convert and select Next>.

    Choose action page

  5. On the Choose disk format page, select VHD format and then select Next>.

    Choose disk format page

  6. On the Choose disk type page, choose Fixed size and select Next>.

    Choose disk type page

  7. On the Configure disk page, browse to the location and specify a name for the fixed size VHD disk. Select Next>.

    Configure disk page

  8. Review the summary and select Finish. The VHD or VHDX conversion takes a few minutes. The time for conversion depends on the size of the source disk.

You'll use this fixed-size VHD for all the subsequent steps in this article.

Create Hyper-V VM from the fixed-size VHD

  1. In Hyper-V Manager, in the scope pane, right-click your system node to open the context menu, and then select New > Virtual Machine.

    Select new virtual machine in scope pane

  2. On the Before you begin page of the New Virtual Machine Wizard, select Next.

  3. On the Specify name and location page, provide a Name and location for your virtual machine. Select Next.

    Specify name and location for your VM

  4. On the Specify generation page, choose Generation 1 or Generation 2 for the .vhd device image type, and then select Next.

    Specify generation

  5. Assign your desired memory and networking configurations.

  6. On the Connect virtual hard disk page, choose Use an existing virtual hard disk, specify the location of the Windows fixed VHD that we created earlier, and then select Next.

    Connect virtual hard disk page

  7. Review the Summary and then select Finish to create the virtual machine.

Creation of the virtual machine takes several minutes.

The VM shows in the list of the virtual machines on your client system.

Start VM, and install operating system

To finish building your virtual machine, you need to start the virtual machine and walk through the operating system installation.

  1. In Hyper-V Manager, in the scope pane, right-click the VM to open the context menu, and then select Start.

    Select VM and start it

  2. When the VM state is Running, select the VM, and then right-click and select Connect.

    Connect to VM

  3. The virtual machine boots into setup, and you can walk through the installation like you would on a physical computer.

    Configure the operating system of the VM

After you're connected to the VM, complete the Machine setup wizard, and then sign into the VM.

Generalize the VHD

Use the sysprep utility to generalize the VHD.

  1. Inside the VM, open a command prompt.

  2. Run the following command to generalize the VHD.

    c:\windows\system32\sysprep\sysprep.exe /oobe /generalize /shutdown /mode:vm
    

    For details, see Sysprep (system preparation) overview.

  3. After the command is complete, the VM will shut down. Do not restart the VM.

Your VHD can now be used to create a generalized image to use on Azure Stack Edge Pro GPU.

Upload generalized VHD to Azure Blob storage

  1. Upload the VHD to Azure blob storage. See the detailed instructions in Upload a VHD using Azure Storage Explorer.

  2. After the upload is complete, you can use the uploaded image to create VM images and VMs.

Next steps

Depending on the nature of deployment, you can choose one of the following procedures.