Create VM Images on Azure

In this document, the scope of Azure Marketplace is mainland China, and “mirror image” or “image” mean the same thing.

It is easier to generate a VHD file when you deploy the VM image in the Azure portal than it is to prepare the VHD file locally. This method works in Azure Resource Manager (ARM) mode. You ultimately need to generate a VM file with the “ .vhd” extension.

1. Create a Linux image on Azure

1.1 To create a Linux virtual machine on the Azure Portal, please refer to Create a Linux VM using the Azure portal or Create and manage Linux VMs with the Azure CLI.

  • Once you have signed in to the Azure portal and selected the base image, follow the prompts to create a virtual machine. When configuring a virtual machine created on the Azure Portal, select “No” for “Use managed disk” in the “Disks” -> “Advanced” options. If this is not done, the VHD file won’t be created. Under “Storage Account”, you can choose any storage account to hold the VHD file.

1.2 After the Linux VM has been successfully deployed, install the applications that you need to onboard to the Azure Marketplace.

1.3 After the applications have been installed, perform “VM image certification” to test and optimize your VM image.

1.4 After you have finished certifying the VM image, perform “deprovision the VM” and “deallocate and mark VM as generalized ”.

  • In the reference documentation, after deallocating the VM and marking it as generic, once the VHD image has been created, it can be viewed in the resource group or storage account on the Azure web administration page. During subsequent testing, it is easier to work from “Create a VM from an image” on the Azure Web Management page.

  • If you need to use this VHD address when publishing an image, after the image is created, first delete the VM, browse to the VHD file within the Storage Account, then click “Break lease”. You can now use the VHD address when publishing.

2. Create a Windows image on Azure

2.1 First, create a Windows virtual machine on the Azure Portal. Please refer to Create a Windows VM using the Azure portal or Create and manage Windows VMs with Azure PowerShell.

  • Once you have signed in to the Azure portal and selected the base image, follow the prompts to create a virtual machine. When configuring a virtual machine created on the Azure Portal, select “No” for “Use managed disk” in the “Disks” -> “Advanced” options. If this is not done, the VHD file won’t be created. Under “Storage Account”, you can choose any storage account to hold the VHD file. !

2.2 After the Windows VM has been successfully deployed, install the applications that you need to onboard to the Azure Marketplace.

2.3 After the applications have been installed, perform “VM image certification” to test and optimize your VM image.

2.4 After you have installed the applications, perform “ Generalize the Windows VM using Sysprep ” and “ Deallocate or mark the VM as generalized ” on the VM.

  • To deallocate the VM and mark it as generalized, you must first sign in to Azure in ARM mode (Login-AzureRmAccount-EnvironmentName AzureChinaCloud). You can then view the VHD file in the Azure portal under “Resource Groups” or “Storage Accounts”. During subsequent testing, it is easier to work from “Create a VM from an image” on the Azure portal.
  • If you need to use this VHD address when publishing an image, after the image is created, first delete the VM, browse to the VHD file within the Storage Account, then click “Break lease”. You can now use the VHD address when publishing. Please refer to the image publication documentation for more details.

Next steps

Feedback

  • If you have any questions about this documentation, please submit user feedback in the Azure Marketplace.
  • You can also look for solutions in the FAQs.