Forum Discussion
Question Regarding Terminating Long-Running User Sessions in Microsoft Fabric
We’ve noticed a long-running user session in Microsoft Fabric. Could you confirm whether there is a way to manually terminate user sessions after they have been running beyond a specified threshold?
I’ve reviewed documentation related to background activity in Lakehouse databases, but I need guidance on ending the session from a capacity-level control perspective (rather than within an individual Lakehouse/database context).
HI felipecpereira ,
No native feature currently allows automatic session termination based on runtime duration. However, you can:
Monitor session duration manually through the Capacity Metrics or Spark Monitoring UI
Trigger actions via API or automation, but this requires you to:
Use the Microsoft Fabric REST APIs to pull session/user details
Cross-reference session starts times and durations
Use scripting (PowerShell, Python) to call the DELETE endpoint for those sessions
Same goes for other process typesrefreshes, queries, pipelines. Termination usually isn’t exposed unless it’s a Spark notebook.
Solved: SparkSession don't stop - Microsoft Fabric Community
Microsoft Fabric REST API references - Microsoft Fabric REST APIs | Microsoft Learn
Workspace administration settings in Microsoft Fabric - Microsoft Fabric | Microsoft Learn
Best Regards,
Lakshmi
9 Replies
- lbendlinSuper User
Please specify if you mean Spark sessions or something else.
- v-lgarikapatCommunity Support
Hi felipecpereira ,
Thanks for reaching out to the Microsoft fabric community forum.
Thanks for your prompt response
Could you please provide more details in order to propose the appropriate solution? Please specify if you are referring to Spark sessions or something else
We look forward to hearing from you.
Best regards,
Lakshmi - felipecpereiraRegular Visitor
Hi v-lgarikapat and lbendlin,
In the Fabric report, we can check what has been executed, what is currently running, CU usage, etc. I would like to know if it's possible to terminate a user session once it meets a specific criterion, such as a session being open for more than 1 minute.
I hadn’t considered Spark, but is it also possible to terminate the session of a specific user who has been running a notebook for a long time?
- lbendlinSuper User
Notebooks run inside spark sessions. Killing the session will terminate the notebook.
- felipecpereiraRegular Visitor
Sure! And what about other processes? I would like to terminate a process when it reaches a specific execution time, for example