Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Suman8877
Advocate II
Advocate II

Sharepoint 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

 

1 ACCEPTED SOLUTION
rohit1991
Super User
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).


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

View solution in original post

1 REPLY 1
rohit1991
Super User
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).


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

Helpful resources

Announcements
December Fabric Update Carousel

Fabric Monthly Update - December 2025

Check out the December 2025 Fabric Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.