The documentation for this method can be found here
Here is my code:
var appServiceManager = AppServiceManager.Authenticate(credentials, subscriptionId);
var filter = "(name.value eq 'CpuPercentage') and startTime eq '2017-10-06T08:00:00Z' and endTime eq '2017-10-06T09:00:00Z' and timeGrain eq duration'PT1H'";
var metrics = appServiceManager.AppServicePlans.Inner.ListMetricsWithHttpMessagesAsync("myResourceGroupName", "myAppServicePlanName", false, filter).Result;
This is the only detailed exception I get:
One or more errors occurred. (Operation returned an invalid status code 'InternalServerError') ---> Microsoft.Rest.Azure.CloudException: Operation returned an invalid status code 'InternalServerError'
The documentation says that filter
is optional, which it's not (I get a BadRequest if I pass in null
). I'm now providing one and now it throws an internal server error.
I've opened an issue on the azure-sdk-for-net
repo but I'm hoping someone else can see if I'm making any mistakes in my filter
string.
I also can reproduce this issue on my side when using the code you mentioned. I find another Microsoft.Azure.Management.Monitor.Fluent SDK could be used for list the metrics of the resource, it is a beta version. I do a demo on my side, it works correctly on my side.
packages.config