Row Level Security (RLS) is a feature available in Power BI Pro. To know more about what pro content is refer Power BI Pro Content. Roles are defined at Power BI desktop level and role definitions will also be published when the reports are published.
What is this feature all about ?
- Allows you to restrict data access for users
- RLS can be configured for both imported data and direct query.
- RLS feature is not available for Live Connections.
Let’s Get Started !!!
For the example below, I have already created a Power BI Report by region using dummy and random data. Here, I will add row level security feature by region. In the report below, as you see, data is displayed for all regions by default.
- Open Power BI desktop.
- If your Data Connectivity Mode is DirectQuery, then Enable cross filtering in both direction for DirectQuery.
- Go to File –> Options and settings –> Options
- Select Preview Features
- Enable the option
- The report currently has only three regions –> Central, East and West. I will create roles for each one of them
- Go to Modelling –> Manage Roles
- Follow Steps below:
- Select Create
- Enter the name of the role.
- Select the table that has field on which the filter needs to be applied.
- Enter the value. This expression would return true or false.
- Click Save.
- Repeat the steps for the other regions as well.
- I have created roles for north and south region as well, assuming that someday the data would get updated for north and south regions as well.
- You can verify the results of the role that is created. Select View As Roles.
- Select the role you created and select OK to apply the role on the reports.
- The report will only display data for Central Region.
- Similarly for west and east regions.
- You can even view the data by the user by selecting Other user option.
- Publish the report.
- Select the (…) next to the Dataset.
- Select Security.
- For each role add the e-mail addresses of the members.
- Remove members.
- Test role by selecting (…) ellipsis “Test as Role”
- Report will display as per the role selected.