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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
padiga-isw
Frequent Visitor

Getting logged in user from Power BI service

Hi Everyone,
I am working on a custom connector that can interface a trino driver with Power BI Service, I am currently facing a hurdle where I want to implement a mechanism similar to SSO. I am using Kerberos Authentication in my local machine which is hosting the Driver(supports kerberos) and the Gateway. In kerberos, Gateway user has the access to impersonate other users. So currently I am able to access the Driver from Power BI service using my gateway and the logged in user will be the Gateway service. Since this connection is used by multiple users, I want to log the user that used the connection. Since gateway Service is able to impersonate other users, I am looking at getting the username from the user that's logged into Power BI service and passing it to my Driver to impersonate this user using the Gateway account. Can you please help me with how can I access the username/user-email  from the Power BI service

Thank you

1 ACCEPTED SOLUTION

Hi @padiga-isw,

 

Thank you for reaching out to Microsoft Fabric Community Forum.

 

Power Query M does not provide a built-in way to get the logged-in Power BI Service user dynamically.

This function Extension.CurrentCredential[Username] may return the authenticated username. It works if your connector supports OAuth or Windows Authentication.

It Does not work if Power BI Service does not pass credentials or using Anonymous authentication.

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!

 

Regards,
Vinay Pabbu

View solution in original post

3 REPLIES 3
padiga-isw
Frequent Visitor

Hi @Akash_Varuna,

Thank you for the suggestions but I was looking at something that can get the username directly from the Power BI service, these 3 methods are not convenient because we are using Power query M language to write our custom connector so I cannot use DAX functions with it, and I couldn't find any functions or methods through which I can get the gateway logs and fetch the username from that and since a connection can have multiple users using it we can't hard code the users.
In my current configuration I am taking a optional KerberosUsername which when is filled uses Kerberos Authentication on the Trino Driver and passes KerberosUsername as the User to the Trino Driver to impersonate

​CredentialConnectionString  = [
                        AuthenticationType = "Kerberos Authentication",
                        UID = KerberosUsername
}

Driver Configuration (KerberosUsername will be placed in the User field)Driver Configuration (KerberosUsername will be placed in the User field)Configurtion in Power BI Service new connection menuConfigurtion in Power BI Service new connection menu

 

If I set KerberosUsername while creating a new connection in Power BI service, the same credentials will be used for other users, So I want to remove this Kerberos Username field and get the username/email from Power BI service directly and pass it as the User, Please correct me if my understanding of the above solutions were wrong.


Thank you

Hi @padiga-isw,

 

Thank you for reaching out to Microsoft Fabric Community Forum.

 

Power Query M does not provide a built-in way to get the logged-in Power BI Service user dynamically.

This function Extension.CurrentCredential[Username] may return the authenticated username. It works if your connector supports OAuth or Windows Authentication.

It Does not work if Power BI Service does not pass credentials or using Anonymous authentication.

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!

 

Regards,
Vinay Pabbu

Akash_Varuna
Super User
Super User

Hi @padiga-isw  , Could you please try these

  1. Effective Identity (RLS)

    • Configure Row-Level Security in Power BI.
    • Use the EffectiveUserName() passed via the gateway to impersonate the user in your driver.
  2. Custom Headers/Parameters

    • Use USERPRINCIPALNAME() in Power BI to get the logged-in user.
    • Pass it as a parameter or header to the custom connector for impersonation.
  3. Gateway Logging

    • Enable logging on the gateway to track user access without directly passing the username to the driver.
      If this post helped please do give a kudos and accept this as a solution
      Thanks In Advance

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

Top Solution Authors