Earlier this week, I had a need to produce a list of Guest users in an Azure AD tenant who had not yet redeemed invitations that had been sent to them. It took me a little while to figure out the Powershell query for this, so I thought I would share it here.
The state of the Guest user is buried in the ExtensionProperty attribute that is returned from the Get-AzureADUser cmdlet.
For Guest users that have redeemed their invitations, the value returned is ‘Accepted’, while for those who have yet to accept the invitations the value is ‘PendingAcceptance’.
The query to find all Guest users who have not yet redeemed their invitations looks for the ‘PendingAcceptance’ value as follows:
Get-AzureADUser -Filter “Usertype eq ‘Guest'” | ? {$_.extensionproperty.userState -eq “PendingAcceptance”} | select mail
Please leave a comment if you have a simpler or more effective way of doing the same thing. Thanks!
Awesome thanks Tony