Get a user's last login timestamp with Microsoft Graph

Viewed 439

Is it possible with Microsoft Graph to get the timestamp for last login for a specific user?

Looking in the Microsoft Graph docs I can see that you can use GET https://graph.microsoft.com/v1.0/auditLogs/signIns to get the sign-in details (presumably for all users), however this appears to be a time-consuming query (and that's if it doesn't timeout).

Is it possible to do something like GET https://graph.microsoft.com/v1.0/auditLogs/signIns/{user-ID}?

If anyone knows a work-around to get the equivalent information relatively quickly that'd be really helpful.

Thanks!

1 Answers

The user last Sign activity can be checked from this API.

https://graph.microsoft.com/beta/users?$select=displayName,signInActivity

If you want to check in beta version of graph explorer you can refer this signInActivity.

If you are looking last signin to a specific apps, then you can try MS Graph List signIns with filters like.

/auditLogs/signIns?$filter=userId eq 'userId' AND appDisplayName eq 'Display Name'

Please refer this DOC for more info.

Hope this helps.

Related