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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to grant a user to...
Power Automate
Unanswered

How to grant a user to SCA (primary admin)

(0) ShareShare
ReportReport
Posted on by

Hello,

I'm looking to automate grant access to a service account in the Primary Admin role on Sharepoint when I apply a template (site script).

For this I have created a Power Automate which is triggered by HTTP and follows exactly this process:

here.

I also took care to add my service account as Owner via my script and it does indeed have the SharePoint Admin role in Azure.

 

However, I get an error on my last rest api to Sharepoint action:

raphaglr_0-1686059614354.png

 

 

 

{
"error": {
"code": 502,
"source": "flow-xxx.azure-apim.net",
"clientRequestId": "8f75f0b4-0xxxx597fc8421e8",
"message": "BadGateway",
"innerError": {
"status": 502,
"message": "You must be a site collection administrator to set this property.\r\nclientRequestId: 8f75f0xxx9b-8bf7-f597fc8421e8\r\nserviceRequestId: b82fbaa0-101dxxxx92ebdd872",
"source": "https://XXXXX.sharepoint.com/sites/ZZZZZ/_api/web/getuserbyid(11)",
"errors": [
"-2146232832",
"Microsoft.SharePoint.SPException"
]
}
}
}

 

 

 

Can you give me a tip on how to do this?

Thanks in advance!

 

Categories:
I have the same question (0)

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard