Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Outlook
    • Planner
    • Power Apps
    • SharePoint
    • Teams
  • Triggers
  • Ready to use solutions
    • Approval Process Template
    • Task Delegation App
    • The Ultimate Power Automate expressions cheat sheet
    • Power Automate HTTP requests to SharePoint cheat sheet
    • Power Automate HTTP requests to Graph API cheat sheet
  • ABOUT ME
  • Get help with your flow
  • POWER PLATFORM SERVICES
Menu

How to add permissions to SharePoint group with Power Automate

Posted on March 16, 2022September 13, 2023 by Tom

“I can assign permissions to a user or M365 group, but what about SharePoint groups, how can I manage their access with Power Automate?”


Power Automate has two actions that make SharePoint permissions management a bit easier as you can ‘Stop sharing an item or a file’ and ‘Grant access to a file or folder’. But each of them has a limitation. The ‘Stop sharing…’ action won’t work on folders. You can use it to remove permissions from an item or a file, but not from a folder. Then there’s the ‘Grant access…’ action that won’t let you assign permissions to SharePoint groups. You can assign permissions to a user or Microsoft 365 group, but not to a SharePoint group. And since SharePoint groups are still widely used, this post explains how to solve that.

Note: everything inside <…> is a placeholder, replace it including the < and >.

You’ll need an HTTP request

As already shown a few times, if there’s no action that’ll do what you need, you can use an HTTP request.

Method: POST

Uri:
_api/lists/getByTitle('<listName>')/items(<itemID>)/roleAssignments/addRoleAssignment(PrincipalId=<groupID>,roleDefId=<roleID>)
Power Automate SharePoint group permissions

Note: before you can add permissions you must break permissions inheritance on the item/file/folder.

As you can see above it’s a bit more complex than the other HTTP requests on this blog. Additionally to the list name and item id you’ll need two more parameters. The ID of the SharePoint group, and the ID of the permission level.

Get the SharePoint group ID

The first new parameter is the SharePoint group ID. If you know the group name, you can use another HTTP request to get the group ID.

Method: GET

Uri:
_api/web/siteGroups/getByName('<groupName>')

The group ID can be then extracted from the JSON output, e.g.

body('Send_an_HTTP_request_to_SharePoint')?['d']?['Id']

Get the permission level ID

The second new parameter is the permissions level ID. And as you could probably guess, you can get it via HTTP request.

Method: GET

Uri:
_api/web/roleDefinitions/getByName('<roleName>')

The role ID can be then extracted in the same way as the group ID.

body('Send_an_HTTP_request_to_SharePoint')?['d']?['Id']

Build the HTTP request

Once you have the two IDs, you can use them to assign the desired permissions to the SharePoint group.

Power Automate SharePoint group permissions

Summary

If you can’t use the new Power Automate actions to manage SharePoint group permissions, you can still do it the old way. Get the group ID and permission level ID using HTTP requests, and combine the information together to assign the permissions in the 3rd one.


🚀 Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

14 thoughts on “How to add permissions to SharePoint group with Power Automate”

  1. Steve Morley says:
    March 21, 2022 at 12:44 pm

    Really timely Tom, I’m trying to create a SharePoint group from the instructions of this post: https://powerusers.microsoft.com/t5/Power-Automate-Community-Blog/SharePoint-Group-Operations-in-Microsoft-Flow/ba-p/394446
    Struggling a bit with the group Id

    Reply
    1. Tom says:
      March 29, 2022 at 11:14 am

      Hello Steve,
      ID is the result from the HTTP request that creates the group, it should be among the outputs of the ‘Parse JSON’ action.

      Reply
      1. PowerApps Newb says:
        August 4, 2022 at 3:25 pm

        In this instance what should be in the ‘Parse JSON’ action? You mention it but don’t explicitly state it.

        Reply
        1. Tom says:
          August 14, 2022 at 5:18 pm

          Hello PowerApps Newb,
          it’s related to the link posted by Steve above, I don’t use any Parse JSON in the solution.

          Reply
  2. Rachel says:
    October 5, 2022 at 6:20 pm

    Will this HTTP action result in all users receiving an email notification that something has been shared with them? I need to automate the granting of access and I find that the Grant Access action is buggy (or something). It finds but won’t allow me to select an Active Directory group in the Recipients field. I select the group name over and over and the field remains blank. Very frustrating. So I was looking at your alternative option here — which is great — but will it email everyone?

    Reply
    1. Tom says:
      October 14, 2022 at 10:25 am

      Hello Rachel,
      it won’t send any email, it’ll just assign the permissions. But if you want to make sure you can always try to use some test group, e.g. your department group to assign the permissions somewhere.

      Reply
  3. Rob Blundell says:
    October 6, 2022 at 5:18 pm

    In the HTTP request to assign the role to the group for the item, how do you incorporate the d.ID into the two sets of dynamic content? I can’t find any combination of steps that allows me to do that.

    Reply
    1. Rob Blundell says:
      October 6, 2022 at 7:08 pm

      I managed to do this by adding it as a function; it initially appeared as a function in the Uri field of the flow action, but after saving it and returning to it later, it had converted to the form shown in the article!

      Reply
  4. Pingback: Custom SharePoint Permissions Levels
  5. Jeremy says:
    March 9, 2023 at 6:03 pm

    Hello Tom, thank you for this tutorial!

    I made a flow that adds access to a folder in a library to a SharePoint group and it works.

    However, when I want to perform this same action on a folder that is 3 levels below the root I have the following error:
    Error 400 “This operation is not allowed on an object whose permissions are inherited.”

    After research, I disabled inheritance of parent permissions but I have the same result on my PowerAutomate flow…

    Have you ever had this error?

    Reply
    1. Simon says:
      March 10, 2023 at 9:53 am

      Hello Jeremy:
      Look at this:
      https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/set-custom-permissions-on-a-list-by-using-the-rest-interface
      You need to BreakRoleInheritance or delete already assigned permission before to assign it again

      Reply
    2. Tom says:
      March 19, 2023 at 3:32 pm

      Hello Jeremy,
      there must be some inheritance still enabled, I’d double check if you disabled the inheritance on the right folder, the same folder that should get the unique permissions.

      Reply
  6. Fran says:
    October 3, 2024 at 7:25 pm

    Hi Tom, this was very helpful! I get your newsletters, but I don’t recall seeing one for the specific task I’m working on. We want to process through specific sites (200+ sites) and first get the SharePoint group(s) that have full control permissions, and then get the members and send them an email.

    Our users have a tendency to rename the permission groups, which is why we need to query the permission level and get the group(s) with that permission.

    Reply
  7. Pingback: Power Automate: Créer une structure de dossiers avec une sécurite | KTNN SharePoint

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

🚀 Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Still exchanging emails to get things approved?

Use the Approval Process Template and the Task Delegation App to skip the hard part and deploy an automated, fully functional approval solution on a SharePoint list in minutes! And then the next one, and the next one...

Approval Template Preview ✨ Learn more ✨

Turn ideas into flows with ease!

Grab the complete Power Automate Cheat Sheet Bundle—everything you need to master expressions, SharePoint HTTP calls, and Graph API in Power Automate.

Cheat Sheet Bundle Preview ✨ Get the Cheat Sheets

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with thousands of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2025 Let's POWER Automate | Theme by SuperbThemes