How to find Total/Maximum memory of a given VM with an azure API (Azure monitor?)

Badrinath V 0 Reputation points
2023-02-22T08:14:50.0033333+00:00

For fetching memory metrics of a VM, I used to rely on %memory utilization provided by Azure Datatables (WAD). Now that Azure-Monitor provides Memory Available Bytes as a metric (feature in Preview), how to get Total/Maximum memory of a VM so that I can calculate memory-utilzation myself without need of Datatables (WAD).
Thanks in advance.

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,826 questions
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,196 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Pramod Valavala 20,591 Reputation points Microsoft Employee
    2023-03-30T19:11:36.6633333+00:00

    @Badrinath V You should be able to get the vmSize by calling the Virtual Machines - Get REST API and then get the memoryInMB value for that size from the Virtual Machine Sizes - List REST API.

    Depending on the language you are using for your code, you could use the respective Azure SDKs as well.

    0 comments No comments