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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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