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 / Unable to Run SharePoi...
Power Automate
Unanswered

Unable to Run SharePoint API Call Using Service Principal in Power Automate

(1) ShareShare
ReportReport
Posted on by 2

I am currently unable to execute a SharePoint API call using a Service Principal within Power Automate.
The same script works successfully when using SharePoint’s built-in HTTP connector, which relies on user credentials.
Below is a summary of the request and the error encountered:

Request Details:

{
    "uri": "https://abc.sharepoint.com/teams/Test/_api/web/lists/GetByTitle('Documents')/fields",
    "method": "POST",
    "headers": {
        "Accept": "application/json;odata=verbose",
        "Content-Type": "application/json;odata=verbose"
    },
    "authentication": {
        "authority": "https://login.microsoftonline.com/*sanitized*",
        "tenant": "*sanitized*",
        "audience": "https://abc.sharepoint.com",
        "clientId": "*sanitized*",        
        "secret": "*sanitized*",
        "type": "ActiveDirectoryOAuth"
    },
    "body": {
        "__metadata": {
            "type": "SP.FieldChoice"
        },
        "FieldTypeKind": 6,
        "Title": "Reference",
        "Choices": {
            "results": [
                "None",
                "Keep"
            ]
        },
        "Required": true,
        "DefaultValue": "None",
        "Hidden": false
    }
}

 

Error Received:

BadGateway Http request failed as there is an error getting AD OAuth token: 'Failed to extract error details from response content '''.

Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,335 Super User 2025 Season 2 on at
     
    Here are some articles to take a look at.
     
    I am not sure what registration etc etc etc all you did so instead of asking the long list of questions, I just posted those that cover them.
     
    If you still have issues please let me know.
     
    If this works for you please Mark as such
    Thanks!
  • Michael E. Gernaey Profile Picture
    53,335 Super User 2025 Season 2 on at
     
    Did you resolve this issue? If so can you share what you did?

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