What is RLS?
RLS is Row Level security means restriction of data accessing for a particular user. Filters restrict the data at a row level. We can configure RLS for a dataset that we have imported into the Power BI desktop and can configure RLS in Power BI Service by defining the roles in the Power BI desktop.
If you have a fixed list of users and a static number of dimensions then the Static RLS method will work.
The Future of Big Data
With some guidance, you can craft a data platform that is right for your organization’s needs and gets the most return from your data capital.
However, if your user list is long and your dimensions are subject to changes then the Dynamic RLS method will work.
Static RLS setup in Power BI
Consider the scenario where you would like to secure the Territories table to one country per user, follow these steps:
- Go to the Modeling tab and then select Manage Roles Function.
- Create a new role, select the table which you want to get filtered based on the role, and then create a Dax statement to filter this table.
- Once the filters are specified click save.
- Now the role is created. test the functionality using View as Function.
- Now select the new role (UnitedStates) that you have created and click OK.
- You are now impersonating the role (notice the yellow warning bar indicating the current role being applied).
- Repeat the above steps for every desired role.
- Now the next step is to publish the report to Power BI Service by selecting the Publish function on the home tab and then selecting My workspace.
- After the Published report. Open Power BI Service to add members to the role in Power BI service.
- Go to your workspace in the Power BI service. Find the dataset that you created with the same name as your report. Click on the ellipsis (…) and then select Security.
- Next, you will be navigated to the RLS page. On this screen, you can add a member to the role by entering their email address or just the name of the user. When members are added to this role, the DAX filter that you previously defined will be applied to them. If members are not added to the role but have access to the report, RLS will not apply to them. You added the members to the UnitedStates role. Now, when those members sign in, they will only see the report with data that applies to them.
- To test the roles inside the Power BI service by selecting the ellipsis (…) next to the UnitedStates role on the RLS screen and then selecting Test as the role.
- Now you can see the UnitedStates view that we got earlier in Power BI Desktop.
Summary :
In this blog, I have provided a step-by-step guide on implementing Static Row-level security in Power BI.