SOLVED

Get-AzureAdUser not working as expected.

Copper Contributor

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? 

3 Replies
best response confirmed by Vanir10 (Copper Contributor)
Solution
-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

@Vasil Michev 

Get-MgUser -Filter "userType eq 'Guest'" -All
Definitely 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
1 best response

Accepted Solutions
best response confirmed by Vanir10 (Copper Contributor)
Solution
-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

View solution in original post