Using Get-AzureAdUser is there a way to pull back all users from source "windows server ad"?

I have a directory that has about 200k users in it. I need to pull back all the users that came from on-prem AD. This of course would exclude the multiple source guest users. I have to use source because not all users have a usertype.

If there was a way to search Department not equal to null that would work as well, but it doesn't appear to be part of the odata filter standard.

Get-AzureADUser -Filter "Department eq ''" | select DisplayName,` UserPrincipalName,Mail,creationType,AccountEnabled,Department

1 Answer

To get users that come from on-prem AD you could do something like this

 Get-AzureADUser -Filter "dirSyncEnabled eq true"

For selecting only a few, other operators like top can be used as well.. e.g.

 Get-AzureADUser -top 5 -Filter "dirSyncEnabled eq true"

To get all users one shot you can do

Get-AzureADUser -All $true -Filter "dirSyncEnabled eq true"

or

Get-AzureADUser -all $true | where-object -property DirSyncEnabled -eq "True"
3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like