Different ways here - including powershell
https://admindroid.com/how-to-find-users-last-logon-time-report-in-microsoft-365
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi Q&A team,
So i have been trying to retrieve all the users last logon from the microsoft entra id even i tried to retrieve with the help of KQL queries as well so did not solved my issue so please provide me detailed steps to resolve this issue.
Thank you
Different ways here - including powershell
https://admindroid.com/how-to-find-users-last-logon-time-report-in-microsoft-365
Thank you for posting this in Microsoft Q&A.
I understand you want to retrieve all the users last logon details from Entra ID using PowerShell.
Can you please try below PowerShell code
Install-Module Microsoft.Graph
Import-Module Microsoft.Graph
Connect-MgGraph -Scopes Directory.Read.All,AuditLog.Read.All
Get-MgUser -All -Property 'UserPrincipalName','SignInActivity','Mail','DisplayName' | Select-Object @{N='UserPrincipalName';E={$_.UserPrincipalName}}, @{N='DisplayName';E={$_.DisplayName }}, @{N='LastSignInDate';E={$_.SignInActivity.LastSignInDateTime}} | Export-Csv -Path C:\usernew1.csv -NoTypeInformation -NoClobber
Hope this helps. Do let us know if you any further queries.
Thanks,
Navya.
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful. And, if you have any further query do let us know.