How to find Windows VM images in the Azure Marketplace with Azure PowerShell

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

Also browse available images and offers using the Azure Marketplace storefront, the Azure portal, or the Azure CLI.

Make sure that you installed and configured the latest Azure PowerShell module.


A Marketplace image in Azure has the following attributes:

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

To identify a Marketplace image when you deploy a VM programmatically, supply these values individually as parameters, or some tools accept the image URN. The URN combines these values, separated by the colon (:) character: Publisher:Offer:Sku:Version. In a URN, you can replace the version number with "latest", which selects the latest version of the image.

If the image publisher provides additional license and purchase terms, you must accept those terms and enable programmatic deployment. You also need to supply purchase plan parameters when deploying a VM programmatically. See Deploy an image with Marketplace terms.

Table of commonly used Windows images

Publisher Offer Sku
MicrosoftWindowsServer WindowsServer 2016-Datacenter
MicrosoftWindowsServer WindowsServer 2016-Datacenter-Server-Core
MicrosoftWindowsServer WindowsServer 2016-Datacenter-with-Containers
MicrosoftWindowsServer WindowsServer 2016-Nano-Server
MicrosoftWindowsServer WindowsServer 2012-R2-Datacenter
MicrosoftWindowsServer WindowsServer 2008-R2-SP1
MicrosoftDynamicsNAV DynamicsNAV 2017
MicrosoftSharePoint MicrosoftSharePointServer 2016
MicrosoftSQLServer SQL2014SP2-WS2012R2 Enterprise
MicrosoftWindowsServerHPCPack WindowsServerHPCPack 2012R2
MicrosoftWindowsServerEssentials WindowsServerEssentials WindowsServerEssentials

Another way to find an image in a location is to run the Get-AzureRMVMImagePublisher, Get-AzureRMVMImageOffer, and Get-AzureRMVMImageSku cmdlets in sequence. With these commands, you determine these values:

  1. List the image publishers.
  2. For a given publisher, list their offers.
  3. For a given offer, list their SKUs.

Then, for a selected SKU, run Get-AzureRMVMImage to list the versions to deploy.

First, list the publishers with the following commands:

$locName="<Azure location, such as West US>"
Get-AzureRMVMImagePublisher -Location $locName | Select PublisherName

Fill in your chosen publisher name and run the following commands:

Get-AzureRMVMImageOffer -Location $locName -Publisher $pubName | Select Offer

Fill in your chosen offer name and run the following commands:

Get-AzureRMVMImageSku -Location $locName -Publisher $pubName -Offer $offerName | Select Skus

Fill in your chosen SKU name and run the following commands:

Get-AzureRMVMImage -Location $locName -Publisher $pubName -Offer $offerName -Sku $skuName | Select Version

From the output of the Get-AzureRMVMImage command, you can select a version image to deploy a new virtual machine.

The following commands show a full example:

$locName="West US"
Get-AzureRMVMImagePublisher -Location $locName | Select PublisherName



For the MicrosoftWindowsServer publisher:

Get-AzureRMVMImageOffer -Location $locName -Publisher $pubName | Select Offer



For the WindowsServer offer:

Get-AzureRMVMImageSku -Location $locName -Publisher $pubName -Offer $offerName | Select Skus



Then, for the 2016-Datacenter SKU:

Get-AzureRMVMImage -Location $locName -Publisher $pubName -Offer $offerName -Sku $skuName | Select Version

Now you can combine the selected publisher, offer, SKU, and version into a URN (values separated by :). Pass this URN with the --image parameter when you create a VM with the New-AzureRmVM cmdlet. Remember that you can optionally replace the version number in the URN with "latest". This version is always the latest version of the image. You can also use the URN with the Set-AzureRMVMSourceImage PowerShell cmdlet.

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

Deploy an image with Marketplace terms

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

To deploy a VM from such an image, you need to accept the image's terms and enable programmatic deployment. You only need to do this one time in your subscription. Then, each time you deploy a VM programmatically from the image, you also need to specify purchase plan parameters.

The following sections show how to:

  • Find out if a Marketplace image has additional license terms
  • Accept the terms programmatically
  • Provide purchase plan parameters when you deploy a VM programmatically

View plan properties

To view an image's purchase plan information, run the Get-AzureRMVMImage cmdlet. If the PurchasePlan property in the output is not null, the image has terms you need to accept before programmatic deployment.

