Azure AD : Need powershell script to fetch Azure AD User Sign-in date and time (Last logon)

Sheshank Dhoot 1 Reputation point

On Premise AD does not update the Azure AD Sign-in Logs and O365 User Activity report does not include the interactive sign in performed by users.
Need PowerShell script to fetch each Azure AD user Sign-in logs, trying to reconcile the On-premise users last login data with Azure AD Sign-in activity to find inactive users.

Get-MSolUser and Get-AzureAdUser does not include the required data and the details are required for unlicensed users also.

Assuming Inactive users to be the one who have not signed-in in last 90 days.

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,434 questions
Microsoft Entra
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,170 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Andreas Baumgarten 100.3K Reputation points MVP

  2. Limitless Technology 39,466 Reputation points


    Thank you for reaching out.


    You can use Get-AzureADAuditSignInLogs powershell command to get user sign in logs from Azure AD.

    Hope this helps,

  3. Krystle Wright 1 Reputation point

    Did anyone find the answer? I am also needing the answer for SheshankDhoot-2954 question.

    0 comments No comments