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 '''.
Tomac
986
Moderator
stampcoin
699
Super User 2025 Season 2
Riyaz_riz11
577
Super User 2025 Season 2