How to get the last logon date of users in Microsoft Entra ID

Administrators can get the last logon date of Microsoft Entra ID users to address specific scenarios that require up-to-date information about their users' activity. For example, retrieving the most recent logon attempt of a user in Microsoft Entra ID can help determine if they were active during the timeframe of a security incident by identifying which accounts were in use. This data can also help identify inactive users and support offboarding processes by confirming when a departing employee accessed their resources recently, ensuring timely deactivation of their accounts and permissions.

List your users' last logon time in Microsoft Entra ID using native admin tools and M365 Manager Plus

Administrators have to work with complex PowerShell scripts to identify their users' last logon date as the Entra ID admin does not display the data for the attribute lastSignInDateTime. ManageEngine M365 Manager Plus, a comprehensive tool used for reporting, managing, monitoring, auditing, and creating alerts for critical activities in your Microsoft 365 environments, can be used to view your users' last logon date in a more user-friendly and effortless manner, all in just a few clicks.

 PowerShell

Steps to view last logon date of users in Microsoft Entra ID using PowerShell

Execute the following script in PowerShell after importing the Microsoft Graph module.

Get-MgBetaUser -All:$true -Property
DisplayName,Id,UserPrincipalName,SignInActivity 
| ? {$_.signInActivity.lastSignInDateTime -ne $null} 
| select 
DisplayName,UserPrincipalName,@{n="LastSignIn"
;e={$_.signInActivity.lastSignInDateTime}}         
                    
 Copied

Click to copy entire script

 M365 Manager Plus

Steps to view last logon date of users in Microsoft Entra ID using ManageEngine M365 Manager Plus

  1. Log in to M365 Manager Plus and navigate to Reports > Azure Active Directory > User Reports and select Users Last Logon.
  2. Select the Microsoft 365 Tenant, the groups that you want to track using the Filter By field, and click Generate Now.
  3. You can also filter for a specific user or activity by clicking the   icon and selecting the attribute and value that you want to filter for.
    The Users Last Logon report in M365 Manager Plus displaying the users' user principal name, display name, last logon time, and the number of days since the last logon activity.

Note: To view the all login activities in your Microsoft 365 tenant, check out this page on How to view Microsoft 365 login attempts using PowerShell and Microsoft Entra ID.

Limitations of using native tools to get the last logon date of users in Microsoft Entra ID

  • Administrators must be assigned at least the Reports Reader role to access the last login date of their users in Microsoft Entra ID using the above-mentioned PowerShell script. However, PowerShell scripts are time-consuming, can affect productivity and are prone to errors.
  • Reports will have to be filtered every time they are generated, and the filters cannot be saved, which can get exhausting if a filter is required to generate data that you require frequently.

Benefits of using M365 Manager Plus to view the last logon date of users in Microsoft Entra ID

  • Filter your reports just once and save them as custom reports that you can access in just a few clicks.
  • Export the generated reports to CSV, PDF, XLSX, and HTML formats.
  • Delegate granular permissions to technicians without elevating their Microsoft 365 privileges, and create custom roles with any combination of reporting, management, and auditing tasks.
  • Gain a thorough understanding of your environment not only in Microsoft Entra ID, but also other Microsoft 365 services such as Exchange Online, SharePoint Online, and OneDrive for Business with detailed reports from a single console.
  • Create and customize alert profiles that can email you alerts for suspicious logons and other crucial events in your Microsoft 365 environment.

Effortlessly schedule and export reports on your Microsoft 365 environment.

Try now for free
 

Streamline your Microsoft 365 governance and administration with M365 Manager Plus

Get Your Free Trial

Related Resources

 
x
A holistic Microsoft 365 administration and security solution
 
x