Sub topic 12
What RLS does not cover
This chapter assumes you can already build roles with DAX table filter expressions, write a dynamic role with USERPRINCIPALNAME(), and assign members in the Power BI service. Here you will learn where row-level security (RLS) stops protecting data. Most RLS incidents come from expecting it to do more than it does.
What RLS actually enforces
RLS adds a filter to every query that a restricted user runs against a semantic model. The filter removes rows from the tables you named in the role. Everything else about the model stays visible and usable.
This has three consequences:
- RLS limits which rows a person sees. It does not limit which columns, tables, or measures they can see.
- RLS applies to the semantic model, not to the data source behind it, and not to copies of the data that leave the model.
- RLS applies only to people who reach the model as restricted users. Several permission levels skip it.
The rest of this chapter covers each boundary in turn.
Who is not restricted
Roles are enforced only for users who have no edit rights on the semantic model. The practical rules are:
| Access the user has | Is RLS enforced? |
|---|---|
| Workspace Viewer | Yes |
| Workspace Admin, Member, or Contributor | No. They see all rows. |
| Write permission on the semantic model | No |
| Read and Build permission only (for example through an app or a direct grant) | Yes |
| Owner of the semantic model | No, because the owner can edit it |
The most common mistake is to add a tester to the workspace as a Contributor or Member, assign them to a role, and then conclude that the role "doesn't work". The role works, but their workspace role overrides it.
Build permission does not bypass RLS. A user with Build can create new reports on the model, and every one of those reports is still filtered by their role. This makes Build a safe permission to grant to restricted analysts.
The reverse mistake is to put report authors in the Viewer role to "test security" and then expect them to edit the report. Viewers cannot edit.
RLS does not hide columns, tables, or measures
A role with [Region] = "West" removes non-West rows from Region and from every table it filters through relationships. It does not remove the Salary column from an Employee table. A user who can see their own rows can see all columns on those rows.
If a column must be hidden, you need object-level security (OLS). OLS is a separate feature, configured on the model with external tooling such as Tabular Editor. It marks a table or column as inaccessible for a role. The two features cover different things:
| Need | Feature |
|---|---|
| Show West managers only West rows | RLS |
| Hide the `Salary` column from everyone except HR | OLS |
| Hide a whole table from a role | OLS |
| Keep a report page from showing a visual | Report design, which is not security |
Hiding a column in the model view (marking it hidden) is not security. Hidden fields stay out of the field list, but a user with Build permission can still query them, for example through Analyze in Excel or a DAX query.
Aggregates are computed on the visible rows only
Measures run after the role filter. This is why RLS can seem to break a report when it is working correctly. Consider a measure that shows a region's share of all sales:
Total Sales = SUM ( Sales[Amount] )
Share of Total =
DIVIDE (
[Total Sales],
CALCULATE ( [Total Sales], ALL ( Region ) )
)For an unrestricted user, West might show 25 percent. A user in a role with [Region] = "West" sees 100 percent. ALL ( Region ) removes report filters, but it cannot remove the role filter, so the denominator contains only West rows.
This cuts two ways:
- It protects you. A measure cannot be written to "escape" a role and reveal other rows.
- It surprises report authors. Company-wide totals, rankings, and benchmarks will differ between restricted and unrestricted users. If a regional manager needs to see the company total as context, RLS cannot provide it from the same table. You would need a separate, pre-aggregated table that is not filtered by the role. Put that table in only if the company total is safe to expose.
Relationships can leak or block the filter
A role filter travels along relationships in their filtering direction, from the dimension (the "one" side) to the fact table (the "many" side). Three situations cause trouble:
- A fact table with no relationship to the filtered dimension. The role filters the dimension, but the fact table is not filtered, so all fact rows remain visible through any measure that does not involve the dimension.
- Filters on the "many" side. A filter placed on a fact table does not flow back to the dimension tables unless the relationship is bidirectional and the option to apply security filters in both directions is turned on. A visible dimension list may then show members the user has no facts for.
- Several fact tables that share a dimension. Only fact tables related to the filtered dimension are restricted. A fact table related to a different dimension is not.
Check every fact table, not only the one in your first test report. A quick check is to put a card with COUNTROWS ( 'TableName' ) for each table into a report and view the report as the role.
Data that leaves the model is not protected
RLS is evaluated when someone queries the published semantic model. Several routes bypass that evaluation:
- The source system. Anyone with direct access to the database, files, or lake can read everything. RLS in Power BI does nothing there.
- The
.pbixfile. An imported model stores all rows in the file. Anyone who has the file can open it in Desktop with no roles applied. Do not email or share the file as a way to give "filtered" access. - Dataflows and other models. If another model or dataflow ingests your data, that downstream item has its own security. Your roles do not travel with the data.
- Publish to web. This creates a public link and does not support RLS. Never use it for restricted data.
- Embedding. In an embed-for-your-customers app, the app authenticates with a service principal or master account, which is not restricted. RLS applies only if the app supplies an effective identity (a user name and roles) when it generates the embed token. If it does not, every visitor sees all rows.
- Screenshots, copy and paste, and exports. What a user legitimately sees, they can copy. RLS limits what they can see, not what they do with it.
Other behaviors to plan for
- Live connections. For a live connection to SQL Server Analysis Services or Azure Analysis Services, roles and membership are defined on the Analysis Services model, not in Power BI.
- DirectQuery. Role filters are translated into the query sent to the source. Complex filter expressions can slow the source query, and the results depend on source performance.
- No role, no data. A user who is a Viewer but is in no role gets no data from a model that has roles defined. They do not see "everything by default". A new employee who is not yet in the right security group sees empty or blocked visuals.
- Identity values.
USERNAME()returns a different format in Desktop than in the service.USERPRINCIPALNAME()is the safer choice, because both return the sign-in name. Test against the exact value the service will use. - Inference. Slicer lists and filter pane values reflect the filtered data, but model structure is not hidden. Table names, column names, and measure names remain visible to anyone who can open the model.
A checklist for reviewing a model
Before you publish a model that has RLS, check each item:
- Every fact table is reachable from a filtered dimension, or has its own role filter.
- Nobody who should be restricted is an Admin, Member, or Contributor, and nobody restricted has Write permission on the model.
- Sensitive columns are protected with OLS, not only hidden.
- The source data, dataflows, and downstream models have their own access control.
- No restricted data is available through Publish to web, or through a shared
.pbixfile. - Embedded apps pass an effective identity.
- Report authors know that totals and percentages reflect only the visible rows.
Exercise
A regional manager is in a role with the filter [Region] = "West". They report two problems: (1) their "% of all regions" card shows 100%, and (2) a colleague who was added to the same role as a workspace Member sees every region. Explain both observations and say what you would change.
Show answer
(1) The role filter is applied before the measure runs, and ALL ( Region ) cannot remove it. The denominator therefore contains only West rows, so the share is 100%. This is correct behavior. If the manager needs company context, provide a separate pre-aggregated table that is safe to expose, or accept that restricted users see different totals. (2) Members of a workspace can edit the semantic model, so RLS is not enforced for them. To restrict the colleague, change their workspace role to Viewer, or remove their workspace access and share through an app with Read and Build permissions only.
Exercise
Your model has roles on the Region dimension. A column named Salary in an Employee table must be invisible to sales managers. A teammate suggests adding a role filter, and another suggests hiding the column in the model. Why are both approaches insufficient, and what should you use?
Show answer
A role filter removes rows, not columns, so the sales managers still see Salary for every row they are allowed to see. Hiding the column only removes it from the field list, and a user with Build permission can still query it, for example through Analyze in Excel. Use object-level security (OLS) to deny the role access to the column, and test it by viewing as that role.
Exercise
A developer embeds a report in a customer portal using a service principal. Every portal user sees all rows, although the semantic model has correct roles. What is the most likely cause?
Show answer
The service principal is not restricted by roles, and the app did not supply an effective identity (user name and role names) when generating the embed token. Without it, RLS is not applied. The app must pass an effective identity for each visitor.