Find Azure Marketplace image information using the Azure CLI

Caution

This article references CentOS, a Linux distribution that is nearing End Of Life (EOL) status. Please consider your use and planning accordingly. For more information, see the CentOS End Of Life guidance.

Applies to: ✔️ Linux VMs ✔️ Windows VMs ✔️ Flexible scale sets

This topic describes how to use the Azure CLI to find VM images in the Azure Marketplace. Use this information to specify a Marketplace image when you create a VM programmatically with the CLI, Resource Manager templates, or other tools.

You can also browse available images and offers using the Azure Marketplace or Azure PowerShell.

Make sure that you installed the latest Azure CLI and are logged in to an Azure account (az login).

Note

Before you can use Azure CLI in Microsoft Azure operated by 21Vianet, please run az cloud set -n AzureChinaCloud first to change the cloud environment. If you want to switch back to Azure Public Cloud, run az cloud set -n AzureCloud again.

Terminology

A Marketplace image in Azure has the following attributes:

  • Publisher: The organization that created the image. Examples: Canonical, SUSE
  • Offer: The name of a group of related images created by a publisher. Examples: 0001-com-ubuntu-server-jammy, sles-15-sp3.
  • SKU: An instance of an offer, such as a major release of a distribution. Examples: 22_04-lts-gen2, 8-lvm-gen2, gen2.
  • Version: The version number of an image SKU.

These values can be passed individually or as an image URN, combining the values separated by the colon (:). For example: Publisher:Offer:Sku:Version. You can replace the version number in the URN with latest to use the latest version of the image.

If the image publisher provides extra license and purchase terms, then you must accept those terms before you can use the image. For more information, see Check the purchase plan information.

You can run the az vm image list --all to see all of the images available to you, but it can take several minutes to produce the entire list. A faster option is the use az vm image list, without the --all option, to see a list of popular VM images in the Azure Marketplace. For example, run the following command to display a cached list of popular images in table format:

az vm image list --output table

The output includes the image URN. You can also use the UrnAlias, which is a shortened version created for popular images like UbuntuLTS.

Offer                         Publisher               Sku                                 Urn                                     UrnAlias                 Version
----------------------------  ----------------------  ----------------------------------  ------------------------------------------------------------------------------  -----------------------  ---------
CentOS                        OpenLogic               7.5                                 OpenLogic:CentOS:7.5:latest
                                     CentOS                   latest
debian-10                     Debian                  10                                  Debian:debian-10:10:latest
                                     Debian                   latest
opensuse-leap-15-3            SUSE                    gen2                                SUSE:opensuse-leap-15-3:gen2:latest                                             openSUSE-Leap            latest
sles-15-sp3                   SUSE                    gen2                                SUSE:sles-15-sp3:gen2:latest                                     SLES                     latest
UbuntuServer                  Canonical               18.04-LTS                           Canonical:UbuntuServer:18.04-LTS:latest                                         UbuntuLTS                latest
WindowsServer                 MicrosoftWindowsServer  2022-Datacenter                     MicrosoftWindowsServer:WindowsServer:2022-Datacenter:latest                     Win2022Datacenter        latest
WindowsServer                 MicrosoftWindowsServer  2022-datacenter-azure-edition-core  MicrosoftWindowsServer:WindowsServer:2022-datacenter-azure-edition-core:latest  Win2022AzureEditionCore  latest
WindowsServer                 MicrosoftWindowsServer  2019-Datacenter                     MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest                     Win2019Datacenter        latest
WindowsServer                 MicrosoftWindowsServer  2016-Datacenter                     MicrosoftWindowsServer:WindowsServer:2016-Datacenter:latest                     Win2016Datacenter        latest
WindowsServer                 MicrosoftWindowsServer  2012-R2-Datacenter                  MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:latest                  Win2012R2Datacenter      latest
WindowsServer                 MicrosoftWindowsServer  2012-Datacenter                     MicrosoftWindowsServer:WindowsServer:2012-Datacenter:latest                     Win2012Datacenter        latest
WindowsServer                 MicrosoftWindowsServer  2008-R2-SP1                         MicrosoftWindowsServer:WindowsServer:2008-R2-SP1:latest                         Win2008R2SP1             latest

Find specific images

You can filter the list of images by --publisher or another parameter to limit the results.

For example, the following command displays all Debian offers:

az vm image list  -l chinaeast2 --offer Debian --all --output table

You can limit your results to a single architecture by adding the --architecture parameter. For example, to display all Arm64 images available from Canonical:

az vm image list -l chinaeast2 --architecture Arm64 --publisher Canonical --all --output table

Look at all available images

Another way to find an image in a location is to run the az vm image list-publishers, az vm image list-offers, and az vm image list-skus commands in sequence. With these commands, you determine these values:

  1. List the image publishers for a location. In this example, we're looking at the China North region.

    az vm image list-publishers --location chinanorth --output table
    
  2. For a given publisher, list their offers. In this example, we add Canonical as the publisher.

    az vm image list-offers --location chinanorth --publisher Canonical --output table
    
  3. For a given offer, list their SKUs. In this example, we add UbuntuServer as the offer.

    az vm image list-skus --location chinanorth --publisher Canonical --offer UbuntuServer --output table
    

Note

Canonical has changed the Offer names they use for the most recent versions. Before Ubuntu 20.04, the Offer name is UbuntuServer. For Ubuntu 20.04 the Offer name is 0001-com-ubuntu-server-focal and for Ubuntu 22.04 it's 0001-com-ubuntu-server-jammy.

  1. For a given publisher, offer, and SKU, show all of the versions of the image. In this example, we add 18.04-LTS as the SKU.

    az vm image list \
        --location chinanorth \
        --publisher Canonical \
        --offer UbuntuServer \
        --sku 18.04-LTS \
        --all --output table
    

Pass this value of the URN column with the --image parameter when you create a VM with the az vm create command. You can also replace the version number in the URN with "latest", to use the latest version of the image.

If you deploy a VM with a Resource Manager template, you set the image parameters individually in the imageReference properties.

Check the purchase plan information

Some VM images in the Azure Marketplace have extra license and purchase terms that you must accept before you can deploy them programmatically.

To deploy a VM from such an image, you'll need to accept the image's terms the first time you use it, once per subscription. You'll also need to specify purchase plan parameters to deploy a VM from that image

To view an image's purchase plan information, run the az vm image show command with the URN of the image. If the plan property in the output isn't null, the image has terms you need to accept before programmatic deployment.

For example, the Canonical Ubuntu Server 18.04 LTS image doesn't have extra terms, because the plan information is null:

az vm image show --location chinanorth --urn Canonical:UbuntuServer:18.04-LTS:latest

Output:

{
  "dataDiskImages": [],
  "id": "/Subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Providers/Microsoft.Compute/Locations/chinanorth/Publishers/Canonical/ArtifactTypes/VMImage/Offers/UbuntuServer/Skus/18.04-LTS/Versions/18.04.201901220",
  "location": "chinanorth",
  "name": "18.04.201901220",
  "osDiskImage": {
    "operatingSystem": "Linux"
  },
  "plan": null,
  "tags": null
}

Next steps

To create a virtual machine quickly by using the image information, see Create and Manage Linux VMs with the Azure CLI.