Access denied from azure devops pipeline to share point

A K 0 Reputation points

Hello Team,

I'm getting below error when I'm trying to upload files from azure repos to sharepoint.

"statusCode":403,"code":"AccessDenied","requestId":"e0271c4b-c7aa-49bb-a55d-579a5f3e54ff","date":"2024-04-02T11:38:13.000Z","body":"{"code":"AccessDenied","message":"Either scp or roles claim need to be present in the token.","innerError":{"date":"2024-04-02T11:38:13","request-id":"e0271c4b-c7aa-49bb-a55d-579a5f3e54ff","client-request-id":"52f30db5-bb01-469a-73b3-3223de93a25d"}}"}

"statusCode":403,"code":"AccessDenied","requestId":"e0271c4b-c7aa-49bb-a55d-579a5f3e54ff","date":"2024-04-02T11:38:13.000Z","body":"{\"code\":\"AccessDenied\",\"message\":\"Either scp or roles claim need to be present in the token.\",\"innerError\":{\"date\":\"2024-04-02T11:38:13\",\"request-id\":\"e0271c4b-c7aa-49bb-a55d-579a5f3e54ff\",\"client-request-id\":\"52f30db5-bb01-469a-73b3-3223de93a25d\"}}"}

I am using Upload files to Sharepoint task in azure devops to perform this activity. I have created app registration in azure portal and added client,tenant and secret id in the pipeline task. Below are the permission i hve provided to the api in app registration.

Microsoft GRAPH API Directory.ReadWrite.All Directory.AccessAsUser.All  User.ReadWrite.All Group.ReadWrite.All  GroupMember.ReadWrite.All  Sites.FullControl.All


SharePoint Online API AllSites.FullControl  AllSites.Manage  Sites.FullControl.All Sites.Search.All   User.ReadWrite.All   User.ReadWrite.All

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,456 questions
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,525 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,304 questions
0 comments No comments
{count} votes