user13264138
user13264138

Reputation: 11

How can you build a query for data created in the last 24 hours using Microsoft Graph query?

Trying to filter Azure AD audit events by only querying date that was created in the last 24 hours:

Example: https://graph.microsoft.com/v1.0/auditLogs/signIns?$dateTime,-24

How would I accomplish this?

Upvotes: 1

Views: 1433

Answers (2)

T Gibson
T Gibson

Reputation: 1

I was trying to do this in an Azure Logic App and had to 1) Create a parameter of "startTime" 2) create 2 variables for the startDateTime and endDateTime 3) then use them in the Graph API call.

Two variables HTTP GET Call

Upvotes: 0

Hury Shen
Hury Shen

Reputation: 15754

We can just subtract 24 hours from the current time and set it as the query filter. For example, if the current time is 2020-04-09T07:00:00Z, the time minus 24 hours is 2020-04-08T07:00:00Z. Then we can use the filter in graph api:

https://graph.microsoft.com/v1.0/auditLogs/signIns?$filter=createdDateTime ge 2020-04-08T07:00:00Z

Upvotes: 1

Related Questions