2025-08-06
Implement Power BI Row-Level Security in Microsoft Fabric

Don’t just lock data—design a security system that adapts as your org changes.
What you’ll learn
-
Why RLS is a system (roles + relationships + DAX + identities), not a one-time setup
-
Static vs dynamic RLS—and when each is the right tool
-
Safe DAX patterns for user-aware filters (and the traps to avoid)
-
Mapping users and groups without creating shadow access
-
Why RLS can change after publish (Desktop vs Fabric identity differences)
-
How to test, audit, and govern RLS at scale
Core concepts (the mental model)
-
Model-first security: Relationships and filter directions determine how RLS propagates.
-
Role design: Fewer, purpose-built roles beat sprawling, overlapping ones.
-
Dynamic context: Security must respond to who is viewing and what they’re related to.
-
Cloud reality: Identity resolution and tenant settings in Fabric can change behavior.
Designing filters that hold up (DAX patterns)
Static RLS (simple, fixed audiences)
-
Example (on DimRegion):
DimRegion[Region] = "US"
Dynamic RLS via bridge table (recommended)
-
Tables:
Users (UPN, UserKey),UserRegion (UserKey, RegionKey),DimRegion (RegionKey, Region) -
Role filter on
Users:Users[UPN] = USERPRINCIPALNAME() -
Optionally restrict
DimRegionusing a relationship fromUsers → UserRegion → DimRegion.
Avoid
-
Calculated-column–based security (evaluated at refresh, not per user)
-
USERNAME()in Fabric (useUSERPRINCIPALNAME(); test email formats) -
Hardcoding emails/domains in filters
Helpful dynamic patterns
-
Multi-tenant: map
TenantIdfromUsersto fact/dimension tables -
Hierarchies: store manager-subordinate links, materialize an access table, filter by all descendants for the viewer
Role & relationship design
-
Use single-direction filters where possible; avoid ambiguous many-to-many paths.
-
Create security dimensions (e.g., User→Access tables) rather than embedding logic in facts.
-
Prefer few reusable roles (e.g., Employee, Manager, Admin) + dynamic filters, over dozens of static roles.
Assignments without surprises (users & groups)
-
Map roles to Azure AD groups, not individuals (scales better).
-
Guard against stale membership: set quarterly access reviews with group owners.
-
Watch for overlap: users in multiple groups can unintentionally widen access—document intended precedence.
-
For external users, validate B2B guest scenarios and domain matching in your
Userstable.
Desktop vs Fabric: what changes after publish
-
Identity:
USERPRINCIPALNAME()returns email in Fabric; Desktop previews can differ. -
Ownership: dataset owner and refresh credentials can alter what’s visible.
-
Tenant & workspace settings (e.g., external sharing, discovery) can affect RLS outcomes.
-
Group sync latency: changes in Azure AD may lag—plan for it.
Testing that actually catches leaks
-
In Desktop: use “View as” for quick checks (sanity, not sign-off).
-
In Fabric:
-
Test with real groups and real users in a non-prod workspace.
-
Validate each role on core report pages and sensitive visuals.
-
Script spot checks: export small result sets for known users (via XMLA/Automation).
-
-
Drift detection: schedule a job to compare
Users/groups vs HR/identity data and flag mismatches.
Governance & operations
-
Catalog: Document roles, their DAX filters, tables affected, and intended audiences.
-
Change control: PRs for model changes; require RLS test evidence before merge.
-
Data contracts: Define which dimensions/facts must participate in RLS and how.
-
Audits: Quarterly group membership recertification; semiannual RLS penetration tests in Fabric.
-
Monitoring: Track high-risk reports, owner changes, and role edits; alert on anomalies.
Common failure patterns (and fixes)
-
Works in Desktop, leaks in Fabric → Using
USERNAME()/ mismatched identity format-
Fix: Standardize on
USERPRINCIPALNAME()and alignUsers[UPN].
-
-
User sees too much → Many-to-many path bypassing security
-
Fix: Introduce a security dimension and tighten relationships/bi-directional filters.
-
-
Former team access persists → Stale AAD group memberships
-
Fix: Automate recertification and removal; log exceptions.
-
-
Calculated column used for identity → No per-user effect
-
Fix: Move logic to role filter DAX over model tables, not calculated columns.
-
Quick-start checklist (this week)
-
Add a
Userstable keyed byUSERPRINCIPALNAME(); relate to access tables. -
Convert hardcoded filters to dynamic, table-driven filters where appropriate.
-
Replace any
USERNAME()logic withUSERPRINCIPALNAME()and retest in Fabric. -
Map roles to AAD groups; schedule an access review with group owners.
-
Publish to a test workspace; validate with real users; fix identity/relationship gaps.
-
Document roles, DAX, and tables; add to your model README.
Suggested SEO assets
-
URL slug: power-bi-row-level-security-architecture
-
Meta title: Power BI Row-Level Security: Architecture, DAX Patterns, and Cloud-Ready Governance
-
Meta description: Go beyond the RLS checkbox. Learn dynamic DAX patterns, role design, Azure AD mapping, and Fabric-specific testing to keep sensitive data truly secure.
-
Keywords: Power BI, Row-Level Security, RLS, USERPRINCIPALNAME, Azure AD groups, Fabric, dynamic RLS, data governance
FAQ
What is the difference between static and dynamic RLS?
Static RLS hard-codes a filter, such as Region equals US, for a fixed audience. Dynamic RLS uses the viewer's identity, typically USERPRINCIPALNAME() against a user table, so one role serves many users.
What is a safe DAX pattern for dynamic row-level security?
Use a Users table filtered by Users[UPN] = USERPRINCIPALNAME(), linked through a UserRegion bridge to DimRegion. This keeps the mapping in data, not in hardcoded emails or domains.
Why can RLS behave differently after publishing to Fabric?
Identity resolution and tenant settings differ between Power BI Desktop and Fabric. A filter that worked locally may behave differently in the cloud, so testing with real identities after publishing is essential.
Which RLS practices should you avoid?
Avoid calculated-column security, because it evaluates at refresh and not per user, avoid USERNAME() in Fabric, and avoid hardcoding emails or domains. Sprawling overlapping roles also make auditing difficult.
How do you govern RLS at scale?
Map users and groups through Azure AD groups without creating shadow access, test and audit roles regularly, and follow a governance checklist as the organization changes. Security must adapt, not stay one-time.
Apple Podcasts · Spotify · YouTube
Host: Mirko Peters
Related articles
Articles on the topics of this episode:
- Why Your Power BI RLS Works in Desktop But Leaks in Fabric
- Best Copilot Prompts for PowerPoint Creation
- Power Query in Excel: Import, Clean, Merge and Refresh Data
- Protecting Sensitive Information: Why Your Organization Needs Row-Level Security
- Stop Hard-Coding: How to Use Parameters in Power BI Dataflows
- Supercharge Your BI Workflow: Why You Should Adopt the .pbip Format
- Mastering Power Query: Transforming Flat Data into a Star Schema
- Top 5 Pitfalls When Connecting Power BI to SharePoint Folders