Create VM Images Locally

In this document, the scope of Azure Marketplace is mainland China, and “mirror image” or “image” mean the same thing. Please note that VHD image files must be between 1GB and 1TB in size.

1. Create a Linux image locally (outside Azure)

Create an Azure-based Linux image locally. This section is about the process for using Hyper-V (we recommend using the Hyper-V tool) to create Linux VMs. Before you create a Linux VM image, please read information about non-endorsed distributions.

1.1 Install Hyper-V

1.2 In the Hyper-V manager, install the Linux VM, and install and configure the applications that you want to onboard to the Azure Marketplace.

Note: If you have the following commands in the document, do not execute them first. 
You need to install the applications that need to be put on the Azure market and 
complete the "Chapter 1.3 Virtual Machine Image Authentication" before executing the following commands.     
Because these commands deprovision the VM, you will not be able to remotely log in to the virtual machine after execution.
# sudo waagent -force -deprovision
# export HISTSIZE=0
# logout

1.3 Perform “ VM image certification ” to test and optimize your VM image.

1.4 Deprovision the VM. See the section on commands to cancel VM provisioning in Article 1.2 Install a Linux VM in Hyper-V Manager.

1.5 Upload the VHD file to a container in your Azure portal storage account. Note: VHD files must be uploaded with the suffix “ .vhd”, you cannot use “.vhdx”. For documentation, see Convert VM disks to VHDs and fixed-size disks.

1.6 Upload the VHD file to an Azure portal storage account container and create the VHD file locally to complete the process. Next, perform pre-publication testing for the VM.

2. Create a Windows image locally (outside Azure)

2.1 Install Hyper-V

2.2 Install Windows and install and configure the applications that you need to onboard to the Azure Marketplace. For more information, see Prepare a Windows VHD or VHDX to upload to Azure.

 Note: In the article, before executing the sysprep generalized virtual machine image, you need to 
 install the application that needs to be put on the Azure MarketPlace.      
 Then, proceed to "Chapter 2.3 VM image certification".
 Because after executing the sysprep generalized virtual machine image, you can no longer log in 
 to the VM remotely.

2.3 Perform “ VM image certification ” to test and optimize your VM image.

2.4 Once you complete the process in Section 2.2, the VHD file will have been uploaded to an Azure portal storage account container, and you just need to create the VHD file locally to complete the process. Next, perform pre-publication testing for the VM.

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.