i am trying to access monitoring data using Monitor API.
I am trying to create Monitoring Client using this code in azure functions .net core 3.1 but no nuget seems to resolve it. Can someone suggest the correct nuget
private async Task<MonitorClient> GetMonitorClientAsync()
{
var serviceCreds = await ApplicationTokenProvider.LoginSilentAsync(tenantId, clientId, secret);
var monitorClient = new MonitorClient(serviceCreds);
monitorClient.SubscriptionId = subscriptionId;
return monitorClient;
}
CodePudding user response:
unable to find nuget for MonitorClient
- Use
MonitorManagementClient
in place ofMonitorClient
MonitorManagementClient
is available in theMicrosoft.Azure.Management.Monitor
namespace- Install the latest
0.28.0-preview
version ofMicrosoft.Azure.Management.Monitor
. If it is not available in the Nuget Packages, run the below command in thePackage Manager Console
Install-Package Microsoft.Azure.Management.Monitor -Version 0.28.0-preview
Nuget Packages :
Code :
using Microsoft.Rest.Azure.Authentication;
using Microsoft.Azure.Management.Monitor;
var monitorClient = new MonitorManagementClient(serviceCreds);
References taken from :