Power BI Row Level Security: How to Test Your Access Rules
A sales report lets each regional manager see only their own customers. That sounds like a straightforward use case for Power BI Row Level Security. Yet a missing user mapping, an additional role or excessive workspace permissions can undermine the design. A report that looks right is not proof that its access rules work.
This article shows you how to build a reliable test matrix covering permitted access, explicitly prohibited access and documented results before release.
In short: Power BI Row Level Security restricts visible data rows according to roles and user identities. Test it with a matrix that combines identity, role membership, workspace permissions and expected records. Negative access tests and real user accounts are essential because role simulation alone does not reproduce every permission path.
How does Power BI Row Level Security work with dynamic roles?
Power BI Row Level Security, or RLS, filters rows in a semantic model. With dynamic roles, the signed-in user's identity determines which mapped business areas they can access.
Static roles might contain a fixed filter for one region. Dynamic roles instead use a mapping table with columns such as UserUPN and RegionKey. A person can be mapped to one region or several.
A typical DAX filter on that table is:
'UserRegion'[UserUPN] = USERPRINCIPALNAME()
That filter alone does not complete the security design. It must propagate through correctly configured relationships to the relevant fact tables. An isolated mapping table does not protect sales records. Check relationship directions and security filter propagation deliberately; do not enable bidirectional relationships indiscriminately.
Two mappings, two potential failure points
Distinguish between:
- Role membership: Which users or supported groups belong to an RLS role in the Power BI service?
- Data mapping: Which regions, legal entities or tenants are assigned to that identity in the model?
Correct role membership cannot compensate for an incorrect data mapping. Set an explicit rule: an identity without a valid mapping must not see protected business data. Test this requirement for blank keys, unknown identities and outdated entries too.
Which workspace permissions affect RLS?
In the Power BI service, RLS applies to users with the Viewer workspace role, but not to Admins, Members or Contributors. Testing with editing permissions therefore does not reproduce a report consumer's actual access.
Your matrix must capture effective permissions, not just the intended entry point. Someone might open a report through an app while also being a Contributor in the underlying workspace through group membership.
Keep these distinctions clear:
- Viewer: RLS applies when role membership and the model are configured correctly.
- Admin, Member, Contributor: These workspace roles are not restricted by RLS.
- Build permission: It does not bypass RLS for a Viewer, but enables additional usage paths worth testing.
- App audiences: They control content distribution, not row-level data security.
If reports and semantic models sit in separate workspaces, pay particular attention to permissions on the semantic model. Record both direct permissions and those inherited through groups.
What should a dynamic RLS test matrix contain?
An RLS test matrix pairs each relevant user and permission combination with an unambiguous expected result. It must cover both permitted access and explicitly prohibited access.
Use a controlled dataset with known record IDs. Totals alone are insufficient: different sets of records can produce identical revenue figures.
| Test case | Identity and permissions | Expected result |
|---|---|---|
| Single assignment | Viewer, dynamic role, North region | Only North record IDs |
| Multiple assignments | Viewer, same role, North and South | Union of both regions |
| Missing data mapping | Viewer, role assigned, no mapping | No protected business data |
| Missing role membership | Report access but no applicable RLS role | No access to protected model data; an error may appear |
| Unknown or blank identity | No valid identity mapping | No unintended access |
| Overlapping roles | Viewer, multiple RLS roles | Union of permitted data, approved by the business |
| Additional workspace rights | Business consumer is a Contributor | RLS does not apply; fix permissions before release |
| Additional Build permission | Viewer with Build | Only permitted rows remain accessible |
| Unauthorized record | North Viewer explicitly requests a South ID | Unauthorized record stays invisible |
| Revoked assignment | Mapping or group membership removed | Previous access ends once the change takes effect |
Why multiple roles need particular attention
RLS roles are additive: their permitted datasets are combined. A restrictive role does not revoke access granted by another role.
Do not design a test around the assumption that a “deny role” overrides an “allow role.” Instead, verify that every possible role combination is acceptable to the business. An additional unfiltered role can neutralize an otherwise correctly configured restriction.
How do you produce evidence of access checks before release?
An auditable RLS test compares predefined expected records with actual visible records and captures the identity, permissions and model version used. Screenshots of individual visuals can support this evidence, but are not sufficient on their own.
Combine simulation with real user accounts
Start with “View as” in Power BI Desktop to test roles and alternative user identities. After publishing, test the roles in the Power BI service as well. Then use real test accounts with the intended effective permissions.
For guest accounts, verify the identity actually resolved in the target environment rather than assuming it matches a particular email format. Keep test sessions separate so cached sign-ins do not produce misleading results.
Run deliberate negative access tests
Go beyond the report's landing page. Using the restricted account, attempt to:
- retrieve unauthorized record IDs through filters, drillthrough and detail pages;
- view protected data through other reports using the same semantic model;
- use available export functions and, if enabled, Analyze in Excel;
- access a previously permitted data area after its assignment has been revoked.
For imported mapping tables, changes must first reach the model through a refresh. Group and permission changes may also take time to become effective. Record those timings and repeat the test in a new session.
Your test log should include the test case ID, timestamp, model version, test identity, effective permissions, expected and observed record IDs, and release decision. Protect the evidence itself against unauthorized access.
What are the limits of Row Level Security?
RLS protects rows; it does not automatically secure particular columns or tables as separate protected objects. It also cannot retrieve data that has already been exported or replace controls over privileged permissions.
Object-Level Security, or OLS, can protect sensitive columns or tables. Simply hiding a field in the report interface is not a security control.
RLS also cannot independently distinguish legitimate access from an undesirable use of permitted data. Export controls, data classification and appropriate permissions remain necessary. Embedded scenarios introduce additional identity and token configurations that require separate tests.
How we approach this
For a dependable release process, we connect business access rules with technical regression tests:
- Define intended access: Business owners specify permitted and prohibited data areas, including delegated responsibilities and multiple assignments.
- Map permission paths: We examine role memberships, data mappings and effective permissions on the semantic model.
- Create reference cases: Controlled test data and accounts cover normal scenarios and critical exceptions.
- Compare results: We check specific sets of record IDs and track discrepancies through to resolution.
- Make testing repeatable: Changes to DAX rules, relationships, mapping tables, roles or permissions trigger the relevant regression tests.
Business approval remains with the data owners. A technically successful test confirms that an agreed rule works, not that the rule itself is appropriate for the business.
Secure your access rules before the next release
Start with the most critical user combinations and the data they must never access. From Bielefeld and Hamburg, Ailio helps you align your model, permissions and test evidence. Discuss your requirements with our Power BI consulting team.
