3
votes

I am pretty new to Azure. Following is the task I am trying to achieve:

I wanted to consume Azure Monitor Rest API from .Net application using C# code and wanted to display few metrics(any couple of metrics) on the web page(I am using ASP.Net).

For this, I created Azure AD, got the subscription ID, Tenant ID, Client Secret and Client ID from Azure portal. All that I have to do is from .Net end, which is balance and I couldn't find proper resources to achieve this task.

Can someone help me out in this?

1
What kind of ,NET app are you using to make your API call? A console app or some kind of web app? Or Javascript?Kevin Raffay
i am trying a web app. But anything should be fine form. all I need is to get few metrics of azure monitor and display ituser2083386
Here are some examples using C# and Powershell: docs.microsoft.com/en-us/azure/log-analytics/…Kevin Raffay
@KevinRaffay, Thanks for your response once again. But the article you shared says "HTTP Data Collector API to send data to Log Analytics from a REST API client". But I wanted to access the Azure Metrics API that collects the Metrics data( GET management.azure.com{resourceUri}/providers/microsoft.insights/metricDefinitions?api-version=2018-01-01) and display the metrics(atleast couple of the metrics) in the web page or in console application using C#.net.user2083386
Have you read all the documentation? Google seems to return a lot of info related to that REST API. There are also examples on SO (stackoverflow.com/questions/43288846/…). The API doesn't matter, if you need help understanding how to make REST calls in ASP.NET, please post a new question.Kevin Raffay

1 Answers

7
votes
  1. If you need to extract metric definitions (structure of azure monitor metrics) then you need to use MetricDefinitions web point. Detailed documentation is here.
  2. If you need to get monitoring metric values you need to use Metrics endpoint. Documentation link is here.

For both cases you need to use MonitorClient object from Microsoft.Azure.Management.Monitor nuget package.

You can review good examples how to extract metrics here(extract one-dimension metrics) and here(extract multi-dimension metrics).

Also follow up to couple helpful links: