Forum Discussion
Suman8877
Advocate II
1 year agoSharepoint help in Fabric notebook
In most of the code that I am scanning across to upload file into sharepoint via service principal, sites.readwriteAll application permission is being provided to the app.
But that is the higesth privilge that an app would get across all sharepoints and we need to restrict it to a single sharepoint in which the app has been given access to.
So can someone share me the fabric notebook code to upload a file into sharepoint via service principal authentication with least minimum privilege
Hi Suman8877
- In Entra ID, give the app only Graph Sites.Selected (not Sites.ReadWrite.All) and grant admin consent.
- As SharePoint admin, grant that app Write permission on just the one target site (site-level app permission).
- In the Fabric notebook, get an app-only token with MSAL and upload via Microsoft Graph (PUT /content for ≤4 MB; use an upload session for larger files).
1 Reply
- rohit1991
Super User
Hi Suman8877
- In Entra ID, give the app only Graph Sites.Selected (not Sites.ReadWrite.All) and grant admin consent.
- As SharePoint admin, grant that app Write permission on just the one target site (site-level app permission).
- In the Fabric notebook, get an app-only token with MSAL and upload via Microsoft Graph (PUT /content for ≤4 MB; use an upload session for larger files).