Key takeaways
- RLS filters rows; it does not hide pages, visuals, or columns.
- A mapping table plus USERPRINCIPALNAME is easier to maintain than hard-coded role filters.
- RLS applies to viewers, not to workspace Admin, Member, or Contributor roles.
- Test every role, including a user with no mapping and a user with overlapping access.
On this page
Decide what must be restricted
Row-level security answers a simple question: which rows may this person see? Start with the business rule, not the DAX. A regional manager sees their region. An account owner sees their accounts. A supplier sees their own orders. Write each rule as a sentence and identify the column that carries the restriction.
RLS filters data, not the report layout. It does not hide a visual, a page, or a measure name. If a page must be invisible to a group, use separate reports or apps, not RLS. If a column must be hidden, that is object-level security, a different feature.
Build the mapping table
A static role with a hard-coded filter is fine for one or two rules, but it does not scale. A mapping table is easier to audit: one row per user and permitted value, with the user's sign-in name in a column. Relate it to the dimension it restricts, hide it from report view, and refresh it from a controlled source.
Use the same identifier format the service returns. A mismatch in domain, case, or alias will silently return no rows. Keep the table small, with one row per user and scope, and add an explicit row for administrators only if they need full access.
Keep the mapping table in a source with an owner and a change history. A spreadsheet on a personal drive is a security risk, because nobody can prove who changed access or when.
Write the role filter
For a simple mapping table related to a dimension, the role filter goes on the mapping table. The relationship propagates the filter to the dimension and then to the fact. This is easier to maintain than repeating a filter on every table.
Role filter: 'Security'[Login] = USERPRINCIPALNAME ()
Role filter for a hierarchy: PATHCONTAINS ( 'Employee'[Management Path], USERPRINCIPALNAME () )
The second pattern works for a manager hierarchy where the path column contains the sign-in names of the managers above each employee. For a rule that spans several values, use a table expression rather than a chain of OR conditions. Keep the filter on a narrow table with a clear relationship; a complex filter over a fact table will slow every query.
| Role | Security rule | Intended access |
|---|---|---|
| Regional manager | Login matched to allowed region keys | Only rows for their region |
| Account owner | Login matched to allowed account keys | Only accounts they own |
| Executive | No filter or a full-access flag | All rows |
Test the roles properly
In Power BI Desktop, use View as role and enter a test identity. Check a table of the restricted dimension, a card with a total, and a matrix that crosses the restricted dimension with another. Confirm that the total matches the expected subset, not the full total with blank rows.
Then test the negative case: a user with no mapping should see no rows, not all rows. Test an administrator identity, a user in two regions, and a user whose name differs by case. Role membership is additive, so overlapping roles can widen access; make sure that is intended.
- Test every role, not only the smallest one.
- Test a user with no mapping.
- Test a user with overlapping access.
- Test the published report as a real viewer, because the service test can use your own identity for dynamic rules.
- Test export and subscription paths with a restricted account.
- Compare the visible row count with a known source query.
Publish and operate
Assign users to roles in the workspace or app. Prefer security groups over individuals so joiners and leavers are handled by directory membership. Keep one owner for the mapping table and a documented refresh path. If the mapping table is refreshed manually, say so and set a reminder; stale membership is a security gap.
RLS does not replace workspace permissions. Anyone with Admin, Member, or Contributor access can edit the semantic model and is not restricted by the roles. Publish through an app, give viewers read access, and review who can edit. RLS also does not protect data that someone has already exported, and it does not apply to publish to web.
DirectQuery models apply the role filter at query time, so the source returns only permitted rows. The source database still needs its own access controls for anyone who can query it directly. For embedded reports, pass the effective identity through the embedding pattern; a fixed service principal identity will not produce per-user filtering.
Frequently asked questions
Does RLS work in Power BI Desktop?+
You can author and test roles in Desktop with View as role. The published semantic model enforces the role in the service. Always test there too, because identity and workspace permissions differ.
Can RLS use a user's email address?+
Yes. USERPRINCIPALNAME returns the signed-in identity, which is normally an email or user principal name. Match it against a mapping table rather than hard-coding addresses in many roles.
Does RLS apply to DirectQuery?+
Yes. The filter is included in the query sent to the source, so the source returns only permitted rows. The source database still needs its own access controls for anyone who can query it directly.
What is the difference between RLS and object-level security?+
RLS limits rows. Object-level security limits tables or columns and is configured in the semantic model metadata, not with a role filter. They solve different problems and can be combined.
Need help applying this?
Get help with Dashboards & BI.
Review the service scope or tell us what you are trying to improve. We will reply with a clear next step.
Free KPI definition templateRelated reading
Power BI bookmarks and navigation patterns
Practical Power BI bookmark and navigation patterns: page switchers, view resets, drillthrough, button states, and the testing that keeps them usable.
Power BI dashboard checklist for small businesses
A practical checklist for building a Power BI dashboard that is trusted, fast, and easy to hand over.