Home > Enterprise >  Is it possible to get inactive azure ad users?
Is it possible to get inactive azure ad users?

Time:08-18

How can i get inactive azure ad users more than 90 days?

$date = (get-date).AddDays(-90)
get-azureaduser -All $true -Filter {(LastLogonDate -lt $date) -and (accountEnabled eq true)}

CodePudding user response:

DO you have access to graph? This will get you the results you want

https://graph.microsoft.com/beta/users?$filter=signInActivity/lastSignInDateTime le 2022-05-01T00:00:00Z&$filter=accountEnabled eq true&$select=displayName,signInActivity

Just make sure your account has the following permissions AuditLog.Read.All Directory.Read.All

All you'd need to adjust is the date that you want to filter signInActivity by.

https://docs.microsoft.com/en-us/azure/active-directory/reports-monitoring/howto-manage-inactive-user-accounts

  • Related