Closed rohit8github closed 6 years ago
The issue was: 'timespan' in the REST query formed was not in correct format. The supported format is Iso 8601 time interval format: (Datetime/Datetime, Datetime/Duration, Duration/Datetime, Duration)".
Once fixed, code the running fine.
The issue was: 'timespan' in the REST query formed was not in correct format. The supported format is Iso 8601 time interval format: (Datetime/Datetime, Datetime/Duration, Duration/Datetime, Duration)".
Once fixed, code the running fine.
Hi @rohit8github I am facing a similar issue while running "get-azdiagnosticsetting -resourceID". Can you please help me to resolve this issue. How I can format the datetime. Please provide a detailed explanation to solve this. Appreciate your help.
I am using azure free trial subscription. and i follow the steps as per Readme.md. I run as below dotnet run --framework=net452
The code runs fine and logging the messages however throws exception at // get metric records var metricCollection = metricDefinition.DefineQuery() .StartingFrom(recordDateTime.AddDays(-7)) .EndsBefore(recordDateTime) .WithAggregation("Average") .WithInterval(TimeSpan.FromMinutes(5)) .WithOdataFilter("apiName eq 'PutBlob' and responseType eq 'Success' and geoType eq 'Primary'") .Execute();
and the exception it throws(below in bold):
Selected subscription: 6530e9bf-585e-437f-8e72-7216ea351041 Creating a Storage Account Created a Storage Account: samonitor48692 created @ 3/14/2018 2:09:22 PM Inside function AddBlobTransactions Coming out of function AddBlobTransactions Storage Account Id: /subscriptions/6530e9bf-585e-437f-8e72-7216ea351041/resourceGroups/rgmonitor96540/providers/Microsoft.Storage/storageAccounts/samonitor48692 Inside foreach loop Inside foreach loop MetricDefinitions: Transactions Deleting Resource Group: rgmonitor96540 Deleted Resource Group: rgmonitor96540 Microsoft.Azure.Management.Monitor.Fluent.Models.ErrorResponseException: Operation returned an invalid status code 'BadRequest' at Microsoft.Azure.Management.Monitor.Fluent.MetricsOperations.d5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.Monitor.Fluent.MetricsOperationsExtensions.d 0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.Monitor.Fluent.Models.MetricDefinitionImpl.d__51.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.ResourceManager.Fluent.Core.Extensions.Synchronize[TResult](Func`1 function)
at QueryMetricsAndActivityLogs.Program.RunSample(IAzure azure)
at QueryMetricsAndActivityLogs.Program.Main(String[] args)
I believe the error is something with the query, because the response is 'BadRequest'
Please help