Retrieve Azure Virtual Machine Size information with PowerShell

One important topic to consider when deploying virtual machines in Azure is the size of the virtual machine as this affects the pricing, but beware that not only virtual machine sizing has a pricing impact other factors like storage and optional features like IP address options add to the costs as well.

A good starting point to get an understanding of virtual machine costs is the Azure pricing calculator: https://azure.microsoft.com/en-in/pricing/calculator/

image

Be aware that when selecting SSD disks, storage costs will be noticeable higher than when using HDD disks. To get a better understanding of the available Azure virtual machine sizes I strongly recommend to the read the following documentation:

Sizes for Cloud Services: https://docs.microsoft.com/en-us/azure/cloud-services/cloud-services-sizes-specs

Premium Storage: High Performance storage for Azure virtual machine workloads: https://docs.microsoft.com/en-us/azure/storage/storage-premium-storage

To keep an overview of the virtual machine size of deployed virtual machines, i wrote a little helper script Get-AzureRmVMSizeSpecs

For example, to get a list of all deployed virtual machines in any resource group in my subscription, I can run the following command:

ForEach ($rg in Get-AzureRmResourceGroup) {Get-AzureRmVMSizeSpecs -ResourceGroupName $rg.ResourceGroupName -Verbose}

The script has two usage modes. When using the –Location parameter, it shows all vmsizes available in the Azure regions the command is similar to the native cmdlet Get-AzureRmVmSize, but this version of the script allows you to select the location from all currently known Azure locations.

When using the –ResourceGroup parameter the script looks for virtual machine resources within the azure resource group and then retrieves the VM size information.


2 Replies to “Retrieve Azure Virtual Machine Size information with PowerShell”

Leave a Reply