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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors
Top Kudoed Authors