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. You can then specify a Marketplace image when you create a VM programmatically with PowerShell, Resource Manager templates, or other tools.

You can also browse available images and offers using the Azure Marketplace storefront, the Azure portal, or the Azure CLI.

Make sure that you've 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: The 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. Some tools accept an image URN, which 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, then you must accept those terms and enable programmatic deployment. You'll 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 2012-R2-Datacenter
MicrosoftWindowsServer WindowsServer 2012-Datacenter
MicrosoftWindowsServer WindowsServer 2008-R2-SP1
MicrosoftDynamicsNAV DynamicsNAV 2017
MicrosoftSharePoint MicrosoftSharePointServer 2016
MicrosoftSQLServer SQL2017-WS2016 Enterprise
MicrosoftRServer RServer-WS2016 Enterprise

One way to find an image in a location is to run the Get-AzureRMVMImagePublisher, Get-AzureRMVMImageOffer, and Get-AzureRMVMImageSku cmdlets in order:

  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.

  1. List the publishers:

    $locName="<Azure location, such as West US>"
    Get-AzureRMVMImagePublisher -Location $locName | Select PublisherName
  2. Fill in your chosen publisher name and list the offers:

    Get-AzureRMVMImageOffer -Location $locName -Publisher $pubName | Select Offer
  3. Fill in your chosen offer name and list the SKUs:

    Get-AzureRMVMImageSku -Location $locName -Publisher $pubName -Offer $offerName | Select Skus
  4. Fill in your chosen SKU name and get the image version:

    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 example shows the full sequence of commands and their outputs:

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

Partial output:


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. You can optionally replace the version number in the URN with "latest" to get the latest version of the image.

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

Deploy an image with Marketplace terms

Some 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'll need to both accept the image's terms and enable programmatic deployment. You'll only need to do this once per subscription. Afterward, each time you deploy a VM programmatically from the image you'll also need to specify purchase plan parameters.

The following sections show how to:

  • Find out whether 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, so 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   : []

The example below shows a similar command for the Data Science Virtual Machine - Windows 2016 image, which has 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 to 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. Be sure to use all lowercase letters in the parameter values.

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. Be sure to use all lowercase letters in the parameter values.

$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 an image, you can deploy a VM in that 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

$publisherName = "microsoft-ads"

$productName = "windows-data-science-vm"

$planName = "windows2016"

$vmConfig = Set-AzureRmVMPlan -VM $vmConfig -Publisher $publisherName -Product $productName -Name $planName


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

# Set the Marketplace image

$offerName = "windows-data-science-vm"

$skuName = "windows2016"

$version = "0.2.02"

$vmConfig = Set-AzureRmVMSourceImage -VM $vmConfig -PublisherName $publisherName -Offer $offerName -Skus $skuName -Version $version

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

Next steps

To create a virtual machine quickly with the New-AzureRmVM cmdlet 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.