List all available VM SKU excluding preview, with API or CLI

Edyta 20 Reputation points
2024-04-08T10:11:53.5633333+00:00

As in the title, I am trying to get a list of all available VM SKUs in a location. I have tried both

az vm list-skus --location
az vm list-sizes --location

but there I don't see information if it is in a preview or general availabillity. I was looking at this Compute API and [Billing API], but again I don't see that information.

Comparing the result I get to the Microsoft's website, I see that my results contain SKUs also in a preview. I know that the page I am looking at is for 'informational purposes only', but I am confused which source is reliable when it comes to preview vs GA.

Is there a programatic way to get a list of all avaiable VM SKUs only in general avability?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,035 questions
0 comments No comments
{count} votes

Accepted answer
  1. Deepanshu katara 16,720 Reputation points MVP Moderator
    2024-04-10T07:11:44.9033333+00:00

    Issue: To determine whether a specific VM SKU is supported, whether it is in GA or Public Preview,

    And if possible have a programmatic solution for this.

    Solution provided-->

    1. Azure Marketplace: Check the Azure Marketplace to see if the VM SKU is listed under the Virtual Machines category. VM SKUs available in the Azure Marketplace are typically GA .https://azuremarketplace.microsoft.com/en-us/
    2. Azure Updates Blog: The Azure Updates Blog is regularly updated with announcements about new features, updates, and availability status of Azure services, including Virtual Machines. Blog Link: Azure Updates Blog
    3. Azure Virtual Machines Documentation: Visit the Azure Virtual Machines documentation for detailed information about VM offerings, including their availability status, features, and supported scenarios. Microsoft regularly updates its documentation to reflect the current status of VM SKUs. Check this for you case https://learn.microsoft.com/en-us/azure/virtual-machines/ngads-v-620-series
    4. Azure Portal: You can also check the Azure Portal for the availability status of VM SKUs in your subscription and region. The portal provides information about VM offerings and their availability status

    And solutions to fetch it programmatically

    1. Azure Management APIs: You can use the Azure Resource Manager REST APIs to programmatically query information about Azure VM SKUs. Specifically, you would use the Microsoft.Compute/skus API to list available SKUs and their details. You can filter the results based on various parameters such as location, resource type, and availability status. please check this doc --> https://learn.microsoft.com/en-us/rest/api/compute/resource-skus/list?view=rest-compute-2024-03-01&tabs=HTTP
    2. Azure CLI: Azure CLI provides commands to list available VM SKUs and their details. You can use the az vm list-skus command to list SKUs available for virtual machines in a specific location. You can further filter the results based on parameters such as location, resource group, and availability status.

    Please accept answer , as it helped , Thankyou!

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Deepanshu katara 16,720 Reputation points MVP Moderator
    2024-04-08T11:03:47.21+00:00

    Hi , Welcome to MS Q&A, I tried to stimulate in my env. using below steps , results attached in below Image.

    Yes we can use PS script to solve your requirement

    Please find below steps

    1. To determine which SKUs are available in a location or zone, use the Get-AzComputeResourceSku command.
         Get-AzComputeResourceSku | Where-Object { $_.Locations -contains "centralus" }
         
         
         
      
    2. The Get-AzComputeResourceSku cmdlet gets all the compute resources. The objects are sent down the pipeline and Where-Object filters the output to include only the specified location. SKUs that aren't available for the current subscription are listed as NotAvailableForSubscription.

    The following PowerShell script filters by location and SKU:

    $SubId = (Get-AzContext).Subscription.Id
    
    $Region = "centralus" # change region here
    $VMSku = "Standard_D" # change VM SKU here
    
    $VMSKUs = Get-AzComputeResourceSku | where {$_.Locations.Contains($Region) -and $_.ResourceType.Contains("virtualMachines") -and $_.Name.Contains($VMSku)}
    
    $OutTable = @()
    
    foreach ($SkuName in $VMSKUs.Name)
            {
                $LocRestriction = if ((($VMSKUs | where Name -EQ $SkuName).Restrictions.Type | Out-String).Contains("Location")){"NotAvailableInRegion"}else{"Available - No region restrictions applied" }
                $ZoneRestriction = if ((($VMSKUs | where Name -EQ $SkuName).Restrictions.Type | Out-String).Contains("Zone")){"NotAvailableInZone: "+(((($VMSKUs | where Name -EQ $SkuName).Restrictions.RestrictionInfo.Zones)| Where-Object {$_}) -join ",")}else{"Available - No zone restrictions applied"}
    
    $OutTable += New-Object PSObject -Property @{
                                                             "Name" = $SkuName
                                                             "Location" = $Region
                                                             "Applies to SubscriptionID" = $SubId
                                                             "Subscription Restriction" = $LocRestriction
                                                             "Zone Restriction" = $ZoneRestriction
                                                             }
             }
    
    $OutTable | select Name, Location, "Applies to SubscriptionID", "Subscription Restriction", "Zone Restriction" | Sort-Object -Property Name | Format-Table
    
    
    

    If a SKU isn't available for your subscription in a location or zone that meets your business needs, submit a SKU request to Azure Support.

    Ref Image of output look like

    User's image

    Please ref this doc for detailed steps and you can follow this for your verifications

    https://learn.microsoft.com/en-us/azure/azure-resource-manager/troubleshooting/error-sku-not-available?tabs=azure-powershell&tryIt=true&source=docs#code-try-10

    Kindly accept answer , if it helps, Thankyou!


  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.