Prepare generalized image from ISO to deploy VMs on Azure Stack Edge Pro GPU
APPLIES TO: Azure Stack Edge Pro - GPUAzure Stack Edge Pro 2Azure Stack Edge Pro RAzure Stack Edge Mini R
To deploy VMs on your Azure Stack Edge Pro GPU device, you need to be able to create custom virtual machine (VM) images that you can use to create VMs. This article describes how to prepare a Windows VM image using ISO installation media, and then generalize that image so you can use it to deploy multiple new VMs on your Azure Stack Edge Pro GPU device.
To prepare a generalized image created from a Windows VHD or VHDX, see Prepare a generalized image from a Windows VHD 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.
|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.|
The high-level workflow to create a generalized Windows VHD using an ISO is:
- Prepare the source VM using an ISO image:
- Create a new, blank, fixed-size VHD in Hyper-V Manager.
- Use that VHD to create a new virtual machine.
- Mount your ISO image on the DVD drive of the new VM.
- Start the VM, and install the Windows operating system.
- Generalize the VHD using the sysprep utility.
- Copy the generalized image to Azure Blob storage.
Before you can create a generalized Windows VHD by using an ISO image, make sure that:
You have an ISO image for the supported Windows version that you want to turn into a generalized VHD. Windows ISO images can be downloaded from the Microsoft Evaluation Center.
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 using an ISO
When you use an ISO image to install the operating system on your VM image, you start by creating a blank, fixed-size VHD in Hyper-V Manager. You then use that VHD to create a virtual machine. Then you attach the ISO image to the VM.
Create new VHD in Hyper-V Manager
Your first step is to create a new Generation 1 VHD in Hyper-V Manager, which will be the source VHD for a new virtual machine.
To create the VHD, follow these steps:
Open Hyper-V Manager on your client system. On the Action menu, select New and then Hard Disk.
Under Choose Disk Format, select VHD. Then select Next >.
Under Choose Disk Type, select Fixed size. Then select Next >.
Under Specify Name and Location, enter a name and location for your new VHD. Then select Next >.
Under Configure Disk, select Create a new blank virtual hard disk, and enter the size of disk you would like to create (generally 20 GB and above for Windows Server). Then select Next >.
Under Summary, review your selections, and select Finish to create the new VHD. The process will take five or more minutes depending on the size of the VHD created.
Create Hyper-V VM from VHD
Now you'll use the VHD you just created to create a new virtual machine.
To create your new virtual machine, follow these steps:
Open Hyper-V Manager on your Windows client.
On the Actions pane, select New and then Virtual Machine.
In the New Virtual Machine Wizard, specify the name and location of your VM.
Under Specify Generation, select Generation 1 or Generation 2. Then select Next >.
Under Assign Memory, assign the desired memory to the virtual machine. Then select Next >.
Under Configure Networking, enter your network configuration. Then select Next >.
Under Connect Virtual Hard Disk, select Use an existing virtual hard disk and browse to the fixed VHD you created in the previous procedure. Then select Next >.
Review the summary, and select Finish to create the virtual machine.
Mount ISO image on DVD drive of VM
After creating the new virtual machine, follow these steps to mount your ISO image on the DVD drive of the virtual machine:
In Hyper-V Manager, select the VM you just created, and then select Settings.
Under BIOS, ensure that CD is at the top of the Startup order list.
Under DVD Drive, select Image file, and browse to your ISO image.
Select OK to save your VM settings.
Start VM, and complete OS installation
To finish building your virtual machine, you need to start the virtual machine and walk through the operating system installation.
In Hyper-V Manager, in the scope pane, right-click the VM to open the context menu, and then select Start.
When the VM state is Running, select the VM, and then right-click and select Connect.
The virtual machine boots into setup, and you can walk through the installation like you would on a physical computer.
If you installed the Windows Server 2019 Standard operating system on your virtual machine, you'll need to change the BIOS setting to IDE before you generalize the VHD.
Generalize the VHD
Use the sysprep utility to generalize the VHD.
If you're generalizing a Windows Server 2019 Standard VM, before you generalize the VHD, make IDE the first BIOS setting for the virtual machine.
In Hyper-V Manager, select the VM, and then select Settings.
Under BIOS, ensure that IDE is at the top of the Startup order list. Then select OK to save the setting.
Inside the VM, open a command prompt.
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.
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
Upload the VHD to Azure blob storage. See the detailed instructions in Upload a VHD using Azure Storage Explorer.
After the upload is complete, you can use the uploaded image to create VM images and VMs.