web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Granting Site Collecti...
Power Automate
Unanswered

Granting Site Collection Admin fails if account is not also a site admin

(0) ShareShare
ReportReport
Posted on by 6

Hello,

 

I created a Power Automate flow that grants a user site collection administrator access to a SharePoint site. This works only if the account running the flow is already a site collection administrator of the site. If it is not, then I get something like the following:

 

{
  "status"403,
  "message""Attempted to perform an unauthorized operation.\r\nclientRequestId: ...\r\nserviceRequestId: ...",
  "source"".../_api/web/ensureuser",
  "errors": [
    "-2147024891",
    "System.UnauthorizedAccessException"
  ]
}
 
It fails in the first 'Send an HTTP request to SharePoint' action.
 
AbedK_0-1712094378681.png

 

 Full flow:
 
AbedK_1-1712094407176.png

 

 

The account is a SharePoint Administrator and is able to grant access to sites, it is not an admin of, using PowerShell just fine. Why is it failing when trying to grant access in a flow?

 
 
Categories:
I have the same question (0)
  • SudeepGhatakNZ Profile Picture
    14,394 Most Valuable Professional on at
    Re: Granting Site Collection Admin fails if account is not also a site admin

    @AbedK ,

    Please verify that the account used to create the connection for this action is the Site Collection Administrator.

    SudeepGhatakNZ_0-1712103275624.png

     

  • AbedK Profile Picture
    6 on at
    Re: Granting Site Collection Admin fails if account is not also a site admin

    The account for the connection is not a site collection administrator. That is what I am trying to do. Grant site collection administrator access to a site which the account running the flow is not already a site collection administrator. 

  • Verified answer
    SudeepGhatakNZ Profile Picture
    14,394 Most Valuable Professional on at
    Re: Granting Site Collection Admin fails if account is not also a site admin

    Powershell uses a separate API to achieve this. Either PnP or MOSP.

    If you like, you can run the PnP PowerShell  in an Azure Function and then trigger the azure Function from flow.

     

  • AbedK Profile Picture
    6 on at
    Re: Granting Site Collection Admin fails if account is not also a site admin

    Oh, I see. That's good to know. Thanks for the tip!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard