Azure AD B2C | Sign in Activity

Abhay Chandramouli 1,031 Reputation points
2022-07-25T09:50:35.627+00:00

Hi,
I want to know if we are able to query for users who have logged in before a certain date ?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,337 questions
Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
2,931 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sheena-MSFT 1,736 Reputation points
    2022-07-25T13:26:58.933+00:00

    Hi @Abhay Chandramouli ,

    You can use signinactivity resource type in the Graph API to query the users who have logged in begore a certain date.

    https://graph.microsoft.com/beta/users?$$filter=signInActivity/lastSignInDateTime le '2014-01-01T00:00:00Z'  
    

    Supports $filter (eq, ne, not, ge, le) but, not with any other filterable properties. 

    Note: Details for this property require an Azure AD Premium P1/P2 license and the AuditLog.Read.All permission. There's a known issue with retrieving this property. This property is not returned for a user who has never signed in or last signed in before April 2020.

    Important: APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported.

    Reference: https://learn.microsoft.com/en-us/graph/api/resources/user?view=graph-rest-beta#properties
    https://learn.microsoft.com/en-us/graph/api/user-list?view=graph-rest-beta&tabs=http

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Kholofelo 66 Reputation points
    2024-07-07T23:45:31.2733333+00:00

    This is possible via Microsoft Graph sign-in activity

    https://learn.microsoft.com/en-us/graph/api/resources/signinactivity?view=graph-rest-1.0

    Audit log permission is needed for this

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.