[User story] ....Code to retrieve metrics for multiple resources at one time
srini1978 opened this issue · 0 comments
As a developer I want to build a method to retrieve CPU percentage for multiple VMs in the same subscription , so that I can query and retrieve metrics for multiple resources in one call.
Input parameters: Subscriptionid, timespan, metricname, Aggregration type, region name and filter
ensure the right permission is there for the code to retrive multiple metrics.
Note: The individual resource metrics APIs requires a user have the Monitoring Reader permission on the resource being queried. Because the multi resource metrics APIs are subscription level APIs, users must have the Monitoring Reader permission for the queried subscription to use the multi resource metrics APIs. Even if users have Monitoring Reader on all the resources in a subscription, the request fails if the user doesn't have Monitoring Reader on the subscription itself.
Article for retrieving one for one resource -https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/rest-api-walkthrough?tabs=portal#retrieve-metric-values
For more than one resource but per resource type - https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/rest-api-walkthrough?tabs=portal#querying-metrics-for-multiple-resources-examples