msgraph-sdk-powershell icon indicating copy to clipboard operation
msgraph-sdk-powershell copied to clipboard

Get-MgGroupMemberCount has irrelevant supported parameters

Open mmascolino opened this issue 1 month ago • 0 comments

Describe the bug

Get-MgGroupMemberCount supports most (all?) of the cmdlet parameters as Get-MgGroupmember despite most of them not making sense. Since GroupId is required and represents one group, what is the point in supporting the Filter or Search parameters for example. e.g.

Get-MgGroupMemberCount -GroupId 0026e960-3081-4fd6-a453-4e9f58a5deee -ConsistencyLevel eventual -Filter "DisplayName eq 'My-Group-Name'"
0

Expected behavior

If running the command does not work with -GroupId + -Filter included, -Filter should not be an option for me to be included (same for -Search, etc.)

How to reproduce

Run Get-MgGroupMemberCount with a supplied GroupId AND a Filter value that resolves to the same group

SDK Version

No response

Latest version known to work for scenario above?

2.25.0

Known Workarounds

No response

Debug output

DEBUG: [CmdletBeginProcessing]: - Get-MgGroupMemberCount begin processing with parameterSet 'Get'. DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'. DEBUG: [Authentication]: - Scopes: [AccessReview.Read.All, AccessReview.ReadWrite.All, AccessReview.ReadWrite.Membership, Application.Read.All, Application.ReadWrite.All, AppRoleAssignment.ReadWrite.All, AuditLog.Read.All, AuditLogsQuery.Read.All, Bookings.Read.All, ChannelMessage.ReadWrite, ChannelSettings.Read.All, DelegatedPermissionGrant.Read.All, DelegatedPermissionGrant.ReadWrite.All, Device.Read.All, DeviceManagementManagedDevices.Read.All, Directory.AccessAsUser.All, Directory.Read.All, Directory.ReadWrite.All, email, Files.Read, Group.Read.All, Group.ReadWrite.All, GroupMember.Read.All, IdentityRiskEvent.Read.All, OnPremDirectorySynchronization.Read.All, openid, Organization.Read.All, PrivilegedAccess.Read.AzureAD, PrivilegedAccess.Read.AzureADGroup, PrivilegedAssignmentSchedule.Read.AzureADGroup, PrivilegedEligibilitySchedule.Read.AzureADGroup, profile, RoleManagement.Read.Directory, RoleManagement.ReadWrite.Directory, Sites.FullControl.All, Team.ReadBasic.All, TeamMember.Read.All, TeamworkDevice.Read.All, TeamworkTag.ReadWrite, User.Read, User.Read.All, User.ReadBasic.All, User.ReadWrite.All, UserAuthenticationMethod.Read.All]. DEBUG: ============================ HTTP REQUEST ============================

HTTP Method: GET

Absolute Uri: https://graph.microsoft.com/v1.0/groups/0026e960-3081-4fd6-a453-4e9f58a5deee/members/$count?$filter=DisplayName eq %27My-Group-Name%27

Headers: ConsistencyLevel : eventual FeatureFlag : 00000043 Cache-Control : no-store, no-cache User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.22631; en-US),PowerShell/7.4.13 Accept-Encoding : gzip SdkVersion : graph-powershell/2.25.0 client-request-id : 1d97f26c-b3d4-4e59-8063-6dfaa9baa108

Body:

DEBUG: ============================ HTTP RESPONSE ============================

Status Code: OK

Headers: Cache-Control : no-cache Vary : Accept-Encoding Strict-Transport-Security : max-age=31536000 request-id : 812444be-9273-4d5d-ae6c-096b0d7d607d client-request-id : 1d97f26c-b3d4-4e59-8063-6dfaa9baa108 x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"North Central US","Slice":"E","Ring":"4","ScaleUnit":"005","RoleInstance":"CH01EPF0004E7D5"}} x-ms-resource-unit : 1 Date : Thu, 04 Dec 2025 19:47:50 GMT

Body: 0

0 DEBUG: [CmdletEndProcessing]: - Get-MgGroupMemberCount end processing.

Configuration

$PSVersionTable

Name Value


PSVersion 7.4.13 PSEdition Core GitCommitId 7.4.13 OS Microsoft Windows 10.0.22631 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0

Other information

Why is -ConsistencyLevel eventual an optional parameter for this command when this is always required? I would expect that this should always be silently included.

I suspect this is a consistent problem across all the Get-MgSomethingCount cmdlets

mmascolino avatar Dec 04 '25 19:12 mmascolino