Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered
Hi,
I have a notebook that saves data to a Kusto database anfd just runs fine with the Run All command in the notebook pane. However as an action within a pipeline I get the error message:
Notebook execution failed at Notebook service with http status code - '200', please check the Run logs on Notebook, additional details - 'Error name - Py4JJavaError, Error value - An error occurred while calling z:mssparkutils.credentials.getToken.
: java.io.IOException: 500 {"code":"TM_INTERNAL_ERROR","subCode":0,"message":"An internal error occurred.","timeStamp":"2024-10-16T12:33:50.8328415Z","httpStatusCode":500,"hresult":-2147467259,"details":[{"code":"RootActivityId","message":"a1e5ed04-3da7-43ec-a6ab-5c250757e571"}]}
Iin the notebook I have:
# Kusto conncetion and database settings
from notebookutils import mssparkutils
# The Kusto cluster uri
kustoUri = "https://****************.z2.kusto.fabric.microsoft.com"
# The access credentials for the write
accessToken = mssparkutils.credentials.getToken(kustoUri)
# The database to read the data from
database = "*******"
The notebook uses a Sandard Spark session runtime 1.2 (Spark 3.4, Delta 2.4).
In the stdout log I see the following suspicious in the trace:
Solved! Go to Solution.
Hi @Sperotech
Try using 'kusto' instead of providing a cluster uri. This should work both when running the notebook by itself and in a pipeline.
accessToken = mssparkutils.credentials.getToken('kusto') # enter 'kusto' instead of a specific cluster uri
Microsoft Spark Utilities (MSSparkUtils) for Fabric - Microsoft Fabric | Microsoft Learn
My testing result:
Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!
Hi @Sperotech
Try using 'kusto' instead of providing a cluster uri. This should work both when running the notebook by itself and in a pipeline.
accessToken = mssparkutils.credentials.getToken('kusto') # enter 'kusto' instead of a specific cluster uri
Microsoft Spark Utilities (MSSparkUtils) for Fabric - Microsoft Fabric | Microsoft Learn
My testing result:
Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!
Hi @Sperotech ,
I guess there might have been some update happening in the Fabric. The sample code in this article in Real-Time Intelligence documentation might need to be updated. Or there should be some documentations introducing the different behaviors of these codes between in notebook itself and in pipeline. Otherwise, it would mislead users.
You could provide your feedbacks about official documents through the Feedback feature on that article's page.
Best Regards,
Jing
There's another topic with a similar issue. Please check that topic and see if a solution will be provided: https://community.fabric.microsoft.com/t5/Data-Science/Fabric-Pipeline-Cant-Query-KQL-but-Manual-Not...
Hi @Sperotech,
Could you check the owner of both the data pipeline and the notebook? I've run across a similar problem when the owner of the notebook was removed from the workspace. You could also check whether the owner of the pipeline and notebook has access to all required items for your run.
Hi @FabianSchut ,
Both pipeline and notebook have the same owner and are in the same workspace. B.t.w. this post is a duplicate of this post (my posts were marked as spam, but that is now fixed) and similar to this post with a slightly wrong title because you can just run KQL fine as a pipeline action, but not within a notebook action.
Hi @Sperotech
Sorry for the late response. I will have a test to check if I can reproduce it. May I know your Fabric data region and service version? Did you experience this failure before? Are you connecting to a free Kusto cluster or a paid one under an Azure subscription?
Best Regards,
Jing
Community Support Team
Hi Jing, my region is Sweden. Pipeline, notebook and Kusto database are all within the same workspace in Fabric. I get this connection error message with both the trial and paid (F2 or F16) subscription. I also recreated the pipeline but that does make a difference.
Best regards,
Marc (Sperotech)
Thank you for these information. I got the same error message in my testing. I have reported this issue internally. It may take some time to receive a feedback. I will keep you updated on any progress. Thank you again.
Best Regards,
Jing
Community Support Team
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Fabric update to learn about new features.
User | Count |
---|---|
7 | |
4 | |
3 | |
3 | |
3 |