Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateJoin the OneLake & Platform Admin teams for an ask US anything on July 16th. Join now.
Hi,
I already created the ticket with Microsoft (2504161420001430) and also opened the issue here and also seems to be related to this issue here.
`notebookutils.runtime.context.get("currentWorkspaceName")` works when executed directly from the Notebook, but does not work when executed from the DataPipeline which was deployed in another workspace using Service Principal via Fabric Core APIs (Create Item - https://learn.microsoft.com/en-us/rest/api/fabric/core/items/create-item?tabs=HTTP).
If I reopen the notebook with my personal account and rerun it again from the DataPipeline, then it works. This implies that the issue is coming from the service principal somehow losing permissions/token and is not able to read the current workspace name where it is running in from the notebookutils runtime context.
What I noticed is that this issue is also present for other built-in methods in Fabric. For example: `notebookutils.lakehouse.get()` and `synapsesql()`. Details can be found here: https://github.com/microsoft/fabric-cicd/issues/202#issuecomment-2797384465. Same approach is being followed in the fabric-cicd library and it is using SPN auth + Fabric Core Create Item APIs (as already mentioned and referenced above).
Did anyone else experience the same/similar issues?
Best regards,
Milos
Microsoft responded to my case yesterday indicating that synapsesql() does not yet support SPN and there is no deployment date for when it will.
For that, You do not need to run in Service Principal. You can run directly the data via Apache Spark + Delta Lake. (Spark and Python)is enough to run because it is open source and for CI-CD ( Whether Databricks/ Fabric), You should use "sed" command in Linux Systems.
df1 = spark.createDataFrame(df) // creating df from python
and then run the below bronze/silver table commands
hi @BhaveshPatel , sorry I do not understand you answer and do not know how it is related to the topic? This thread is about using SPN to deploy to multi environment setups and as soon as SPN takes over ownership it seems that there are some authorization issue coming from the backend.
Hi @mmilosanovic ,
Could you please confirm if the issue has been resolved through the support ticket with Microsoft?
If the issue has been resolved, we kindly request you to share the resolution or key insights here to help others in the community. If we don’t hear back, we’ll go ahead and close this thread.
Should you need further assistance in the future, we encourage you to reach out via the Microsoft Fabric Community Forum and create a new thread. We’ll be happy to help.
Thank you.
Hi everyone,
I have recently identified the same issue when invoking notebook via execute item APIs via SPN which has `notebookutils.notebook.runMultiple()` method in it. I have opened another support case and asked if it can get prioritized together with the one I still have opened because it is related to the same issue. Support case ID: 2507011420003367
Here is the error message:
Hi, it seems that there was an issue which was misleading. More details from MS support available below:
Hi @mmilosanovic ,
Thank you for sharing the update and tracker ID. This case has already been escalated to the PG team, who are currently working on it. We appreciate your patience and they will resolve the issue as soon as possible.
note resolved yet, support is in back and forth with Notebook team and I am awaiting feedback.
It has not been resolved.
I have noticed today under SPN ownership it no longer can run spark.sql and returns mwc token error. Whereas most of the other library methods with sempy, notebookutils is working even though it gives some cluster issues but the process continues to run successfully.
Hi @mmilosanovic ,
Thank you for your patience and understanding. Our CSS engineers are actively working on the issue, and since it is currently in progress, we expect it to be resolved soon. We appreciate your cooperation and will keep you informed with any updates.
Thank you.
Can you elaborate on 'soon' for those of us trying to control project schedules? This is a BUG not an IDEA. I don't see a workaround for several of the calls including the synapsesql() function?
You're absolutely right - this is a known issue when running notebooks in the context of a Service Principal, especially when using notebookutils.runtime.context or mssparkutils.env. I ran into the same thing recently and did a deep dive into how execution context really works in Fabric.
If you're interested, I wrote up my findings (including this bug and a workaround) in this blog post:
Who's Calling? Understanding Execution Context in Microsoft Fabric
Your workaround was so helpful thank you. I don't suppose you have a workaround for synapsesql() ?
Just to update everyone based on the most recent discussion with Microsoft support on the support case: They have pointed me to Fabric Community forums (so here where we already started discussion and report this issue) and to the Ideas part, so I also created an idea referencing this thread and pointing that this is a known issue and also asking for a fix and/or a workaround.
Please vote here: https://community.fabric.microsoft.com/t5/Fabric-Ideas/Enable-notebookutils-and-other-methods-to-wor...
Hi @mmilosanovic ,
Thank you for the update and for continuing to raise visibility across the support channels and community.
As acknowledged internally, this behavior is a known limitation when executing notebooks via Service Principal authentication, where certain methods like notebookutils may not function as expected due to context initialization issues. The product team is actively reviewing the scenario, and we anticipate future improvements to address these limitations.
Your engagement through the Ideas forum is appreciated and will help with prioritization. We’ll continue to monitor this and share any updates or guidance as they become available.
Also please try to review the information provided by @gaya3krishnan86 which might help you.
If this post helps, then please give us Kudos and consider Accept it as a solution to help the other members find it more quickly.
Thankyou.
Hi everyone,
I just got feedback from the support that Notebook PG team has fixed the issue. I tested again and it seems to work now. I only tested
notebookutils.runtime.context.get("currentWorkspaceName")
so not sure if this also fixes all the
notebookutils
methods or
synapsesql()
methods.
Can someone else also give it a try and share findings here?
Best regards,
Milos
synapsesql() still doesn't work and per Microsoft yesterday is not supported with SPN at this time and there is no date for when it will be so I guess it is not a real tool yet.
Hi @mmilosanovic ,
Thank you for following up and sharing that the issue was resolved through Microsoft Support. We're glad to hear that your concern has been addressed successfully.
Please make your answer as accepted. Your input is valuable, and sharing the outcome helps others in the community facing similar issues.
If you have any further questions or need assistance in the future, please don’t hesitate to create a new post on the Microsoft Fabric Community Forum we’re always here to help.
Thank you.
hi @v-tsaipranay this is still not resolved and ongoing with MS support, specifically around other methods (issue seem to be the same with authorization) like synapsesql().
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.