SOLVED
Home

Azure AD Dynamic Groups - Display Membership and count members

%3CLINGO-SUB%20id%3D%22lingo-sub-69657%22%20slang%3D%22en-US%22%3EAzure%20AD%20Dynamic%20Groups%20-%20Display%20Membership%20and%20count%20members%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-69657%22%20slang%3D%22en-US%22%3E%3CP%3ECreated%20Azure%20AD%20Dynamic%20Groups.%20These%20Groups%20have%20thousands%20of%20members.%20The%20Azure%20Portal%20GUI%20will%20show%20the%20group%20as%20having%20%221000%2B%20Members%22.%20Drilling%20into%20this%20Dynamic%20group%20will%20display%20the%20following%20message%3A%20%22Group%20members%20cannot%20be%20shown%20for%20this%20group.%20This%20group%20has%20more%20than%201000%20members%22.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CDIV%3ESo%20if%20I%20attempt%20to%20get%20the%20membership%20from%20this%20group%20using%20the%20following%20Powershell%3A%3C%2FDIV%3E%3CP%3Eget-azureadgroup%20-SearchString%20%22GroupName%22%20%7C%20Get-AzureADGroupMember%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20results%20show%20100%20members.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGetting%20a%20count%20also%20shows%20100%20members.%26nbsp%3B%3C%2FP%3E%3CP%3E(get-azureadgroup%20-SearchString%20%22GroupName%22%20%7C%20Get-AzureADGroupMember).COUNT%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAppears%20to%20be%20a%20limit%20on%20the%20results%20returned.%20How%20can%20I%20display%20all%20the%20members%20in%20a%20Dynamic%20Group%20and%20get%20a%20proper%20count%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-69657%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20AD%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-376944%22%20slang%3D%22en-US%22%3ERe%3A%20Azure%20AD%20Dynamic%20Groups%20-%20Display%20Membership%20and%20count%20members%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-376944%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F8291%22%20target%3D%22_blank%22%3E%40William%20Tait%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20just%20browse%20to%20the%20AAD%20group%20in%20Azure%20portal%20and%20get%20the%20Object%20ID%20from%20the%20Overview%20blade.%3C%2FP%3E%3CP%3EThen%20run%20the%20below%3A%3C%2FP%3E%3CP%3E%3CSPAN%3E(%3C%2FSPAN%3EGet-AzureADGroupMember%20-All%20%24true%20-ObjectId%20%22%3CSTRONG%3EGUID%20OF%20AAD%20GROUP%3C%2FSTRONG%3E%22%20%7C%20select%20mail).Count%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-70040%22%20slang%3D%22en-US%22%3ERe%3A%20Azure%20AD%20Dynamic%20Groups%20-%20Display%20Membership%20and%20count%20members%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-70040%22%20slang%3D%22en-US%22%3E%3CP%3EIt's%20a%20boolean%20parameter%2C%201%20equals%20%24true%20%3A)%3C%2Fimg%3E%20And%20don't%20get%20me%20started%20on%20the%20stupid%20syntax%20used%20by%20the%20AzureAD%20module%2C%20gotta%20love%20programmers...%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-69998%22%20slang%3D%22en-US%22%3ERe%3A%20Azure%20AD%20Dynamic%20Groups%20-%20Display%20Membership%20and%20count%20members%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-69998%22%20slang%3D%22en-US%22%3EYes%2C%20that%20works.%20Documentation%20doesn't%20explain%20why%20without%20-ALL%20the%20limit%20is%20100.%3CBR%20%2F%3E%3CBR%20%2F%3EAwkward%20syntax%20but%20it%20works%3A%3CBR%20%2F%3E(Get-AzureADGroup%20-ALL%201%20-Filter%20%22DisplayName%20eq%20'GroupName'%22%20%7C%20Get-AzureADGroupMember%20-ALL%201).COUNT%3CBR%20%2F%3E%3CBR%20%2F%3EThanks.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-69739%22%20slang%3D%22en-US%22%3ERe%3A%20Azure%20AD%20Dynamic%20Groups%20-%20Display%20Membership%20and%20count%20members%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-69739%22%20slang%3D%22en-US%22%3E%3CP%3ETry%20the%20-All%20parameter%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1012792%22%20slang%3D%22en-US%22%3ERe%3A%20Azure%20AD%20Dynamic%20Groups%20-%20Display%20Membership%20and%20count%20members%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1012792%22%20slang%3D%22en-US%22%3EYou%20could%20also%20leverage%20the%20following%20with%20the%20new%20Az%20module%20to%20simply%20get%20the%20count%20similar%20to%20some%20of%20the%20other%20versions%20recommended%20here%20in%20this%20post.%3CBR%20%2F%3E%3CBR%20%2F%3E(Get-AzADGroup%20-DisplayName%20%22%3CDISPLAYNAMEOFGROUP%3E%22%20%7C%20Get-AzADGroupMember).count%3C%2FDISPLAYNAMEOFGROUP%3E%3C%2FLINGO-BODY%3E
William Tait
Contributor

Created Azure AD Dynamic Groups. These Groups have thousands of members. The Azure Portal GUI will show the group as having "1000+ Members". Drilling into this Dynamic group will display the following message: "Group members cannot be shown for this group. This group has more than 1000 members". 

 

So if I attempt to get the membership from this group using the following Powershell:

get-azureadgroup -SearchString "GroupName" | Get-AzureADGroupMember

 

The results show 100 members.

 

Getting a count also shows 100 members. 

(get-azureadgroup -SearchString "GroupName" | Get-AzureADGroupMember).COUNT

 

Appears to be a limit on the results returned. How can I display all the members in a Dynamic Group and get a proper count? 

 

5 Replies
Solution

Try the -All parameter?

Yes, that works. Documentation doesn't explain why without -ALL the limit is 100.

Awkward syntax but it works:
(Get-AzureADGroup -ALL 1 -Filter "DisplayName eq 'GroupName'" | Get-AzureADGroupMember -ALL 1).COUNT

Thanks.

It's a boolean parameter, 1 equals $true :) And don't get me started on the stupid syntax used by the AzureAD module, gotta love programmers...

@William Tait 

I would just browse to the AAD group in Azure portal and get the Object ID from the Overview blade.

Then run the below:

(Get-AzureADGroupMember -All $true -ObjectId "GUID OF AAD GROUP" | select mail).Count

You could also leverage the following with the new Az module to simply get the count similar to some of the other versions recommended here in this post.

(Get-AzADGroup -DisplayName "<DisplayNameofGroup>" | Get-AzADGroupMember).count
Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
38 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies