Pages

Wednesday, 11 January 2017

How to find all the available Windows Server 2012 R2 images in Azure in Powershell (Service Manager)

The following command can be used to outline all the available Windows Server 2012 R2 images that are available to you when creating Azure VM's (Service Manager). 

( Get-AzureVMImage | where-object { $_.Label -like "Windows Server 2012 R2*" } )

You can of course change the label string if you are looking for something else. 

When the command returns the results it is the "ImageName" property that is required for commands such as New-AzureVMConfig.

In an example I needed to reference a Windows Server based image in order to spin up a new VM using Service Manager.

New-AzureVMConfig -Name vmhostname -InstanceSize Small -ImageName "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-20161214-en.us-127GB.vhd"