halliba / az-pipelines-2-sharepoint

Azure DevOps extension - upload build files to SharePoint Online
GNU General Public License v3.0
8 stars 4 forks source link

Access denied when Upload files from repo to SharePoint Online Library #12

Open Sharukh-maker opened 1 year ago

Sharukh-maker commented 1 year ago

Which significant should we used here for azure pipeline,I am not able to understand why i am getting this error. When I am trying to upload files from repository to Sharepoint document library then it will shown an error.I am global admin where i want to upload files in sharepoint library. Please check and let me know.

{"statusCode":403,"code":"AccessDenied","requestId":"89456c3f-9482-4f6f-bf1e-37be127c432c","date":"2023-07-13T08:14:24.000Z","body":"{\"code\":\"AccessDenied\",\"message\":\"Either scp or roles claim need to be present in the token.\",\"innerError\":{\"date\":\"2023-07-13T08:14:24\",\"request-id\":\"89456c3f-9482-4f6f-bf1e-37be127c432c\",\"client-request-id\":\"e116f805-6b39-40ee-7ef4-686b4fadd860\"}}"}Upload files to SharePoint: Testdoc    
 

Could not validate drive id.Upload files to SharePoint: Testdoc

JumpingJezza commented 7 months ago

I had this exact problem. It took me a while to realise I had forgotten to grant admin consent for the api permission. image

ayoubqrt commented 7 months ago

@JumpingJezza Did you follow this tutorial https://www.leonarmston.com/2022/02/use-sites-selected-permission-with-fullcontrol-rather-than-write-or-read/ or you have another useful resource to grant the app to full control on a particular site collection ?

I followed this tutorial, granted admin consent fot the Sites.Selected api, and I have the same error as @Sharukh-maker . But if I use Files.ReadWrite.All, of course it's working. Any ideas ? @halliba

JumpingJezza commented 7 months ago

@ayoubqrt I did see that tutorial, but the read.me was more useful: https://github.com/halliba/az-pipelines-2-sharepoint

Palanikr commented 4 months ago

@Sharukh-maker Is it working now? Have you added sites.selected permission to sharepoint in azure app registration portal