how to get lastlogindate of each azure ad users

Shraddha Kurjekar 1 Reputation point
2020-11-19T11:09:28.077+00:00

I wanted to know to to get lastlogindate of azure ad users programmatically. How to get lastlogindate...? what should I used to get lastlogindate? different ways to get it?

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,691 questions
{count} votes

1 answer

Sort by: Most helpful
  1. 2020-11-19T19:57:11.737+00:00

    Hello @Shraddha Kurjekar for development (non production) purposes you can use the user signInActivity property. You can get one or more using MS Graph Beta get and list users operations.
    For production purposes you can use MS Graph v1.0 List signIns operation and filter by user like this:

    GET https://graph.microsoft.com/v1.0/auditLogs/signIns?$filter=userId eq '<user object id>'&$top=1

    Let us know if this answer was helpful to you. If so, please remember to accept it so that others in the community with similar questions can more easily find a solution.