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

Get-MgTeamChannelMember for private channel failed (Failed to execute GetThreadRosterAsync)

Open jolscr opened this issue 6 months ago • 1 comments

Hi,

The cmdlets below have been throwing errors when targeting channels with cmdlet "Get-MgTeamChannelMember" The issue appears with Microsoft Graph PowerShell SDK version 2.27.0 and also persists in the latest version 2.28.0. But no issue with version 2.26.1.

Expected behavior

Cmdlets should work for both standard and private channels as long as the required Microsoft Graph permissions are granted, regardless of the SDK version (2.27.0 or 2.28.0).

How to reproduce

Connect-MgGraph -ClientId $clientId -TenantId $tenantId -CertificateThumbprint $certificateThumbprint -ErrorAction:Stop

Get-MgTeamChannelMember -TeamId $TID -ChannelId $CID

SDK Version

2.27.0 and 2.28.0

Latest version known to work for scenario above?

2.26.1

Known Workarounds

Invoke-MgGraphRequest -Method GET -Uri "https://graph.microsoft.com/v1.0/teams/00000000000000/channels/19:[email protected]/members"

Debug output

Click to expand log

PS C:\Users\kollyj01> Get-MgTeamChannelMember -TeamId 0000000000000000000 -ChannelId 19:[email protected] -debug DEBUG: [CmdletBeginProcessing]: - Get-MgTeamChannelMember begin processing with parameterSet 'List'. DEBUG: [Authentication]: - AuthType: 'AppOnly', TokenCredentialType: 'ClientCertificate', ContextScope: 'Process', AppName: 'XXX-PortailM365-ResourcesManagement'. DEBUG: [Authentication]: - Scopes: [TeamSettings.ReadWrite.All, Channel.Delete.All, BookingsAppointment.ReadWrite.All, AppCatalog.ReadWrite.All, ServiceMessage.Read.All, Group.ReadWrite.All, Bookings.Read.All, Directory.Read.All, ConsentRequest.Read.All, Calendars.ReadBasic.All, TeamMember.ReadWrite.All, ChannelMember.ReadWrite.All, Tasks.ReadWrite.All, ChannelSettings.ReadWrite.All, AuditLog.Read.All, ServiceHealth.Read.All, Sites.FullControl.All]. DEBUG: ============================ HTTP REQUEST ============================

HTTP Method: GET

Absolute Uri: https://graph.microsoft.com/v1.0/teams/0000000000000000000000/channels/0000000000000000000000000000000%40thread.tacv2/allMembers

Headers: FeatureFlag : 00000003 Cache-Control : no-store, no-cache User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.22631; fr-CH),PowerShell/7.4.7 SdkVersion : graph-powershell/2.28.0 client-request-id : 4badb989-d8a0-4f49-be24-cf305d3ea94f Accept-Encoding : gzip,deflate,br

Body:

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

Status Code: Forbidden

Headers: Vary : Accept-Encoding Strict-Transport-Security : max-age=31536000 request-id : f1160899-8244-4c2f-b20e-8ad94815197e client-request-id : 4badb989-d8a0-4f49-be24-cf305d3ea94f x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Switzerland North","Slice":"E","Ring":"3","ScaleUnit":"002","RoleInstance":"ZR2PEPF000000C7"}} Date : Tue, 13 May 2025 10:55:13 GMT

Body: { "error": { "code": "Forbidden", "message": "Failed to execute GetThreadRosterAsync.", "innerError": { "code": "Unknown", "message": "Failed to execute GetThreadRosterAsync.", "date": "2025-05-13T10:55:13", "request-id": "f1160899-8244-4c2f-b20e-8ad94815197e", "client-request-id": "4badb989-d8a0-4f49-be24-cf305d3ea94f" } } }

Get-MgTeamChannelMember_List: Failed to execute GetThreadRosterAsync.

Status: 403 (Forbidden) ErrorCode: Forbidden Date: 2025-05-13T10:55:13

Headers: Vary : Accept-Encoding Strict-Transport-Security : max-age=31536000 request-id : f1160899-8244-4c2f-b20e-8ad94815197e client-request-id : 4badb989-d8a0-4f49-be24-cf305d3ea94f x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Switzerland North","Slice":"E","Ring":"3","ScaleUnit":"002","RoleInstance":"ZR2PEPF000000C7"}} Date : Tue, 13 May 2025 10:55:13 GMT

DEBUG: [CmdletEndProcessing]: - Get-MgTeamChannelMember end processing.

Configuration

PSVersion 7.4.7 PSEdition Core GitCommitId 7.4.7 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

No response

jolscr avatar May 13 '25 10:05 jolscr

Anyone have same issue with SDK 2.28.0 when requesting channel membership ? Get-MgTeamChannelMember -TeamId $TID -ChannelId $CID

same issue here https://github.com/microsoftgraph/msgraph-sdk-powershell/issues/3296

jolscr avatar Jun 10 '25 11:06 jolscr

Issue persist with sdk 2.29.0 ! Is there anybody here ? 2 month waiting for a fix... Get-MgTeamChannelMember call https://graph.microsoft.com/v1.0/teams/teamsid/channels/chanelid/allMembers but it works if we invoke the uri with members and not allMembers

jolscr avatar Jul 17 '25 12:07 jolscr

Same issue..same error on Standard Channels let alone Private Channels

zhead13 avatar Jul 22 '25 05:07 zhead13

Would like to see a resolution for this issue.

DylanHover3 avatar Aug 13 '25 19:08 DylanHover3

Same with Graph SDK 2.31.0 Nobody uses this in the whole world? Strange...

