Get all images list for VMs in Azure

Get all images list for VMs in Azure

When you build your environment in Azure Cloud using IaaC (Infrastructure as a Code) approach, sometimes you will face issues during re-deployment. That's because guys from Microsoft update their VM images with new versions of software. As a result, these new images have new IDs and you must update your ARM or Powershell scripts.

I wrote a script that will help to find new versions of images.

Login-AzureRmAccount;

#Select Region
$location = (Get-AzureRmLocation).location | Out-GridView -Title "Select Azure location" -PassThru;

#Select publisher
$publisher = Get-AzureRmVMImagePublisher -Location $location | Select -ExpandProperty PublisherName | Out-GridView -Title "Select Publisher" -PassThru;

#Get all offers for selected publisher
$Alloffers = @(Get-AzureRmVMImageOffer -Location $location -Publisher $publisher | Select -ExpandProperty Offer);

#Get all images for all skus of all offers for the selected publisher
foreach ($Offer in $Alloffers)
{
    $Allskus = (Get-AzureRmVMImageSku -Location $location -Publisher $publisher -Offer $offer | Select  -ExpandProperty Skus);
    foreach ($sku in $Allskus)
    {
        $Allimages += @(Get-AzureRmVMImage -Location $location -PublisherName $publisher -Offer $offer -Skus $sku);
    }
}

$Allversions = $Allimages | select Version,Skus,Offer,PublisherName | Sort-Object Skus;

Write-Output $Allversions;

 

Here is example output:

 

