Skip to content

How to list available Azure VM images using PowerShell

How to list available Azure VM images using PowerShell

In this short post, I will show you how you can retrieve the current available VM images from Azure using Powershell.

To get started, you will have to connect to Azure using PowerShell by running the following.

Connect-AzAccount 

You will be prompted for your Username and Password

To get a list of all the available Images in your chosen region, run the following.

  1. List the available publishers in your region
$locName="southafricanorth"
Get-AzVMImagePublisher -Location $locName |Select PublisherName
  1. From the list of Publishers select your publisher and run the below, I will select “MicrosoftWindowsServer” as my offer for this example.
$pubName="MicrosoftWindowsServer"
Get-AzVMImageOffer -Location $locName -PublisherName $pubName | Select Offer
  1. Now that we have a list of available Offers for the Publisher “MicrosotWindowsServer”, let’s go ahead and list the available Skus. I will select “WindowsServer” as the Offer.
$offerName="WindowsServer"
 Get-AzVMImageSku -Location $locName -PublisherName $pubName -Offer $offerName | Select Skus
  1. So, now we can see the available Skus for “WindowsServer”, we now need to look at the available Images for the different Skus. I will select “2019-Datacenter” as the Sku, so lets see which images are available for this Sku.

As we can see in the images below, these are the different images available for “Windows Server 2019” which is available in the selected region.

If you already know which Publisher and Offer you would like to view, then you can run the script as follow.

$locName="southafricanorth"
$pubName="MicrosoftWindowsServer"
$offerName="WindowsServer"
$skuName="2019-Datacenter"
Get-AzVMImage -Location $locName -PublisherName $pubName -Offer $offerName -Skus $skuname

And that’s how you can quickly retrieve a list of all the available VM images and Publishers in your Azure Region using PowerShell.

Sharing is caring!

Published inAzureAzure VM

2 Comments

  1. Iain Dobson Iain Dobson

    Thank-you for the information – I wanted the PS cmd as I *usually* prefer it over the CLI but it seems way more complicated than the CLI’s: az vm image list

  2. Nick Maximovich Nick Maximovich

    I appreciate the time you spent documenting these commands; it was exactly what I was looking for. Thanks!

Leave a Reply

Your email address will not be published.