Is there any API to know the vCores, memory, and other details of a machine type

Tasleema Shaik Mohammed 71 Reputation points
2022-09-15T07:39:00.927+00:00

There is a table in the link below

https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/concepts-compute-storage#compute-tiers-vcores-and-server-types

I want to fetch those details through API, is there a way to do that? Or do we have to manually depend on this table?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,800 questions
Azure Database for PostgreSQL
{count} votes

Accepted answer
  1. Bjoern Peters 8,871 Reputation points
    2022-09-15T07:44:57.033+00:00

    Yes, you should get this for your VMs with

    az vm get-instance-view -g MyResourceGroup -n MyVm  
      
    

    or with

    Get-AzVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07"  
    

    https://learn.microsoft.com/en-us/cli/azure/vm?view=azure-cli-latest#az-vm-get-instance-view
    https://learn.microsoft.com/bs-latn-ba/powershell/module/az.compute/get-azvm?view=azps-0.10.0#examples


1 additional answer

Sort by: Most helpful
  1. Vukasin Terzic 351 Reputation points MVP
    2022-09-15T09:27:04.39+00:00

    Hello, are you looking for information about available VMs, or to find more information about your VMs that you currently have deployed?

    If you are looking for a list of available VM configurations, these can be different in every Azure Region, and there are several ways to list all available VM SKUs. You can find it in Azure Portal (when creating new VM), or programatically:

    PowerShell:
    Get-AZVMSize -Location "westus2"

    Azure CLI:
    az vm list-sizes --location "westus2"

    This will return information such as" Name of the VM SKU, number of cores, disk sizes, memory, Max Disc Count, etc.

    If you are looking for something more specific, you can always use Where, for example like this:

    Get-AzVMSize -Location "westus2" | Where {$_.NumberOfCores -gt 16}

    If you need to find information about existing VMs, you can do that like this:

    PowerShell:
    Get-AzVM -ResourceGroupName "RGName" -Name "VMName"

    Azure CLI:
    az vm get-instance-view -g RGName -n VMName

    If you have any more questions please let us know. If this answered your question, please select "Accept this answer" to help me and others looking for a same information.

    Thank you,

    Vukasin


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.