For example, the Windows Server 2016 Datacenter image doesn't have additional terms, because the PurchasePlan information is null:

$version = "2016.127.20170406"
Get-AzureRMVMImage -Location $locName -Publisher $pubName -Offer $offerName -Skus $skuName -Version $version


Id               : /Subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Providers/Microsoft.Compute/Locations/westus/Publishers/MicrosoftWindowsServer/ArtifactTypes/VMImage/Offers/WindowsServer/Skus/2016-Datacenter/
Location         : westus
PublisherName    : MicrosoftWindowsServer
Offer            : WindowsServer
Skus             : 2016-Datacenter
Version          : 2016.127.20170406
FilterExpression :
Name             : 2016.127.20170406
OSDiskImage      : {
                     "operatingSystem": "Windows"
PurchasePlan     : null
DataDiskImages   : []

Running a similar command for the Data Science Virtual Machine - Windows 2016 image shows the following PurchasePlan properties: name, product, and publisher. (Some images also have a promotion code property.) To deploy this image, see the following sections to accept the terms and enable programmatic deployment.

Get-AzureRMVMImage -Location "westus" -Publisher "microsoft-ads" -Offer "windows-data-science-vm" -Skus "windows2016" -Version "0.2.02"


Id               : /Subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Providers/Microsoft.Compute/Locations/westus/Publishers/microsoft-ads/ArtifactTypes/VMIma
Location         : westus
PublisherName    : microsoft-ads
Offer            : windows-data-science-vm
Skus             : windows2016
Version          : 0.2.02
FilterExpression :
Name             : 0.2.02
OSDiskImage      : {
                     "operatingSystem": "Windows"
PurchasePlan     : {
                     "publisher": "microsoft-ads",
                     "name": "windows2016",
                     "product": "windows-data-science-vm"
DataDiskImages   : []

Accept the terms

To view the license terms, use the Get-AzureRmMarketplaceterms cmdlet and pass in the purchase plan parameters. The output provides a link to the terms for the Marketplace image and shows whether you previously accepted the terms. For example:

Get-AzureRmMarketplaceterms -Publisher "microsoft-ads" -Product "windows-data-science-vm" -Name "windows2016"


Publisher         : microsoft-ads
Product           : windows-data-science-vm
Plan              : windows2016
LicenseTextLink   :
PrivacyPolicyLink :
Accepted          : False
Signdate          : 2/23/2018 7:43:00 PM

Use the Set-AzureRmMarketplaceterms cmdlet to accept or reject the terms. You only need to accept terms once per subscription for the image. For example:

$agreementTerms=Get-AzureRmMarketplaceterms -Publisher "microsoft-ads" -Product "windows-data-science-vm" -Name "windows2016"

Set-AzureRmMarketplaceTerms -Publisher "microsoft-ads" -Product "windows-data-science-vm" -Name "windows2016" -Terms $agreementTerms -Accept


Publisher         : microsoft-ads
Product           : windows-data-science-vm
Plan              : windows2016
LicenseTextLink   :
PrivacyPolicyLink :
Accepted          : True
Signdate          : 2/23/2018 7:49:31 PM

Deploy using purchase plan parameters

After accepting the terms for the image, you can deploy a VM in the subscription. As shown in the following snippet, use the Set-AzureRmVMPlan cmdlet to set the Marketplace plan information for the VM object. For a complete script to create network settings for the VM and complete the deployment, see the PowerShell script examples.

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

# Set the Marketplace plan information
$vmConfig = Set-AzureRmVMPlan -VM $vmConfig -Publisher "imagePlanPublisher" -Product "imagePlanProduct" -Name "imagePlanName"


$vmConfig = Set-AzureRmVMOperatingSystem -Windows -VM $vmConfig -ComputerName "myVM" -Credential $cred

# Set the Marketplace image
$vmConfig = Set-AzureRmVMSourceImage -VM $vmConfig -PublisherName "imagePublisher" -Offer "imageOffer" -Skus "imageSku" -Version "imageVersion"

You then pass the VM configuration along with network configuration objects to the New-AzureRmVM cmdlet.

Next steps

To create a virtual machine quickly with New-AzureRmVM by using basic image information, see Create a Windows virtual machine with PowerShell.

See a PowerShell script example to Create a fully configured virtual machine.