Get-AzureADStaleUsers

1.0

If you are utilizing external, guest, or B2B users in your Office 365 or Azure environments,
you may need a way to determine which objects haven't been logged in or used in a while.  Azure
AD doesn't provide an easy way to view this information (really only having the refresh token
time avaiable).  This script uses the RefreshTokensValidFromDateTime property from t
If you are utilizing external, guest, or B2B users in your Office 365 or Azure environments,
you may need a way to determine which objects haven't been logged in or used in a while.  Azure
AD doesn't provide an easy way to view this information (really only having the refresh token
time avaiable).  This script uses the RefreshTokensValidFromDateTime property from the user in
conjunction with one of the following:

- default token refresh lifetime in Azure AD (90 days)
- the actual token refresh lifetime if a policy has been configured and is able to be read
- a user-specified value

The additional value, specified in the the StaleAgeInDays parameter, is added to the one of
the three previous tenant token times.  If the user's refresh token is older than that value,
the user is "stale."

This will help you idenify when users last logged on and determine if you need to perform
further actions on them.  You can see some more on this script at
https://www.undocumented-features.com/2018/06/22/how-to-find-staleish-azure-b2b-guest-accounts/.

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Script -Name Get-AzureADStaleUsers

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deloy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Author(s)

Aaron Guilmette

Copyright

2020

Owners

Tags

Azure AzureAD stale accounts

Functions

Write-Log

Dependencies

This script has no dependencies.

Version History

Version Downloads Last updated
1.0 (current version) 56 4/19/2020