List of VMs

Ricardo Garin 0 Reputation points
2023-09-28T15:26:45.9333333+00:00

How can I get a list of VMs and their properties (size, OS, location, etc) in all of my subscriptions in Azure? Using my local Linux instance, use curl

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

2 answers

Sort by: Most helpful
  1. Michael Durkan 12,241 Reputation points MVP
    2023-10-07T12:46:56.0633333+00:00

    Hi

    The way to do this is install the Azure CLI for Linux on your Linux instance:

    https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?wt.mc_id=AZ-MVP-5005255&pivots=apt

    You'll need to use the "az vm" commands as opposed to curl to get the required info, commands list here:

    https://learn.microsoft.com/en-us/cli/azure/vm?view=azure-cli-latest&wt.mc_id=AZ-MVP-5005255

    Hope this helps,

    Thanks

    Michael Durkan

    • If the reply was helpful please upvote and/or accept as answer as this helps others in the community with similar questions. Thanks!
    1 person found this answer helpful.
    0 comments No comments

  2. kobulloc-MSFT 26,801 Reputation points Microsoft Employee Moderator
    2023-10-10T01:32:35.4133333+00:00

    Hello, @Ricardo Garin !

    How do I check my VM or other Azure resources using curl from Linux?

    I would agree with recommendation from @Michael Durkan here and use Azure CLI--you can even use Azure cloud shell to avoid installing anything locally.

    If you wanted to, you could create an access token and then use curl to call Azure REST API. These are some guides on how you would do that:

    Once you are able to use curl to call Azure REST API, you can use:

    • Virtual Machines - List All: Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines.

    This will get you size (vmSize), OS (sku, osType), location (location), and much more.


    I hope this has been helpful! Your feedback is important so please take a moment to accept answers.

    If you still have questions, please let us know what is needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!

    User's image

    0 comments No comments

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.