Mg Graph Sign-In logs showing data more than 30 days older

Apurva Pathak 310 Reputation points
2024-04-19T16:31:28.49+00:00

Hi folks,

Hope you are doing well!

I'm using a PowerShell script based on MG Graph module to get the last sign-in date of all users.

PS script:
User's image

Now as specified here Azure AD only stores Sign-ins data until 30 days in P2 license, but in the result of my PowerShell script, I am getting data which are older than even a year.

User's image Date export:

User's image

Could someone please be kind enough to throw some light on this. Does Mg Graph work differently than other mechanisms (Azure AD module, Entra Id GUI etc.), or am I messing around somewhere in the script.

Any help would be highly appreciated!

Thanks in advance!

Cheers!

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,629 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,074 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,543 questions
{count} votes

Accepted answer
  1. Vasil Michev 95,581 Reputation points MVP
    2024-04-19T18:02:40.08+00:00

    You are confusing things. The cmdlet above is not querying the Azure AD sign-in logs, but just getting a property on the user object that is updated by background processes, based on user's last sign-in data. Think of it as querying a separate service (Azure AD Reporting service).

    If you want to get the actual sign-in logs, you can use the Get-MgAuditLogSignIn cmdlet instead. The data you will get from it should match the data from the Sign-In logs page in the portal.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful