Learning and Sharing
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
No Result
View All Result

How to Find Azure Marketplace VM Images with Azure PowerShell

March 25, 2023
in Blog, Microsoft Azure, Powershell
0
ADVERTISEMENT

Table of Contents

This article describes how to use Azure PowerShell to find VM images in the Azure Marketplace. You can then specify a Marketplace image and plan information when you create a VM.

 

Terminology

A Marketplace image in Azure has the following attributes:

  • Publisher: The organization that created the image. Examples: Canonical, MicrosoftWindowsServer
  • Offer: The name of a group of related images created by a publisher. Examples: UbuntuServer, WindowsServer
  • SKU: An instance of an offer, such as a major release of a distribution. Examples: 18.04-LTS, 2019-Datacenter
  • Version: The version number of an image SKU.

List Publishers

Before you begin, let’s connect to Microsoft Azure using PowerShell.

You can use PowerShell to narrow down a list of images. Replace the values of the variables to meet your needs.

List the image publishers using Get-AzVMImagePublisher.

$locName="EastUS"
Get-AzVMImagePublisher -Location $locName | Select PublisherName

For example, we’ll get the list of the Publishes for Windows OS in the East US location.:

PS C:\> Get-AzVMImagePublisher -Location $locName | `
Where-Object { ($_.PublisherName -like '*MicrosoftWindows*')}

#Output
PublisherName                 Location
-------------                 --------
MicrosoftWindowsDesktop       eastus
MicrosoftWindowsServer        eastus
MicrosoftWindowsServerHPCPack eastus

List Image Offers

For a given publisher, list their offers using Get-AzVMImageOffer.

$pubName="<publisher>"
Get-AzVMImageOffer -Location $locName -PublisherName $pubName | Select Offer

For example, we’ll get the list of image offers for Windows Desktop.

PS C:\> $locName = "EastUS"
PS C:\> $pubName = "MicrosoftWindowsDesktop"
PS C:\> Get-AzVMImageOffer -Location $locName -PublisherName $pubName | Select Offer

#Output
Offer
-----
Windows-10
windows-10-1607-vhd-client-prod-stage
windows-10-1803-vhd-client-prod-stage
windows-10-1809-vhd-client-office-prod-stage
windows-10-1809-vhd-client-prod-stage
windows-10-20h2-vhd-client-office-prod-stage
windows-10-20h2-vhd-client-prod-stage
windows-10-ppe
windows-11
windows-7
windows-7-0-sp1-vhd-client-prod-stage
windows-ent-cpc
windows-evd
windows10preview
windows11preview
windows11preview-arm64

List Image Skus

For a given publisher and offer, list the SKUs available using Get-AzVMImageSku.

$offerName="<offer>"
Get-AzVMImageSku -Location $locName -PublisherName $pubName -Offer $offerName | Select Skus
PS C:\> $locName = "EastUS"
PS C:\> $pubName = "MicrosoftWindowsDesktop"
PS C:\> $offerName = "windows-11"
PS C:\> Get-AzVMImageSku -Location $locName -PublisherName $pubName -Offer $offerName | Select Skus

#Output
Skus
----
win11-21h2-avd
win11-21h2-ent
win11-21h2-entn
win11-21h2-pro
win11-21h2-pro-zh-cn
win11-21h2-pron
win11-22h2-avd
win11-22h2-ent
win11-22h2-entn
win11-22h2-pro
win11-22h2-pro-zh-cn
win11-22h2-pron

List Images

For a SKU, list the versions of the image using Get-AzVMImage.

Note Note: You can also use latest if you want to use the latest image and not a specific older version.
$skuName="<SKU>"
Get-AzVMImage -Location $locName -PublisherName $pubName -Offer $offerName -Sku $skuName 
PS C:\> $locName = "EastUS"
PS C:\> $pubName = "MicrosoftWindowsDesktop"
PS C:\> $offerName = "windows-11"
PS C:\> $skuName= "win11-22h2-pro"
PS C:\> Get-AzVMImage -Location $locName -PublisherName $pubName -Offer $offerName -Sku $skuName 

#Output
Version
-------
22621.1105.230107
22621.1265.230207
22621.1413.230310
22621.819.221105
22621.963.221209

Now you can combine the selected publisher, offer, SKU, and version into a URN. Pass this URN with the -Image parameter when you create a VM with the New-AzVM cmdlet. You can also replace the version number in the URN with latest to get the latest version of the image.

ADVERTISEMENT

Create a new VM from a marketplace image

If you already have the information about what image you want to use, you can pass that information into Set-AzVMSourceImage cmdlet to add image information to the VM configuration.

...

$vmConfig = New-AzVMConfig -VMName "myVM" -VMSize Standard_D1

# Set the Marketplace image
$publisherName = "MicrosoftWindowsServer"
$offerName = "WindowsServer"
$skuName = "2019-Datacenter"
$version = "latest"
$vmConfig = Set-AzVMSourceImage 
    -VM $vmConfig 
    -PublisherName $publisherName 
    -Offer $offerName 
    -Skus $skuName 
    -Version $version

...
$locName="EastUS"
Get-AzVMImagePublisher -Location $locName | Select PublisherName

$pubName="<publisher>"
Get-AzVMImageOffer -Location $locName -PublisherName $pubName | Select Offer

$offerName="<offer>"
Get-AzVMImageSku -Location $locName -PublisherName $pubName -Offer $offerName | Select Skus


$skuName="<SKU>"
Get-AzVMImage -Location $locName -PublisherName $pubName -Offer $offerName -Sku $skuName 
5/5 - (1 vote)
Previous Post

How to Find the VM Image Used to Create an Azure VM using PowerShell

Next Post

How to Create a Azure VM using PowerShell

Related Posts

Running Hyper-V and VMware Workstation on The Same Machine

August 15, 2024

How to Uninstall All Autodesk Products At Once Silently

July 29, 2024
Ftr5

How to Uninstall the Autodesk Genuine Service on Windows

July 29, 2024
Ftr19

How to Fix Windows Cannot Read the ProductKey From the Unattend Answer File in VirtualBox

July 26, 2024
Ftr25

How to Update Windows Terminal in Windows 10/11

July 26, 2024

How to Disable The Beep Sound in WSL Terminal on Windows

July 26, 2024

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • How To Turn On uBlock Origin Extension in Chrome (2025)
  • Images Hidden Due To Mature Content Settings In CivitAI
  • Azure OpenAI vs Azure AI Hub, How to Choose the Right One for Your Needs

Categories

Stay in Touch

Discord Server

Join the Discord server with the site members for all questions and discussions.

Telegram Community

Jump in Telegram server. Ask questions and discuss everything with the site members.

Youtube Channel

Watch more videos, learning and sharing with Leo ❤❤❤. Sharing to be better.

Newsletter

Join the movement and receive our weekly Tech related newsletter. It’s Free.

General

Microsoft Windows

Microsoft Office

VMware

VirtualBox

Technology

PowerShell

Microsoft 365

Microsoft Teams

Email Servers

Copyright 2025 © All rights Reserved. Design by Leo with ❤

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory