When installing a new VM in Azure it’s helpful to know your options
Get-AzureVMImage | Select OS, label
( Get-AzureVMImage | where-object { $_.Label -like "Barracuda*" } ) | Fl OS, publishername, Location, logicalsizeinGB, Label, ImageFamily, ImageName
( Get-AzureVMImage | where-object { $_.Label -like "CentOS*" } ) | Fl OS, publishername, Location, logicalsizeinGB, Label, ImageFamily, ImageName
( Get-AzureVMImage | where-object { $_.Label -like "CoreOS*" } ) | Fl OS, publishername, Location, logicalsizeinGB, Label, ImageFamily, ImageName
( Get-AzureVMImage | where-object { $_.Label -like "Debian*" } ) | Fl OS, publishername, Location, logicalsizeinGB, Label, ImageFamily, ImageName
( Get-AzureVMImage | where-object { $_.Label -like "Oracle Linux*" } ) | Fl OS, publishername, Location, logicalsizeinGB, Label, ImageFamily, ImageName
( Get-AzureVMImage | where-object { $_.Label -like "Red Hat*" } ) | Fl OS, publishername, Location, logicalsizeinGB, Label, ImageFamily, ImageName
( Get-AzureVMImage | where-object { $_.Label -like "SUSE*" } ) | Fl OS, publishername, Location, logicalsizeinGB, Label, ImageFamily, ImageName
( Get-AzureVMImage | where-object { $_.Label -like "Ubuntu*" } ) | Fl OS, publishername, Location, logicalsizeinGB, Label, ImageFamily, ImageName
( Get-AzureVMImage | where-object { $_.Label -like "Windows*" } ) | Fl OS, publishername, Location, logicalsizeinGB, Label, ImageFamily, ImageName
Another example, say you are looking for a specific released version of Red Hat
( Get-AzureVMImage | where-object { $_.Label -like "Red Hat*" -and $_.Location -like "*East US*" } ) | Sort-Object PublishedDate | FT -AutoSize -Wrap publishername,PublishedDate, Label, ImageName
This command currently comes up with this as a response
PublisherName PublishedDate Label ImageName ------------- ------------- ----- --------- Red Hat 2/14/2016 3:00:00 AM Red Hat Enterprise Linux 6.7 a879bbefc56a43abb0ce65052aac09f3__rhel-67-20160214 Red Hat 2/14/2016 3:00:00 AM Red Hat Enterprise Linux 7.2 a879bbefc56a43abb0ce65052aac09f3__rhel-72-20160214 Red Hat 3/1/2016 11:00:00 AM Red Hat Enterprise Linux 6.7 a879bbefc56a43abb0ce65052aac09f3__rhel-67-20160302 Red Hat 3/1/2016 11:00:00 AM Red Hat Enterprise Linux 7.2 a879bbefc56a43abb0ce65052aac09f3__rhel-72-20160302
Get latest image
( Get-AzureVMImage | where-object { $_.Label -like "Red Hat*" -and $_.Location -like "*East US*" } ) | sort PublishedDate -Descending | select -ExpandProperty ImageName -First 1
Originally Posted on April 6, 2016
Last Updated on April 7, 2016
Last Updated on April 7, 2016
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.