Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get-AzureRMVmImage cmdlet doesn't list all the available vm images

I am trying to get all the available VM images for AzureRM using Get-AzureRMVMImage and it doesn't list any images like the command Get-AzureVMImage

If I follow the example given on the help for Get-AzureRMVmImage then it doesn't list that Ubuntu VM. Below is me trying to get Windows 2012 R2 Datacenter Image.

PS C:\> Get-AzureRMVMImage -location "Central us" -publisherName "Microsoft" -offer "Windows Server 2012 R2 DataCenter"
Get-AzureRmVMImage : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Get-AzureRMVMImage -location "Central us" -publisherName "Microsoft"  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-AzureRmVMImage], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.Azure.Commands.Compute.GetAzureVMImageCommand

What is the correct cmdlet with parameters to list the available RM vm images?

like image 939
Mitul Avatar asked Dec 10 '22 17:12

Mitul


1 Answers

The problem you are having is that the image you are looking for doesn't exist. Both the offer and publisher name you have are incorrect.

To find an image you need to go through a set of cmdlets in a specific order.

So firstly you get the correct publisher with

Get-AzureRmVMImagePublisher -Location westeurope  

It can be difficult to know which Microsoft publisher you need to select from that particular list. However, if you plug in the result into

Get-AzureRmVMImageOffer -Location westeurope `
                        -PublisherName microsoft  

This uses the 'microsoft' publisher name and gives this list

Offer

IBM
JDK
Oracle_Database_11g_R2
Oracle_Database_11g_R2_and_WebLogic_Server_11g Oracle_Database_12c
Oracle_Database_12c_and_WebLogic_Server_12c
Oracle_WebLogic_Server_11g
Oracle_WebLogic_Server_12c

Clearly not what you're looking for! if you look through the publisher list again there is this however

Get-AzureRmVMImageOffer -Location westeurope `
                        -PublisherName MicrosoftWindowsServer

which gives

Offer

WindowsServer

you then need to find the sku with

Get-AzureRmVMImagesku -Location westeurope `
                      -PublisherName MicrosoftWindowsServer `
                      -Offer windowsserver

Skus

2008-R2-SP1
2012-Datacenter
2012-R2-Datacenter
2016-Nano-Docker-Test
2016-Nano-Server-Technical-Preview
2016-Technical-Preview-with-Containers Windows-Server-Technical-Preview

So at the end of that who thing, the command you're looking for is

Get-AzureRMVMImage -location "Central us" `
                   -publisherName "MicrosoftWindowsServer" `
                   -sku "2012-R2-Datacenter" `
                   -Offer windowsserver

For this particular image there are also versions that you need to take into account, so once you run that you can select a version to use, so to get the latest version you would use

Get-AzureRMVMImage -location "Central us" `
                   -publisherName "MicrosoftWindowsServer" `
                   -sku "2012-R2-Datacenter" `
                   -Offer windowsserver `
                   -Version 4.0.20160229
like image 160
Michael B Avatar answered May 09 '23 10:05

Michael B