Forum Discussion
Service Principal Getting "HTTP request forbidden" When Reading from Data Warehouse
- Fabric Workspace: Same workspace for notebook, lakehouse, and data warehouse
- Execution Method: API-triggered notebook execution using service principal
- User Roles: I'm admin/creator, colleagues have Contributor role
- Service Principal Role: Contributor role in workspace
- Manual execution by me (admin/creator) - works perfectly
- Manual execution by colleagues with Contributor role - works perfectly
- Service principal querying DW locally (outside of Fabric notebook) - works perfectly
- Service principal reading from Lakehouse in the notebook - works perfectly
- Service principal executing notebook via API and trying to read from Data Warehouse - fails with error
- Capacity.Read.All
- Lakehouse.ReadWrite.All
- Tenant.Read.All
- Warehouse.ReadWrite.All
- Workspace.Read.All
- SQL Permissions: SELECT, INSERT, UPDATE granted
- Database Roles: db_datareader, db_datawriter
- Additional Access: "Manage Connections and Gateways" granted for the Data Warehouse
Questions
- Is there a specific permission or configuration missing for service principals to access Data Warehouse through Spark in API-triggered notebooks?
- Are there differences in authentication context between manual execution and API-triggered execution that could cause this issue?
- Could this be related to connection pooling or session management when using service principals in Fabric notebooks?
- Verified all standard permissions are in place
- Confirmed service principal works locally for DW queries
- Confirmed lakehouse access works in the same notebook
- Verified workspace contributor role is assigned
Any insights or suggestions would be greatly appreciated!
Vincent
Hi vmattard,
In Fabric, workspace roles (Admin, Member, Contributor, Viewer) govern high-level operations (create/delete/edit items). However, Spark synapsesql() queries check the item-level permission (Build/Read/Contributor) on the specific Data Warehouse.
That means:
-
A service principal with workspace Contributor can create/edit items in the workspace.
-
But unless you go into the Data Warehouse, Manage permissions pane and grant the service principal Build (or Contributor) on that warehouse item itself, Spark-to-DW queries from the notebook API will still get blocked.
That’s why you see:
-
Lakehouse access works (because Lakehouse Contributor is implied by workspace Contributor).
-
Warehouse access fails (because Spark uses the DW’s item ACL, not just workspace role).
please refer this doc for more:
https://learn.microsoft.com/en-us/fabric/data-warehouse/service-principals
Thanks,
Prashanth
MS Fabric community support
-
4 Replies
- v-prasareCommunity Support
Hi vmattard,
In Fabric, workspace roles (Admin, Member, Contributor, Viewer) govern high-level operations (create/delete/edit items). However, Spark synapsesql() queries check the item-level permission (Build/Read/Contributor) on the specific Data Warehouse.
That means:
-
A service principal with workspace Contributor can create/edit items in the workspace.
-
But unless you go into the Data Warehouse, Manage permissions pane and grant the service principal Build (or Contributor) on that warehouse item itself, Spark-to-DW queries from the notebook API will still get blocked.
That’s why you see:
-
Lakehouse access works (because Lakehouse Contributor is implied by workspace Contributor).
-
Warehouse access fails (because Spark uses the DW’s item ACL, not just workspace role).
please refer this doc for more:
https://learn.microsoft.com/en-us/fabric/data-warehouse/service-principals
Thanks,
Prashanth
MS Fabric community support
-
- v-prasareCommunity Support
Hi vmattard,We would like to confirm if your query got resolved or if you need further help. If you still have any questions or need more support, please feel free to let us know. We are happy to help you.
Thank you for your patience and look forward to hearing from you.
Best Regards,
Prashanth Are
MS Fabric community support - v-prasareCommunity Support
Hi @vmattard,We would like to confirm if your query got resolved or if you need further help. If you still have any questions or need more support, please feel free to let us know. We are happy to help you.
Thank you for your patience and look forward to hearing from you.
Best Regards,
Prashanth Are
MS Fabric community support - v-prasareCommunity Support
May I ask if you have resolved this issue? If so, Can you please share the resolution steps here. This will be helpful for other community members who have similar problems to solve it faster.
If we don’t hear back, we’ll go ahead and close this thread. For any further discussions or questions, please start a new thread in the Microsoft Fabric Community Forum we’ll be happy to assist.
Thank you for being part of the Microsoft Fabric Community.