Forum Discussion
upn
Can databricks notebook return the current UPN (equiavalent DAX USERPRINCIPALNAME())?
select current_user()
returns
trusted-service-user which is not useable.
I need it to return the following
[email protected]
mssparkutils.env.getUser
5 Replies
- nilendraFabricSuper User
Have you tried this
user = dbutils.notebook.entry_point.getDbutils().notebook().getContext().userName().get()
print(user)- smpa01Community Champion
sorry, I meant fabric notebook and not databricks notebook
- nilendraFabricSuper User
Fabric Notebooks execute under a service identity rather than the context of an individual user.
thats why When you run a statement such as `select current_user()`, the output is the service account (“trusted-service-user”) rather than the individual’s email addressThis is a known limitation which has been discussed here in forum and enhancements to be made to the mssparkutils package.