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

Apurva Pathak 735 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!

Windows for business | Windows Server | User experience | PowerShell
Microsoft Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Graph
{count} votes

Accepted answer
  1. Vasil Michev 119.8K Reputation points MVP Volunteer Moderator
    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.

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

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.