How to pull Guest accounts details with last login details

Anonymous
2023-12-04T12:15:54.9766667+00:00

Hi Team,

Am looking to Pull the Guest account details with users last Sign-In details so that we can find out which Guest user account is currently in-use actively and which are not.

User's image

Microsoft Security | Microsoft Entra | Microsoft Entra External ID
Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Andy David - MVP 157.8K Reputation points
    2023-12-04T12:45:37.1166667+00:00

  2. JamesTran-MSFT 36,911 Reputation points Microsoft Employee Moderator
    2024-01-04T19:13:09.2666667+00:00

    @Prince Chauhan

    Thank you for your post and I apologize for the delayed response!

    To pull the Guest account details with users last Sign-In details, you should be able to leverage the Microsoft Graph API. To hopefully help point you in the right direction, I'll share the steps below.

    How To: Manage inactive user accounts

    Inactive accounts are user accounts that aren't required anymore by members of your organization to gain access to your resources. One key identifier for inactive accounts is that they haven't been used for a while to sign in to your environment. Because inactive accounts are tied to the sign-in activity, you can use the timestamp of the last time an account attempted to sign in to detect inactive accounts.

    Prerequisites: To access the lastSignInDateTime property using Microsoft Graph:

    You need a Microsoft Entra ID P1 or P2 edition license.

    • You need to grant the app the following Microsoft Graph permissions:
    • AuditLog.Read.All
      • User.Read.All

    You can detect inactive accounts by evaluating the lastSignInDateTime property exposed by the signInActivity resource type of the Microsoft Graph API. The lastSignInDateTime property shows the last time a user attempted to make an interactive sign-in attempt in Microsoft Entra ID. Using this property, you can implement a solution for the following scenarios:

    • Last sign-in date and time for all users: In this scenario, you need to generate a report of the last sign-in date of all users. You request a list of all users, and the last lastSignInDateTime for each respective user:
      • https://graph.microsoft.com/v1.0/users?$select=displayName,signInActivity

    Additional Links:


    How to investigate a single user - Azure Portal

    You can also view a user's latest sign-in details (interactive / non-interactive) within Microsoft Entra ID to determine if the user(s) has been active or not.

    1. Sign in to the Microsoft Entra admin center as at least a Reports Reader.
    2. Browse to Identity > Users > All users.
    3. Select Manage View > Edit Column.
    4. Select: Last interactive sign-in time & Last non-interactive sign-in time

    User's image

    Additional Link:

    I hope this helps!

    If you have any other questions, please let me know. Thank you for your time and patience throughout this issue.


    If the information helped address your question, please Accept the answer. This will help us and also improve searchability for others in the community who might be researching similar information.

    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.