Permissions to add member to group via Graph API

Viewed 799

I am trying to add a member via this MS Graph API: https://docs.microsoft.com/en-us/graph/api/group-post-members?view=graph-rest-1.0&tabs=http but am running into permission issues. The request returns back

 "code": "Authorization_RequestDenied",
 "message": "Insufficient privileges to complete the operation."

I am able to call APIs like https://docs.microsoft.com/en-us/graph/api/group-list-members?view=graph-rest-1.0&tabs=http with no permission problem, and I have Group.ReadWrite.All and User.ReadBasic.All permissions. Is there a special permission or role I need to be to call this API?

1 Answers

Yes you also need GroupMember.ReadWrite.All and Directory.ReadWrite.All Application permission.

enter image description here

PostMan Request URL:

https://graph.microsoft.com/v1.0/groups/93d96b98-YourGroupId_3ede399/members/$ref

PostMan Request Body:

{
 "@odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/b33ce735_YourUserId_15337c469076"
}

Postman Test:

enter image description here

Added On Group: enter image description here

Note: Make sure after adding permission you have accepted grant admin consent.

Please refer to Official Document

Related