OneLake security: define row and column rules once

OneLake security puts table, row and column rules on the data in a lakehouse, and Spark, the SQL analytics endpoint, Direct Lake on OneLake models, Eventhouse and graph enforce them. Who the rules apply to, the RLS syntax, a worked example whose totals add up per engine, the two settings engines need, and the limits (no dynamic RLS, one role for RLS plus CLS).

Short answer: OneLake security lets a workspace Admin or Member define roles on a lakehouse (or another data item) that grant tables or folders, filter rows with a SQL WHERE rule, and hide columns. Every Fabric engine that reads the data applies those rules: Spark notebooks, the lakehouse, the SQL analytics endpoint (in user's identity mode), Direct Lake on OneLake semantic models, Eventhouse and graph, all generally available. The rules restrict Viewers and people with Read on the item; workspace Admins, Members and Contributors always see everything.

Before this, the same "Austria sees only Austria" rule lived in four places: a SQL security policy on the endpoint, a DAX role in the semantic model, a filter in a notebook, and a KQL function in the eventhouse. Four copies meant four chances to get it wrong, and a quiet leak the day one of them was forgotten. OneLake security moves the rule to the data, so every engine reads the same one.

Where does each kind of permission sit?

  1. Data plane: OneLake security rolestables, folders, rows and columns; who sees which data
  2. Item permissionsRead, ReadData, ReadAll, Write on one item, given by sharing
  3. Control plane: workspace rolesAdmin, Member, Contributor, Viewer; who can manage and create
Two planes of permission in OneLake

Workspace roles decide what people can do. OneLake security decides what data Viewers and item readers see. Because roles only grant, they cannot take data away from someone a workspace role already lets in: Admins, Members and Contributors read all data in the workspace.

What does a role contain?

Four parts: permission (Read or ReadWrite), type (only Grant roles exist), data (tables, folders or schemas, with row and column rules) and members (Microsoft Entra users, groups or service identities). Every lakehouse also has a DefaultReader role that gives anyone with ReadAll access to all data; remove people from it, or narrow it, before the narrower roles mean anything.

A row rule is a SQL SELECT with a WHERE clause:

SELECT * FROM dbo.sales WHERE Region IN ('Austria', 'Germany')

Rules allow =, <>, >, >=, <, <=, IN, NOT, AND, OR, IS NULL and IS BLANK, up to 1,000 characters. String comparisons ignore case. Include the schema when the lakehouse uses schemas; a wrong table name shows no rows at all.

Do the numbers add up in every engine?

A sales table, and a role DACH sales with the rule above, the Margin column removed, and the Viewer group as members:

OrderIdRegionAmountMarginDACH sales sees
1Austria1,200300yes
2Germany2,500600yes
3France1,800450no
4Austria900200yes
5Italy1,100250no
6Germany1,600400yes
Total6 rows9,1002,2004 rows, 6,200
dbo.sales, and what the DACH sales role sees

The sums: all rows 1,200 + 2,500 + 1,800 + 900 + 1,100 + 1,600 = 9,100; the role's rows 1,200 + 2,500 + 900 + 1,600 = 6,200. Every engine should return 6,200 to a member of the role. A workspace Contributor in the same group still sees 9,100, because the workspace role already grants everything.

The engines differ on one thing, a SELECT * that touches the hidden column:

EngineRowsMargin column
Spark notebook4left out, the query succeeds
SQL analytics endpoint (user's identity mode)error: the query is blocked
Direct Lake on OneLake semantic modelerror when Margin is used
Eventhouse, graph, lakehouse4filtered by the same rules
The same query, SELECT * FROM dbo.sales, by engine

So reports must not use Margin for this audience, and SQL users should list their columns.

What does each engine need?

  • SQL analytics endpoint: switch it to user's identity access mode; otherwise it uses its own SQL permissions.
  • Semantic models: must use Direct Lake on OneLake to read secured tables.
  • Shortcuts: the rules of the lakehouse where the data is stored apply. The tenant setting Users can access data stored in OneLake with apps external to Fabric must be on to use shortcuts with OneLake security.
  • Other engines: engines outside Fabric that are not registered as authorized engines are treated as user access, so a user with partial access is blocked from the whole table rather than filtered.

What goes wrong?

  • Expecting rules to apply to Contributors. They never do. Readers of protected data should be Viewers or have item Read only.
  • The DefaultReader role. Left as it is, it gives ReadAll holders everything and makes your narrow roles pointless.
  • RLS and CLS in two roles. A user in one role with a row rule and another with a column rule gets query errors. Put both rules on one role.
  • Dynamic rules. RLS roles do not support dynamic or multi-table rules (no "the user's own region" lookup). Make one role per region, or keep dynamic RLS in the semantic model.
  • Rules on other table types. Row and column rules work on Delta Parquet and virtualised Iceberg tables; on others they block the whole table for members.
  • A rule that names a missing column. The query fails and returns nothing; recheck rules after schema changes.

Where can you check this?

Where do you start?

Pick one table that has the same filter copied into several places. Create one role with that rule in the lakehouse, add a test Viewer, and compare the total in a notebook, the SQL endpoint and a Direct Lake report. When all three match, delete the old copies. OneLake shortcuts explains how the rules travel with shared data, and Direct Lake in Power BI the model mode that passes them through.

Keep reading

More from the blog.

Every post

Next

Building this? Say hello.

A question about this post, a pattern you would build differently, or the next thing you want written out: Behnia reads every message.