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.

Azure Active Directory
Azure Active Directory
An Azure enterprise identity service that provides single sign-on and multi-factor authentication.
14,914 questions
Azure Active Directory Domain Services
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.
4,908 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Andreas Baumgarten 68,396 Reputation points MVP

  2. Limitless Technology 37,786 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