Robin
Robin

Reputation: 43

Powershell: Get-AzureADGroupMember doesnt give me the whole list

I want to sync two AzureAD Groups, so I read out both groups with Get-AzureADGroupMember.

The Problem is, I only get 103 People out of the group instead of 615...

What Can I do, to get the whole list out of the groups?

Thanks in advance, Robin

Upvotes: 3

Views: 27520

Answers (1)

Marilee Turscak - MSFT
Marilee Turscak - MSFT

Reputation: 7720

Yes, you need the -All parameter. Otherwise there is a limitation on the number of members the Get-AzureADGroupMember will return.

For anyone else running into this issue, the command is like this:

(Get-AzureADGroup -Filter "DisplayName eq 'GroupName'" -All $true | Get-AzureADGroupMember -All $true).Count

Alternatively, to store the output in variables for later use:

$AzureADGroup = Get-AzureADGroup -Filter "DisplayName eq 'GroupName'" -All $true
$AzureADUsers = $AzureADGroup | Get-AzureADGroupMember -All $true
$AzureADGroupCount = $AzureADUsers | Measure-Object

See for reference: https://techcommunity.microsoft.com/t5/Azure-Active-Directory/Azure-AD-Dynamic-Groups-Display-Membership-and-count-members/td-p/69657

Upvotes: 7

Related Questions