jolscr avatar Oct 02 '25 13:10 jolscr

Same issue. Can you resolve this ?

Tiffoox avatar Oct 06 '25 08:10 Tiffoox

Service API owner needs to investigate whether the AllMembers URL is valid and/or working as expected.

MIchaelMainer avatar Oct 20 '25 20:10 MIchaelMainer

It appears as though we have two issues:

 gavinbarron  Find-MgGraphCommand -Uri ".*/members$" -Method GET

   APIVersion: v1.0

Command                                 Module                       Method URI                                                                             OutputType
-------                                 ------                       ------ ---                                                                             ----------
Get-MgChatMember                        Teams                        GET    /chats/{chat-id}/members                                                        IMicrosoftGr…
Get-MgDirectoryAdministrativeUnitMember Identity.DirectoryManagement GET    /directory/administrativeUnits/{administrativeUnit-id}/members                  IMicrosoftGr…
Get-MgDirectoryRoleMember               Identity.DirectoryManagement GET    /directoryRoles/{directoryRole-id}/members                                      IMicrosoftGr…
Get-MgEducationClassMember              Education                    GET    /education/classes/{educationClass-id}/members                                  IMicrosoftGr…
Get-MgExternalConnectionGroupMember     Search                       GET    /external/connections/{externalConnection-id}/groups/{externalGroup-id}/members IMicrosoftGr…
Get-MgGroupMember                       Groups                       GET    /groups/{group-id}/members                                                      IMicrosoftGr…
Get-MgGroupTeamMember                   Teams                        GET    /groups/{group-id}/team/members                                                 IMicrosoftGr…
Get-MgGroupTeamTagMember                Teams                        GET    /groups/{group-id}/team/tags/{teamworkTag-id}/members                           IMicrosoftGr…
Get-MgTeamMember                        Teams                        GET    /teams/{team-id}/members                                                        IMicrosoftGr…
Get-MgTeamTagMember                     Teams                        GET    /teams/{team-id}/tags/{teamworkTag-id}/members                                  IMicrosoftGr…
Get-MgUserChatMember                    Teams                        GET    /users/{user-id}/chats/{chat-id}/members                                        IMicrosoftGr…

gavinbarron avatar Oct 20 '25 21:10 gavinbarron

It appears that the underlying service issue is resolved based on my testing the requests succeeds for v2.27.0 and v2.32.0 on both v1 and beta, admittedly I was using delegated auth but the request succeeded.

 gavinbarron  import-module Microsoft.Graph.Teams -RequiredVersion 2.27.0
 gavinbarron  Get-MgTeamChannelMember -TeamId "d04b0b1c-1c19-43d5-92a3-1737a18f516b" -ChannelId "19:[email protected]" -Debug
DEBUG: [CmdletBeginProcessing]: - Get-MgTeamChannelMember begin processing with parameterSet 'List'.
DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'.
DEBUG: [Authentication]: - Scopes: [Application.Read.All, Application.ReadWrite.All, AppRoleAssignment.ReadWrite.All, AuditLog.Read.All, BackupRestore-Configuration.Read.All, Calendars.Read, Calendars.ReadWrite, Chat.ReadBasic, ConsentRequest.Read.All, Device.ReadWrite.All, DeviceManagementManagedDevices.ReadWrite.All, DeviceManagementServiceConfig.ReadWrite.All, Directory.Read.All, Files.Read.All, Group.Read.All, Group.ReadWrite.All, GroupMember.ReadWrite.All, Mail.Read, openid, Policy.Read.All, Policy.ReadWrite.ApplicationConfiguration, Presence.Read, profile, RecordsManagement.Read.All, RoleManagement.Read.All, Sites.Read.All, Sites.ReadWrite.All, Team.ReadBasic.All, User.Read, User.Read.All, User.ReadWrite, User.ReadWrite.All, email, ChannelMember.Read.All].
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://graph.microsoft.com/v1.0/teams/d04b0b1c-1c19-43d5-92a3-1737a18f516b/channels/19%3A745a49ba9b1742b3825a7d1c138e2a04%40thread.tacv2/allMembers

Headers:
FeatureFlag                   : 00000003
Cache-Control                 : no-store, no-cache
User-Agent                    : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.26200; en-US),PowerShell/7.5.4
SdkVersion                    : graph-powershell/2.27.0
client-request-id             : 651263af-4778-4a26-8b21-ce27089c2a54
Accept-Encoding               : gzip,deflate,br

Body:



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

Status Code:
OK

Headers:
Vary                          : Accept-Encoding
Strict-Transport-Security     : max-age=31536000
request-id                    : 9df4c395-d2ff-4148-919b-edbcc4bd440d
client-request-id             : 651263af-4778-4a26-8b21-ce27089c2a54
x-ms-ags-diagnostic           : {"ServerInfo":{"DataCenter":"West US 2","Slice":"E","Ring":"4","ScaleUnit":"000","RoleInstance":"CO1PEPF00011BA9"}}
odata-version                 : 4.0
Date                          : Mon, 10 Nov 2025 18:02:29 GMT

Body:
{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#teams('d04b0b1c-1c19-43d5-92a3-1737a18f516b')/channels('19%3A745a49ba9b1742b3825a7d1c138e2a04%40thread.tacv2')/allMembers",
  "@odata.count": 16,
  "value": [

gavinbarron avatar Nov 10 '25 18:11 gavinbarron

The issue is still present, but the permission used is in application mode.

jolscr avatar Nov 11 '25 14:11 jolscr

I can also confirm that this issue still exists in version 2.32.0 using Application permissions.

Sekers avatar Nov 17 '25 15:11 Sekers