Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
10 years ago
Solved

Row Level Security (RLS) on SQL Server data

Hi everyone, 

 

I am trying to give RLS a test but not getting anywhere when end users access reports & dashboards. Here's what I have set up, and done. 

 

Data: 

Data is coming from SQL Server through Reporting Services on-prem. The dataset contains sales data for districts in Western Australia, and contains two queries, Corporate Sales & Calendar.

I have added a new column UserID in Corporate Sales query in Query Editor and assign pbitest001 & pbitest002 based on random criteria. so now the rows in this dataset belongs to two users, pbitest001 & pbitest002.  I created a report, and in 2nd tab, i dropped a matrix, plotted user id and district fields on columns, and revenue figures on columns. basically this matrix will tell me what user i am able to see after applying RLS in the cloud.  I published the report in cloud, and dont' set up auto refresh, as yet.

 

PBI Service:

After publishing the report, I went to the dataset properties > security > RLS. Created a new rule in Corporate Sales which says [UserID] = "pbitest002", saved, and tested the role. It just shows the data for pbitest002 user. Sweet. 

 RLS DAX ruleRLS rule test

End User (PBITEST002)

When I log on to cloud using PBITEST002, i can still see data for PBITEST001. The column DaxUserName is a DAX measure, set to return value of Username(), which in this case returns current user name. 

 

Data view of logged on user (member, non admin)

 

Not sure why 002 user is able to see data for 001? I tried fully qualified column name in the DAX expression set in rules but does not work. What's more confusing is that the test works as expected. 

 

any ideas folks?

 

Thanks

Kaz

  • Anonymous's avatar
    Anonymous
    10 years ago

    Hi Adam, and everyone, 

     

    I finally got it t work. the reason why RLS was not working as expected, was that the role member (PBITEST002) was configured as an admin of the workspace. RLS started working as expected once I set pbitest002 as member.

     

    Thanks

     

    Kaz

13 Replies

  • ankitpatira's avatar
    ankitpatira
    Community Champion

    Anonymous When you created role in RLS did you added your user PBITEST002 under Members tab ? Follow steps listed in this post. 

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      ankitpatira Yep, I did add PBITEST002 to the role members list. 

       

      Thanks

       

      Kaz

      • ankitpatira's avatar
        ankitpatira
        Community Champion

        Anonymous Try this,

         

        in your DAX you don't need to mention table name. so your dax should be [Column]="PBITEST002"

         

  • Vicky_Song's avatar
    Vicky_Song
    Impactful Individual

    Anonymous, did you check the same Power BI report when you do "Test data as role" and sign in as PBITEST002? The images you posted show that you're checking Power BI report when you do "Test data as role", however, you're checking with Power BI Dashboard when sign in as PBITEST002. 

    • Anonymous's avatar
      Anonymous
      Not applicable

      Vicky_Song, yep, I checked the same report at the time of testing the role as well as after logging in as PBITEST002. 

      • Anonymous's avatar
        Anonymous
        Not applicable

        bump...