1

I want to know if there is any way where I can pull the vm sizes that are available for my subscription.

I referred to the below article and command to pull the output.

https://docs.microsoft.com/en-us/powershell/module/az.compute/get-azcomputeresourcesku?view=azps-3.8.0

I selected a subsctiption and then ran the below command to get the available vm sizes. "Get-AzComputeResourceSku | Where-Object {$.Locations.Contains("northeurope") -and $.Restrictions.ReasonCode -ne 'NotAvailableForSubscription'}"

The output of above command is good, its giving me vm sizes which are available and not available at a subscription level. The problem is the output shows some VM skus are not available at subscription but I can able to create vm where it shows vm skus is not available.

I need help to get the vm sizes available to a subscription which are currently active and which are actually available for deployment and which are really not available for the subscription..

2 Answers2

0

I'm sure there is a similar Powershell cmdlet, but I would use this through the Azure CLI:

az vm list-sizes --location "your region"

This by default only gives you the vms available in the current subscription. If you want other info, you can also use az vm list-sku instead.

discondor
  • 139
  • 3
  • yeah, this also give the same output, A small example i want to give about the output. I am getting the output where Standard_A1 or Standard_A2 vm sizes as not available, but from portal I can able to create the VM using the same size. I am trying to pull all the available sizes which are actually available and which are really not available at a region for a subscription. – hemanth reddy Apr 29 '20 at 09:15
  • for what sort of subscription and region are you trying this? I see no discrepancy between the portal and azcli/powershell in for instance West Europe – discondor May 04 '20 at 14:28
  • I am using for a normal subscription which is purchased. In the above comments, I explained about my issue. I could see the difference in the output of powershell/Azcli with actually what is available in the portal – hemanth reddy May 08 '20 at 09:03
0

Might be too late to help you now, but I will try answering this anyways.

The command provided above by discondor will show all possible sizes, without any consideration for subscription.

Use this instead (for Powershell module):

Get-AzComputeResourceSku | Where-Object { $_.Locations -contains "australiacentral" }

OR (for cloud shell bash):

az vm list-skus --location australiacentral --all --output table

Documentation: https://docs.microsoft.com/en-us/azure/azure-resource-manager/troubleshooting/error-sku-not-available?tabs=azure-powershell

Aamir Mulla
  • 61
  • 1
  • 2