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

Announcements

News and Announcements icon
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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 470

#2
Haque Profile Picture

Haque 416

#3
David_MA Profile Picture

David_MA 344 Super User 2026 Season 1

Last 30 days Overall leaderboard