When deploying VMs in Azure using template we need to be able to check the VM SKU and sizes to be able to update templates to deploy different OS version and VMs sizes.

There are a few different methods that can be used.
There is the Microsoft document, below is the link to the virtual machine size docs.
https://docs.microsoft.com/en-us/azure/virtual-machines/sizes-general
We can select the type in this case we will use general purpose.

Select the size, I selected ddv5-ddsv5-series. There will be table listing the VM sizes.

We also check the the VM size from the Azure portal by creating a new VM and changing the VM sizes.


Last method is to use either PowerShell or Azure CLI to query the require details on Windows Image SKU and VM sizes.
First we need to install the Azure AZ PowerShell module.
Run the below command to install the AZ module
Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force
Once the module is installed run
Connect-AzAccount
We can use the Get-AzVMImagePulisher to get the publisher name in this case I was looking for Microsoft Windows.
Get-AzVMImagePublisher -Location northeurope | Where-Object {$_.PublisherName -like 'MicrosofWindows*'}

To check all available Windows Server images we can run.
Get-AzVMImageSku -Location northeurope -PublisherName MicrosoftWindowsServer -Offer Windowsserver

We can use where-object filter to by server OS version.
Get-AzVMImageSku -Location northeurope -PublisherName MicrosoftWindowsServer -Offer Windowsserver | Where-Object {$_.Skus -like '2022*'}

To get the VM series size use the below command to check size in the specific region.
Get-AzVMSize -Location northeurope

To filter by a specific cores or name we will use where-object again.
Get-AzVMSize -Location northeurope | Where-Object {$_.Numberofcores -eq '4' -and $_.Name -like 'Standard_D*'}

Now once we have the SKU and Image size we can update our template file with the required VM size and image references.

Is there a way to list Spot supported sizes only using az CLI ?
LikeLiked by 1 person
Hi Parag
Don’t think there is any properties on the VM SKU’s or Sizes that specifies if it supports Azure spot. The Azure spot document shows what VM sizes are not supported thought.
https://docs.microsoft.com/en-us/azure/virtual-machines/spot-vms#limitations
LikeLiked by 1 person