ActivityLogs DefineQuery Bad Request
See original GitHub issuevar log = await Repo.ActivityLogs
.DefineQuery()
.StartingFrom(DateTime.Now.AddDays(-7))
.EndsBefore(DateTime.Now)
.WithAllPropertiesInResponse()
.FilterByResource(id)
.ExecuteAsync();
Operation returned an invalid status code ‘BadRequest’ Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Microsoft.Azure.Management.Monitor.Fluent.Models.ErrorResponseException: Operation returned an invalid status code ‘BadRequest’
[ErrorResponseException: Operation returned an invalid status code 'BadRequest']
Microsoft.Azure.Management.Monitor.Fluent.<ListWithHttpMessagesAsync>d__5.MoveNext() +4302
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +60
Microsoft.Azure.Management.Monitor.Fluent.<ListAsync>d__0.MoveNext() +354
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +60
Microsoft.Azure.Management.Monitor.Fluent.<<ListEventDataAsync>b__0>d.MoveNext() +288
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +60
Microsoft.Azure.Management.ResourceManager.Fluent.Core.<LoadPageWithWrapModelAsync>d__16.MoveNext() +376
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +60
Microsoft.Azure.Management.ResourceManager.Fluent.Core.<LoadPage>d__15.MoveNext() +434
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +60
Microsoft.Azure.Management.Monitor.Fluent.<ListEventDataAsync>d__10.MoveNext() +476
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +60
Microsoft.Azure.Management.Monitor.Fluent.<ExecuteAsync>d__16.MoveNext() +456
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +60
Microsoft.Azure.Management.Monitor.Fluent.<Microsoft-Azure-Management-Monitor-Fluent-IWithActivityLogsQueryExecute-ExecuteAsync>d__35.MoveNext() +198
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +60
System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +31
.Monitoring.<QueryAzure>d__4.MoveNext() in AzureActivityLogService.cs:109
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +60
System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +31
PppLearning.DevOps.MSAzure.Monitoring.<GetLogs>d__3.MoveNext() in AzureActivityLogService.cs:34
- Using v1.16.1 Fluent Nuget Packages
- ASP.net 4.7.2
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:8 (4 by maintainers)
Top Results From Across the Web
I get Bad Request every time i try to create an azure function
Today, I try to create an azure function instance but, everytime I try to create one I get a Bad Request Error
Read more >Log Analytics Error 400 Bad Request
Solved: I'm using the export to Power BI (M query) functionality thorugh azure log analytics. The dashboard was working since a week ago,...
Read more >API defender for endpoint bad request - Microsoft Q&A
I am trying advanced hunting queries towards the endpoint "[https://api-eu.securitycenter.microsoft.com/api/advancedqueries/run".
Read more >Response status code does not indicate success: 400 (Bad ...
A 400 is a client error which usually means the request is malformed. 400 in particular means that the request could not be...
Read more >Bad request
Cause. Adyen APIs return this error when: The request is malformed or is not in the expected format. Solution. Check the syntax and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@hovsepm - found the problem. I am in AEST timezone. If I change the timestamp to be UTC now it works without an issue.
var log = await Repo.ActivityLogs .DefineQuery() .StartingFrom(DateTime.Now.AddDays(-1).ToUniversalTime()) .EndsBefore(DateTime.Now.ToUniversalTime()) .WithAllPropertiesInResponse() .FilterByResource(id) .ExecuteAsync();
I will keep this issue open for some time until back-end service team will provide better error messages 😃