Forum Discussion
Vanir10
Mar 14, 2023Copper Contributor
Get-AzureAdUser not working as expected.
Okay so if I run
Get-AzureAdUser -Filter "userType eq 'Guest'"
I get a list of users as expected that all have a user type of "Guest".
However this list is missing users.
If I run
Get-AzureAdUser -All 1
I get every member of my Azure environment. Then I paste the results in Excel and filter on the user type column to show only users with the type of "Guest", I get the missing users as well as the results from the previous command.
I'm not sure why this is happening?
- -All is a Boolean parameter, try this:
Get-AzureAdUser -Filter "userType eq 'Guest'" -All:$true
Better yet, switch to the Graph module:
Get-MgUser -Filter "userType eq 'Guest'" -All
3 Replies
Sort By
- -All is a Boolean parameter, try this:
Get-AzureAdUser -Filter "userType eq 'Guest'" -All:$true
Better yet, switch to the Graph module:
Get-MgUser -Filter "userType eq 'Guest'" -All- Vanir10Copper ContributorGet-MgUser -Filter "userType eq 'Guest'" -AllDefinitely works better than what I was using and I will be using that in the future.Although I'm still not sure why (Get-AzureAdUser -Filter "userType eq 'Guest'") wasn't returning some results?
- It uses an older version of the API. If you want to stick to the AzureAD module, try using the Preview branch (AzureADPreview module) and the following:
Get-AzureAdMSUser -Filter "userType eq 'Guest'" -All:$true