Forum Discussion
Notebook activity in the Fabric pipeline, using Service Principal resulting in error
Hi Team, I'm trying to set up a notebook activity in the Fabric pipeline using Service Principal. I've followed the documentation (Notebook activity - Microsoft Fabric | Microsoft Learn), but I keep encountering an error.
The activity works fine, if I do not add SP to the pipline connection setting. The Service Principal have Contributor access to the workspace containing the pipeline and the notebook. Service principal is also allowed to call Fabric public APIs.
I am unable to identify the root cause. Any help would be appreciated. Thanks
'Notebook execution failed at Notebook service with http status code - '200', please check the Run logs on Notebook, additional details - 'Error name - Exception, Error value - Failed to create Livy session for executing notebook. Error: {"code":"BadRequest","subCode":0,"message":"Encountered internal error while calling TokenProvider to get obo token. The return code is BadRequest, and no error details was provided.","timeStamp":"2026-04-24T18:06:52.4379867Z","httpStatusCode":500,"hresult":-2146233088,"details":[{"code":"RootActivityId","message":"e3a4cc85-5bc0-4661-8361-5c6a0f3ae1b5"},{"code":"ErrorSource","message":"Fabric/Core Platform AuthNZ and Metadata"}],"exceptionCategory":0} HTTP status code: 500.' :'
9 Replies
- v-saisrao-msft
Community Support
Hi bkhan2,
Thank you Lodha_Jaydeep, for your insights.
The failure happens during notebook execution when Fabric attempts to create a Spark (Livy) session. Microsoft documentation states that the Livy API used for Spark execution currently does not support Service Principals, which may cause failures if a Service Principal is used. Even with the correct permissions, this is a platform limitation, not a configuration problem. As a workaround, you can run the notebook activity with a user identity or Workspace Identity, or use a hybrid method where only the notebook operates under a user identity.
Submit Spark batch jobs using the Livy API - Microsoft Fabric | Microsoft Learn
Notebook activity - Microsoft Fabric | Microsoft Learn
Thank you.
- bkhan2New Member
Thanks v-saisrao-msft
I am getting the same error even with the Worksapce Identity.The Worksapce Identity have Contributor access to the workspace containing the pipeline and the notebook. Worksapce Identity is also allowed to call Fabric public APIs.
- praveensreeramFrequent Visitor
Can you please try removing the connection completely in the notebook activity?
- v-saisrao-msft
Community Support
Hi bkhan2,
Since you’ve followed the documented setup for Microsoft Fabric and the issue still continues with both Service Principal and Workspace Identity, it seems unlikely that this is a configuration issue.
The error during Spark (Livy) session creation suggests there may be a backend or token flow problem that needs further investigation. I recommend raising a Microsoft support ticket with the Pipeline Run ID and RootActivityId for further analysis.Create a Fabric and Power BI Support Ticket - Power BI | Microsoft Learn
Thank you.
- Lodha_Jaydeep
Solution Sage
Hi bkhan2,
Thanks for reaching fabric community. will happy to assist.
Can you please test first the service principal is working as accepted or not by follow the steps below.
SPNCheckAfter sucessully test of SPN, still you are facing any issues while run the notebook/pipeline as service principal (mentioned in your post), below are the some steps you can try.
- Re-bind the Activity:
Community reports indicate a "sticky" metadata issue where manually adding the notebook from the pipeline doesn't always trigger the correct token flow.- Delete the existing Notebook activity from your pipeline.
- Open the Notebook itself.
- Go to the Run tab and select Add to pipeline -> Existing pipeline.
- Reconnect your dependencies and try running it again.
- Enable "Code-First Artifacts" on the Connection if used:
If you created the connection in the "Manage Gateways and Connections" portal, it may lack the permission to be used by notebooks.- Verify if the connection has the checkbox "Allow Code-First Artifacts like Notebooks to access this connection (Preview)" enabled.
- Crucial: This setting can often only be set during the initial creation of the connection. If it is unchecked, you must delete and recreate the connection.
Please accept as an answer if it helps, kudos are really appriciated.
- Re-bind the Activity:
- praveensreeramFrequent Visitor
Hi bkhan2 ,
In the Notebook activity's settings, you would see the Connection field as optional. In case, if your Notebook and the Data Pipeline are in the same workspace, just remove the Connection and the Notebook activity will succeed.
You can go through my blog here for more info - https://praveenkumarsreeram.com/2026/04/27/11644/
Thanks,
Praveen Sreeram
- bkhan2New Member
Thanks praveensreeram for the message.
The idea is to select the authentication method Under conneciton.
I want the pipeline to run with the Workspace Identity or a Service Principal. Hence using the connection.
https://learn.microsoft.com/en-us/fabric/data-factory/notebook-activity#configure-notebook-settingsThat was the whole idea of thie feature
https://blog.fabric.microsoft.com/en-US/blog/run-notebooks-in-pipelines-with-service-principal-or-workspace-identity/Thanks
- praveensreeramFrequent Visitor
I also had the exact issue with my Trial account. But, it was working fine with my regular Fabric Capacity. So, I had to remove the Notebook connection and then it worked in my Trial Fabric Account.
Are you using Trial Fabric CApacity by any chance?