Forum Discussion
List all users' last login date
The Microsoft Graph API now supports the resource property signInActivity in users end-point, this resource exposes the lastSignInDateTime property which shows the last time a user made a successful sign-in. Fetching signInActivity property requires an Azure AD Premium P1/P2 license and the AuditLog.Read.All permission. The following request retrieves user details along with signInActivity property.
#GET Request
https://graph.microsoft.com/beta/users?$select=displayName,signInActivity
You can refer the below post to know more details about how to find and export Last login date for all Azure AD Users using PowerShell.
- https://morgantechspace.com/2021/09/find-last-login-date-for-all-azure-ad-users-using-powershell.html
- kclowes1035Jun 16, 2023Copper Contributor
Is it possible to to get a last activity date for only guest users? I have about 25k that I need to cleanup and need to determine if they have logged on in the past 90days or more.
thanks
Kevin
- Joshua BinesDec 19, 2022Iron Contributor
The thread that keeps on keeping on....
Here is a new page from MS on the topic with all the required information.
https://learn.microsoft.com/en-us/azure/active-directory/reports-monitoring/howto-manage-inactive-user-accounts- Joshua BinesApr 17, 2023Iron ContributorHey @everyone,
Because of the paging size change from 1000 to 120, guests maybe be reported incorrectly and deleted. If you are using this script please grab an updated copy and report any bugs!
https://github.com/JBines/Remove-StaleGuests
https://github.com/microsoftgraph/msgraph-sdk-powershell/issues/1898