I wanna ask how I use rest api to get VM information of vmSizeProperties

박현우 1 Reputation point
2022-11-15T05:41:46.403+00:00

Dear sir,
This is Hyunwoo Park, cloud engineer.

Through https://learn.microsoft.com/ko-kr/rest/api/compute/virtual-machines/list?tabs=HTTP#virtualmachines_list_minimumset_gen,
I got to know about using rest-api to get vm information.

I found that I could get VM size properties such as vCPUsAvailable, vCPUsPerCore through the example of above web page.
But, when I used api, I only got the vmSize(SKU information), I couldn't get those information.
Can you tell me how to get VM size properties like vCPUsAvailable and vCPUsPerCore?

I captured the picture and posted it together.
Please Check and let me know how I can solve this situation.
260392-image.png

Best Regards,

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

1 answer

Sort by: Most helpful
  1. Prrudram-MSFT 28,201 Reputation points Moderator
    2022-11-17T19:27:33.417+00:00

    Hello @박현우 ,

    Thank you for reaching out to the Microsoft Q&A platform. Happy to answer your question.

    It appears you have used the very first GET api from the document, which will only list all of the virtual machines in the specified resource group with limited properties.

    You have used this
    GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines?api-version=2022-08-01

    I get the same results for the above as you

    261546-image.png

    You should use this VirtualMachines_List_MaximumSet_Gen api to get the details such as vCPUsAvailable, vCPUsPerCores etc

    GET https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachines?$filter=aaaaaaaaaaaaaaaaaaaaaaa&api-version=2022-08-01

    Note: You could use any api tool like Postman API tool for running the azure rest apis, for details on how to use Azure REST APIs with Postman see the below link
    https://microsoft.github.io/AzureTipsAndTricks/blog/tip223.html

    Hope this helps!
    Please "Accept as Answer" and Upvote if the answer provided is useful, so that you can help others in the community looking for remediation for similar issues.


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.