How to list available Azure VM images using PowerShell

0
4
views

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!

Previous articleOffice 365 Groups Activity Report
Next articleHow to encrypt an Azure Virtual Machine
About Me ? I Guess i would start by saying i am a family guys and full time SysAdmin and Tech Junky. This Blog is my first attempt to share information about daily issues i come across as a SysAdmin as well as some new deployments i am part of. Topics that i will cover will mostly be about Office 365,Windows,Exchange as well as Active Directory. I hope some of my Blog posts helps someone #LiveLongAndBeLazy #Exchange #Office 365 #ActiveDirectory #Hyper-V
SHARE

LEAVE A REPLY

Please enter your comment!
Please enter your name here