Azure AD user's status

Quyen Nguyen 81 Reputation points
2021-08-04T02:30:32.03+00:00

How can i check status ( active or account lock or inactive status) of a user in Azure AD?

Microsoft Entra
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Govind Sharma 11 Reputation points Microsoft Vendor
    2021-08-06T10:05:49.677+00:00

    There are different ways to check whether a user account is active. One method of detecting inactive accounts is by evaluating the lastSignInDateTime property exposed by the signInActivity resource type of the Microsoft Graph API. There are two ways to do this:

    1. If you search for a specific user by name, you can evaluate the lastSignInDateTime:

    https://graph.microsoft.com/beta/users?$filter=startswith(displayName,'markvi')&$select=displayName,signInActivity

    1. You can request a list of users with a lastSignInDateTime before a specified date:

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

    Reference: How to manage inactive user accounts

    You can also check if the user is Enabled using Graph API:

    PATCH https://graph.microsoft.com/v1.0/users/username.msftonlinerepro.com
    { "accountEnabled": true }
    To check if the user is in a blocked sign-in state, you can use the beta endpoint of the Graph API:

    https://graph.microsoft.com/beta/users/{userPrincipalName}

    2 people found this answer helpful.
    0 comments No comments