Search code examples
azure-web-app-service

I can't collect VM network interface metrics from Azure using API (HTTP GET API)


When I use the request GET: https://management.azure.com/subscriptions/{{subscription}}/resourceGroups/{{RG}}/providers/Microsoft.Compute/virtualMachines/{{vmName}}/providers/Microsoft.Insights/metrics?api-version=2023-10-01&interval=PT1M&metricnames=Network%20Out%20Total&aggregation=maximum&metricnamespace=Microsoft.Compute%2FvirtualMachines

I have an empty result : {"value": []}

I expect to collect the bandwidth in real-time from IN and OUT network interface for a specific VM. I will display the result in the Dashboard nodered.

I can visualize the data in Azure:

enter image description here

The Oauth2 authentication is OK. I have 200 OK and my other HTTP GET requests work fine. It's not an authentication issue.

I think my request is malformed. Does anyone have any ideas for fixing my issue?


Solution

  • After adding the "Reader" rights for my application on my RG, that works. 200 OK with a request with the bad rights, it's strange.