In my previous post, I described how to retrieve a list of available VM sizes and images from Azure using PowerShell. I’ve written two scripts which do exactly that. The scripts allow you to create an availability matrix containing either a list of VM sizes or a list of VM images you can use to deploy your IaaS VMs.
These 2 scripts will output to a CSV file which can be imported in Excel to do filtering. This gives you an easy overview on which VM images are available in which Azure locations. The same goes for VM sizes (eg. Basic_A0, Standard_GS1, etc.).
Usage and Output
Both scripts come with synopsis, so you can use the Get-Help cmdlet on them. In the most basic form, you will need to define the output path (filename) of the CSV file which will be generated. This will prompt you for the credentials to be used and retrieves ALL available Azure locations. For example:
Export-AzureVMImages.ps1 -Path "C:\Data\AzureImages.csv"
Export-AzureVMSizes.ps1 -Path "C:\Data\AzureVMSizes.csv"
If you want to do a comparison of certain Azure locations (eg. availability in West US and West Europe), you can define the -Location parameter:
Export-AzureVMImages.ps1 -Path "C:\Data\AzureImages.csv" -Location "West US 2","West Europe"
As described above, the scripts output to CSV. By default, comma is used as field separator. If you want to modify this, use the -CSVDelimiter parameter to define your preferred separator character. This parameter accepts one or more strings (separated by comma) as value. For example:
Export-AzureVMImages.ps1 -Path "C:\Data\AzureImages.csv" -CSVDelimiter ";"
Once generated, you can open the CSV in Excel:
Feel free to use and modify the scripts in any way you like.
I’ve uploaded the scripts to the Microsoft Technet Gallery. If you like the scripts, don’t forget to give the scripts a rating on the Microsoft Gallery page.
|The script to generate a VM Image (Export-AzureVMImages.ps1) availability matrix is available here: https://gallery.technet.microsoft.com/Generate-Azure-VM-image-756a0119|
|The script to generate a VM Size (Export-AzureVMSizes.ps1) availability matrix is available here: https://gallery.technet.microsoft.com/Generate-Azure-VM-size-3dd9d406|
I hope these scripts are useful, if you have any questions or remarks, please leave a comment or feel free to send me an email.