Version     Skus       Offer                    PublisherName     
-------     ----       -----                    -------------     
11.5.65235  Enterprise SQL2012SP3-WS2012R2      MicrosoftSQLServer
11.3.65235  Enterprise SQL2012SP3-WS2012R2-BYOL MicrosoftSQLServer
11.7.65235  Enterprise SQL2012SP3-WS2012R2-BYOL MicrosoftSQLServer
12.0.44499  Enterprise SQL2014SP1-WS2012R2-BYOL MicrosoftSQLServer
12.9.50001  Enterprise SQL2014SP2-WS2012R2      MicrosoftSQLServer
12.9.50005  Enterprise SQL2014SP2-WS2012R2-BYOL MicrosoftSQLServer
13.5.31640  Enterprise SQL2016-WS2012R2         MicrosoftSQLServer
13.0.400110 Enterprise SQL2016SP1-WS2016        MicrosoftSQLServer
13.0.400110 Enterprise SQL2016SP1-WS2016-BYOL   MicrosoftSQLServer
11.5.65235  Enterprise SQL2012SP3-WS2012R2      MicrosoftSQLServer
11.5.65235  Enterprise SQL2012SP3-WS2012R2      MicrosoftSQLServer
11.3.65235  Enterprise SQL2012SP3-WS2012R2-BYOL MicrosoftSQLServer
12.0.44499  Enterprise SQL2014SP1-WS2012R2-BYOL MicrosoftSQLServer
12.9.50001  Enterprise SQL2014SP2-WS2012R2      MicrosoftSQLServer
12.9.50005  Enterprise SQL2014SP2-WS2012R2-BYOL MicrosoftSQLServer
13.5.31640  Enterprise SQL2016-WS2012R2         MicrosoftSQLServer
13.0.21640  Enterprise SQL2016-WS2012R2-BYOL    MicrosoftSQLServer
13.0.400110 Enterprise SQL2016SP1-WS2016        MicrosoftSQLServer
13.0.500110 Enterprise SQL2016SP1-WS2016        MicrosoftSQLServer
13.0.400110 Enterprise SQL2016SP1-WS2016-BYOL   MicrosoftSQLServer
13.0.500110 Enterprise SQL2016SP1-WS2016-BYOL   MicrosoftSQLServer
11.7.65235  Enterprise SQL2012SP3-WS2012R2-BYOL MicrosoftSQLServer
13.0.400110 Enterprise SQL2016SP1-WS2016-BYOL   MicrosoftSQLServer
13.0.21640  Enterprise SQL2016-WS2012R2-BYOL    MicrosoftSQLServer
13.0.400110 Enterprise SQL2016SP1-WS2016        MicrosoftSQLServer
12.9.50005  Enterprise SQL2014SP2-WS2012R2-BYOL MicrosoftSQLServer
13.0.21640  Enterprise SQL2016-WS2012R2-BYOL    MicrosoftSQLServer
12.9.50001  Enterprise SQL2014SP2-WS2012R2      MicrosoftSQLServer
12.0.44499  Enterprise SQL2014SP1-WS2012R2-BYOL MicrosoftSQLServer
11.7.65235  Enterprise SQL2012SP3-WS2012R2-BYOL MicrosoftSQLServer
13.5.31640  Enterprise SQL2016-WS2012R2         MicrosoftSQLServer
11.3.65235  Enterprise SQL2012SP3-WS2012R2-BYOL MicrosoftSQLServer
2.0.0       Evaluation SQL2017-RHEL73           MicrosoftSQLServer
2.0.0       Evaluation SQL2017-RHEL73           MicrosoftSQLServer
2.0.0       Evaluation SQL2017-RHEL73           MicrosoftSQLServer
13.0.400111 Express    SQL2016SP1-WS2016        MicrosoftSQLServer
13.0.400111 Express    SQL2016SP1-WS2016        MicrosoftSQLServer
12.9.50001  Express    SQL2014SP2-WS2012R2      MicrosoftSQLServer
12.9.50001  Express    SQL2014SP2-WS2012R2      MicrosoftSQLServer
13.0.500110 Express    SQL2016SP1-WS2016        MicrosoftSQLServer
11.5.65235  Express    SQL2012SP3-WS2012R2      MicrosoftSQLServer
11.5.65235  Express    SQL2012SP3-WS2012R2      MicrosoftSQLServer
12.9.50001  Express    SQL2014SP2-WS2012R2      MicrosoftSQLServer
11.5.65235  Express    SQL2012SP3-WS2012R2      MicrosoftSQLServer
13.0.400111 Express    SQL2016SP1-WS2016        MicrosoftSQLServer
13.5.31640  SQLDEV     SQL2016-WS2012R2         MicrosoftSQLServer
13.0.21640  SQLDEV     SQL2016-WS2016           MicrosoftSQLServer
13.0.400111 SQLDEV     SQL2016SP1-WS2016        MicrosoftSQLServer
13.0.500110 SQLDEV     SQL2016SP1-WS2016        MicrosoftSQLServer
13.0.400111 SQLDEV     SQL2016SP1-WS2016        MicrosoftSQLServer
13.0.21640  SQLDEV     SQL2016-WS2016           MicrosoftSQLServer
13.0.21640  SQLDEV     SQL2016-WS2016           MicrosoftSQLServer
13.0.400111 SQLDEV     SQL2016SP1-WS2016        MicrosoftSQLServer
13.5.31640  SQLDEV     SQL2016-WS2012R2         MicrosoftSQLServer
13.5.31640  SQLDEV     SQL2016-WS2012R2         MicrosoftSQLServer
13.0.500110 Standard   SQL2016SP1-WS2016        MicrosoftSQLServer
12.9.50001  Standard   SQL2014SP2-WS2012R2      MicrosoftSQLServer
13.0.400110 Standard   SQL2016SP1-WS2016-BYOL   MicrosoftSQLServer
11.5.65236  Standard   SQL2012SP3-WS2012R2      MicrosoftSQLServer
13.0.21640  Standard   SQL2016-WS2012R2-BYOL    MicrosoftSQLServer
11.5.65236  Standard   SQL2012SP3-WS2012R2      MicrosoftSQLServer
13.0.400110 Standard   SQL2016SP1-WS2016-BYOL   MicrosoftSQLServer
11.7.65236  Standard   SQL2012SP3-WS2012R2-BYOL MicrosoftSQLServer
12.7.50005  Standard   SQL2014SP2-WS2012R2-BYOL MicrosoftSQLServer
13.0.400110 Standard   SQL2016SP1-WS2016        MicrosoftSQLServer
12.7.50005  Standard   SQL2014SP2-WS2012R2-BYOL MicrosoftSQLServer
12.0.444999 Standard   SQL2014SP1-WS2012R2-BYOL MicrosoftSQLServer
13.0.500110 Standard   SQL2016SP1-WS2016-BYOL   MicrosoftSQLServer
13.0.21640  Standard   SQL2016-WS2012R2-BYOL    MicrosoftSQLServer
12.7.50005  Standard   SQL2014SP2-WS2012R2-BYOL MicrosoftSQLServer
12.9.50001  Standard   SQL2014SP2-WS2012R2      MicrosoftSQLServer
13.0.400110 Standard   SQL2016SP1-WS2016        MicrosoftSQLServer
13.0.400110 Standard   SQL2016SP1-WS2016-BYOL   MicrosoftSQLServer
12.0.444999 Standard   SQL2014SP1-WS2012R2-BYOL MicrosoftSQLServer
13.0.400110 Standard   SQL2016SP1-WS2016        MicrosoftSQLServer
12.0.444999 Standard   SQL2014SP1-WS2012R2-BYOL MicrosoftSQLServer
12.9.50001  Standard   SQL2014SP2-WS2012R2      MicrosoftSQLServer
13.0.21640  Standard   SQL2016-WS2012R2-BYOL    MicrosoftSQLServer
11.7.65236  Standard   SQL2012SP3-WS2012R2-BYOL MicrosoftSQLServer
11.7.65236  Standard   SQL2012SP3-WS2012R2-BYOL MicrosoftSQLServer
11.5.65236  Standard   SQL2012SP3-WS2012R2      MicrosoftSQLServer
12.9.50001  Web        SQL2014SP2-WS2012R2      MicrosoftSQLServer
12.5.50000  Web        SQL2012SP3-WS2012R2      MicrosoftSQLServer
12.5.50000  Web        SQL2012SP3-WS2012R2      MicrosoftSQLServer
13.0.400110 Web        SQL2016SP1-WS2016        MicrosoftSQLServer
12.5.50000  Web        SQL2012SP3-WS2012R2      MicrosoftSQLServer
13.0.400110 Web        SQL2016SP1-WS2016        MicrosoftSQLServer
13.0.500110 Web        SQL2016SP1-WS2016        MicrosoftSQLServer
12.9.50001  Web        SQL2014SP2-WS2012R2      MicrosoftSQLServer
12.9.50001  Web        SQL2014SP2-WS2012R2      MicrosoftSQLServer
13.0.400110 Web        SQL2016SP1-WS2016        MicrosoftSQLServer

 

 

script (en), powershell (en), azure (en)

  • Hits: 13763
Add comment

Related Articles