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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
JDawsonGLP
Regular Visitor

How to get the current userName in a Fabric Notebook

Hi - 

 

I want to use the Change Feed capability in Delta tables when using Lakehouse and Notebooks. The History feature works great, and you can enable the Change Feed on a table to track and report detailed changes. However with the default Spark Session behaviour the userID and userName are always NULL.

 

I want to figure out how to get the "current user" that's submitting to spark from the notebook. I have tried mssparkutils, and when you use "spark.sparkContext.sparkUser()" you always get "trusted-service-user". Spark UI also shows this, but when you go to the "All Runs" view, is clearly knows the user ID of the Submitter.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @JDawsonGLP 
Thanks for using Fabric Community.
Apologies for the issue you have been facing. Currently there is no workaround to get the name of the current user that's submitting to spark from the notebook. We will have to wait until mssparkutils environment utils is ready. This is planned and is on road map. ETA : Q4 2023

Appreciate your patience.
Hope this helps. Please let us know if you have any further questions. Glad to help.

View solution in original post

3 REPLIES 3
JDawsonGLP
Regular Visitor

OK - thanks for the reply, I was trying the mssparkutils.env methods and saw they weren't available yet. 

Appreciate your response, I'll keep an eye on the blog for updates. As long as it's on the roadmap soon it's fine.

Anonymous
Not applicable

Hi @JDawsonGLP 

Glad that your query got resolved. Please continue using Fabric Community for any help regarding your queries.

 

Anonymous
Not applicable

Hi @JDawsonGLP 
Thanks for using Fabric Community.
Apologies for the issue you have been facing. Currently there is no workaround to get the name of the current user that's submitting to spark from the notebook. We will have to wait until mssparkutils environment utils is ready. This is planned and is on road map. ETA : Q4 2023

Appreciate your patience.
Hope this helps. Please let us know if you have any further questions. Glad to help.

Helpful resources

Announcements
FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Fabric Update Carousel

Fabric Monthly Update - March 2026

Check out the March 2026 Fabric update to learn about new features.