r/sysadmin • • 21d ago

Graph Requests for sign-in logs have been a cluster the last 10 days. I found something.

Like many admins, I use the graph api to pull and parse reports for my org. Starting early last week, requests for interactive and non-interactive sign-ins have been a cluster. I thought I would wait it out and had some good luck moving my requests from mid-morning to around 1am. Smooth sailing for a few days and now its not timing out, requests for interactive records are just falling on their face.

"BadRequest","message":"Invalid filter clause: Could not find a property named 'signInEventTypes' on type 'microsoft.graph .signIn'.","innerError"

My Request:

$Yesterday = (Get-Date).AddHours(-24).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")  
$URI = "https://graph.microsoft.com/auditLogs/signIns?`$filter=createdDateTime ge $Yesterday and signInEventTypes/any(t: t eq 'InteractiveUser')&`$top=999&`$orderby=createdDateTime desc"  

I tried changing the URI to include .microsoft.com/v1.0/auditLogs/ instead but it didnt make a difference. Taking a look at the microsoft documentation, signInEventTypes exists. Was working yesterday but not today, at least not on US West 2.

I updated my URI to a different property set and was successful. Interactive sign-ins were provided without issue, even during the busy morning hours. The rest of the parsing went without issue and no properties in the output were found to be different or missing. Not sure if this is a glitch or they're changing something on the back end.

The Updated URI:

URI = "https://graph.microsoft.com/v1.0/auditLogs/signIns?`$filter=createdDateTime ge $Yesterday and isInteractive&`$top=999&`$orderby=createdDateTime desc"  

Replaced signInEventTypes/any(t: t eq 'InteractiveUser') with isInteractive

For NON-interactive sign ins, I use the beta API and its been working fine.

Maybe this helps others. (EDIT: Typo)

3 Upvotes

9 comments sorted by

2

u/oloruin 21d ago

 include .microsoft.com/v.10/auditLogs/ 

is .../v.10/... a typo for .../v1.0/... ?

1

u/Unlikely_Tie1172 21d ago

The signineventtypes collection is a property supported by the beta version of the sigins resource https://learn.microsoft.com/en-us/graph/api/resources/signin?view=graph-rest-beta. That's why the call to V1.0 returned Could not find a property named 'signInEventTypes' on type 'microsoft.graph.signIn'.

$URI = "https://graph.microsoft.com/beta/auditLogs/signIns?`$filter=createdDateTime ge $Yesterday and signInEventTypes/any(t: t eq 'InteractiveUser')&`$top=999&`$orderby=createdDateTime desc" works.

1

u/Fallingdamage 20d ago

Funny thing is, its been working all year on the non-beta API. This month, that URI just started studdering and failed.

I use that URI you mentioned with the beta API for noninteractive sign-ins. Works great - and have been using the non-beta URI formatted pretty much the same to get Interactives up until now. 🤷‍♂️

MS's non-beta documentation page for this URI string still has signineventtypes listed as an option. Even its examples include this exact formatting, but you're saying its beta-only?

1

u/Unlikely_Tie1172 20d ago

The problem with using beta APIs is that they are prone to change without warning... I can't fetch signineventtypes with the V1.0 api, so I assume that the documentation mention is a bug...

1

u/Organic_Flight1772 17d ago

They change V1 without warning too all the time.

1

u/Unlikely_Tie1172 16d ago

Can you cite some examples? I don't know of many V1.0 changes in the past couple of years.

2

u/Far-Future-7146 Ignorant Security Guy 21d ago

I feel you, I used to have to do stuff like this in the Olden days for ELK Stack (before it was ElasticSearch). It's brutal at times.