Creating and Uploading a Virtual Hard Disk that Contains the Linux Operating System
Azure has two different deployment models for creating and working with resources: Resource Manager and classic. This article covers using the classic deployment model. Microsoft recommends that most new deployments use the Resource Manager model.
This article shows you how to create and upload a virtual hard disk (VHD) so you can use it as your own image to create virtual machines in Azure. You'll learn how to prepare the operating system so you can use it to create multiple virtual machines based on that image.
Important: The Azure platform SLA applies to virtual machines running the Linux OS only when one of the endorsed distributions is used with the configuration details as specified under 'Supported Versions' in Linux on Azure-Endorsed Distributions. All Linux distributions in the Azure image gallery are endorsed distributions with the required configuration.
This article assumes that you have the following items:
Linux operating system installed in a .vhd file - You have installed an Azure-endorsed Linux distribution (or see information for non-endorsed distributions) to a virtual disk in the VHD format. Multiple tools exist to create .vhd files - for example you can use a virtualization solution such as Hyper-V to create the .vhd file and install the operating system. For instructions, see Install the Hyper-V Role and Configure a Virtual Machine.
The newer VHDX format is not supported in Azure. You can convert a VHDX to VHD format using Hyper-V Manager or the
Convert-VHDcmdlet. Further, Azure does not support uploading dynamic VHDs, so you need to convert such disks to static VHDs before uploading. You can use tools such as Azure VHD Utilities for GO to convert dynamic disks.
Azure Command-line Interface - Install the latest Azure Command-Line Interface to upload the VHD.
Azure supports a variety of Linux distributions (see Endorsed Distributions). The following articles will guide you through how to prepare the various Linux distributions that are supported on Azure. After following the steps in the guides below, come back here and you should have a VHD file that is ready to upload to Azure:
- CentOS-based Distributions
- Debian Linux
- Oracle Linux
- Red Hat Enterprise Linux
- SLES & openSUSE
- Other - Non-Endorsed Distributions
Also see the Linux Installation Notes for more general tips on preparing Linux images for Azure.
Make sure you are using the Azure CLI in the classic deployment model (
azure config mode asm), then log in to your account:
You will need a storage account to upload your VHD file to. You can either pick an existing one or create a new one.
Use the Azure CLI to upload the image by using the following command:
azure vm image create <ImageName> --blob-url <BlobStorageURL>/<YourImagesFolder>/<VHDName> --os Linux <PathToVHDFile>
In the previous example:
- BlobStorageURL is the URL for the storage account you plan to use
- YourImagesFolder is the container within blob storage where you want to store your images
- VHDName is the label that appears in portal to identify the virtual hard disk.
- PathToVHDFile is the full path and name of the .vhd file on your machine.
For more information, see Azure CLI reference for Azure Service Management.