Get inactive AAD Users
Appearance
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph
$inactiveDate = (Get-Date).AddDays(-90)
$users = Get-MgUser -All:$true -Property Id, DisplayName, UserPrincipalName, UserType, SignInActivity | Where-Object { $_.AccountEnabled -eq $true }
$inactiveUsers = $users | Where-Object {
$_.SignInActivity.LastSignInDateTime -lt $inactiveDate
} | Select-Object DisplayName, UserPrincipalName, UserType
$inactiveUsers