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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Dude010101
Frequent Visitor

Is this feasible/ safe: USERNAME() for Row Level Security in report shared with external guest

Hi,

i just build a rough proof of concept that works fine but might not be intended to be used this way:


The goal is to share a report to someone outside of the company/ domain. So in admin portal share with external guest users is enabled.

Next I created a report that contains a RLS = USERPRINCIPALNAME().

However USERPRINCIPALNAME() resolves some rather long/ unususal strings for foreign mail accounts like example@live.com

The function works though and the report gets filtered just fine.

 

Do you think it is an acceptable use of RLS and USERPRINCIPALNAME() ?

 

Thanks for your replies!

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @Dude010101 

It is acceptable to use userprincipalname to build your RLS.

The Power BI DAX USERNAME() function helps to return the user domain login with the form of (Domain\User) in the locality or your local system.

The Power BI DAX USERPRINCIPALNAME() function helps to return the user principal name with the form of (User’s login credential or Preeti@<tenant>.onmicrosoft.com) in the Power BI Online Service.

For more details you may refer to these blogs:

Blog1:  Row-level security (RLS) with Power BI

Blog2: Dynamic Row Level Security with Power BI Made Simple

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

View solution in original post

3 REPLIES 3
v-rzhou-msft
Community Support
Community Support

Hi @Dude010101 

It is acceptable to use userprincipalname to build your RLS.

The Power BI DAX USERNAME() function helps to return the user domain login with the form of (Domain\User) in the locality or your local system.

The Power BI DAX USERPRINCIPALNAME() function helps to return the user principal name with the form of (User’s login credential or Preeti@<tenant>.onmicrosoft.com) in the Power BI Online Service.

For more details you may refer to these blogs:

Blog1:  Row-level security (RLS) with Power BI

Blog2: Dynamic Row Level Security with Power BI Made Simple

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

lbendlin
Super User
Super User

What now, USERNAME() or USERPRINCIPALNAME() ?

 

The latter is preferred as it behaves the same on desktop and service.

Sorry, we used USERPRINCIPALNAME() in the end

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors