Repository navigation
Update Guidance for Add-PnPGroupMember Cmdlet #5430
Unanswered
NORC-RyanEnk
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The documentation for Add-PnPGroupMember currently only shows examples for adding users to SharePoint groups. There does not appear to be any guidance or examples for adding a Microsoft Entra ID security group to a SharePoint group.
While attempting to add an Entra ID security group, I tried using the group object ID and several claims formats, but the cmdlet returned the following error:
Add-PnPGroupMember: The specified user c:0t.c|tenant|3b3500fa-ddfd-4e61-94f0-58c84026fa13 could not be found.
This error was confusing because I was not trying to add a user. I was trying to add a security group. The message made it sound like the issue was that a user account could not be found, when the actual issue was that the security group needed to be passed using the correct claims-based login format.
After searching through discussions and testing different approaches, I found that adding an Entra ID security group requires using a login name similar to the following:
Add-PnPGroupMember -LoginName "c:0o.c|federateddirectoryclaimprovider|3b3500fb-bbfd-4e61-94f0-58c84026fa13" -Identity 5
It would be helpful if the Add-PnPGroupMember documentation included a specific example for adding an Entra ID security group to a SharePoint group, since this is not intuitive from the current examples.
Suggested documentation additions:
This would save administrators and developers a lot of trial and error when trying to add security groups to SharePoint groups using PnP PowerShell.
All reactions