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
keerthig21
Frequent Visitor

Test RLS with Power BI Service Live Connection

Hi,

 

How can I test the Row Level Security (RLS) in the report that uses Power BI Service Live Connection? Please let me know.

 

Regards,

Keerthi

 

 

1 ACCEPTED SOLUTION

Hi there

From my understanding the only way to test when connecting using a Live Connection is with the actual user logging in.

If it works successfully for one user, it should then work for the others.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

View solution in original post

7 REPLIES 7
darrenfishell
Advocate II
Advocate II

I have had success testing with another method that can also be used to mimic RLS on a shared dataset. In this use case for mimicking RLS, it's important that the users don't have build access to the dataset and can only export summarized data from any visuals, as they'd otherwise be able to access everything. 

Being a live connection, all of the measures I'm mentioning below are report-level measures. Here are the steps:

  1. Create a measure like ACTIVE_USER = "stringliteral@sampleemail.com", typing in the user's email that you'd like to test. This is the same as testing RLS for "other role" in the "View as" Modeling menu.
  2. Using a measure you'd like to test, create a new measure such as: 

 

SAMPLE_MEASURE = 
VAR _user = [ACTIVE_USER]
RETURN
CALCULATE( [TARGET_MEASURE], USER_TABLE[EMAIL] = _user )

 

This isn't practical for testing across a wide range of measures, but it does allow for testing different users across a number of measures, by turning [ACTIVE_USER] into variable that can be set in one place (within that measure). 

This does need to be set as a variable, which is just a manipulation of the calculation order in DAX, computing [ACTIVE_USER] before [SAMPLE_MEASURE] and then making that availalbe for the CALCULATE() function. 

In the scenario where this is used to mimic RLS filtering, you would simply replace the string literal in the [ACTIVE_USER] measure, as: ACTIVE_USER = USERPRINCIPALNAME().

GilbertQ
Super User
Super User

Hi there

If you are the author you will always be an admin and see all the data.

You would need to connect with another user who has got RLS applied.

I do know that RLS will apply to the dataset if you do a Live Connection and even via Analyze in Excel.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Hi,

 

Thank you for the response. Generally I test the RLS in Power BI service using Test as Role feature and view as an actual user. But when I use Test as Role on the data set, I am not getting any option to see the behaviour of the other reports that use this data set using Power BI service live connection. I tried connecting as other test user and it works but I want to test it as a real user.

 

Appreciate your help! 

Hi there

From my understanding the only way to test when connecting using a Live Connection is with the actual user logging in.

If it works successfully for one user, it should then work for the others.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Thank you. This is helpful!

I am logging in as actual user to test and also I added a table visual to the report that has the data model and testing the RLS for different roles using it.

Regards,

Keerthi

 

Anonymous
Not applicable

Hi, 

I am wondering how did you achieve this. Can you please provide steps to get this working?

Thanks

Angad

Awesome, glad you got it working and you could test successfully




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

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