Insights / RLS in Power BI / Part 15
Part 15 of 20 · Build itRLS in Import, DirectQuery and Direct Lake
The problem. You switch a model from Import to DirectQuery, and the RLS role that worked yesterday stops working. Same role, same DAX, different storage mode.
| Import | DirectQuery | Direct Lake | |
|---|---|---|---|
| Where the role runs | On the imported data | Turned into SQL for every query | On Delta tables in OneLake |
| DAX in role rules | All DAX works | No PATH functions or CUSTOMDATA | No PATH calculated column (build it in the lakehouse) |
| Security table changes show | After refresh | Straight away | After the model picks up new data |
| Watch out | Refresh after access changes | Speed: tune the source | With SSO, users need data access and can query outside the model |
DirectQuery fixes: use a flat manager-employee table for hierarchies (Part 12). For embedded reports, pass the customer ID as the username, not CUSTOMDATA (Part 6).
Direct Lake: with SSO, users need read access to the data, so they can query it outside the model. Use a fixed identity with model RLS, or secure the data with OneLake security.
More setups to check:
- Composite models: a DirectQuery security table can be cached. Refresh after access changes.
- DirectQuery to another semantic model / live connection: the source model's RLS applies. Set and test roles in the source model, and give every sensitive table there a rule.
- Aggregations: RLS only on the detail table makes queries skip the aggregation. Filter a dimension related to both.
- Direct Lake with OneLake security: users see rows both layers allow. Avoid two-way filters.
A flat security table with a simple [Email] = USERPRINCIPALNAME() role works in all three modes.
Always test in the storage mode you'll publish.
Check before go-live
- Role rules only use DAX that your storage mode supports Desktop
- You know where security lives for Direct Lake: model, OneLake, or both Desktop
- Testing was done in the storage mode you publish
Want a second pair of eyes on your own model? The RLS review checks your roles, relationships and workspace access against this checklist, at a fixed price.