Context Lab

BI RLS on Databricks: OAuth vs service principal

Guide · UC / governance wedge · Education only · Not a compliance guarantee

Unity Catalog row-level security applies as whoever Databricks thinks is querying — not whoever clicked the BI chart. OAuth / user-to-machine (U2M) can carry each analyst. A shared PAT, service principal, or machine-to-machine (M2M) connection collapses everyone into one identity. Fabric table mirrors / shortcuts add a third trap: UC filters and masks do not automatically follow Fabric end users.

Pick the identity model first, then pick ABAC / row filter / dynamic view with the UC RLS method picker.

Why RLS Breaks

Unity Catalog row filters follow the Databricks identity on the query—not who clicked the BI chart. Shared connections collapse everyone into one principal.

OAuth Per-User Path

OAuth / U2M carries each analyst into Databricks. UC grants, row filters, and ABAC evaluate as that person—true per-user RLS.

Service Principal Path

A shared PAT, service principal, or M2M bot still filters—but as the bot. Do not call that per-analyst RLS.

Compare Identity Models

U2M keeps personal scope; M2M shares one. Fabric mirrors add another trap: UC masks do not auto-follow Fabric end users.

When to Pick Which

Need country or region RLS into the lakehouse? Prefer OAuth per user. Batch or shared pipelines can use an SP—label the scope honestly, then pick the UC method.

    Topic summary · original diagrams · no autoplay

    Three paths: OAuth per-user, shared PAT or SP, Fabric mirror needs separate policy
    Identity decides: Ada (OAuth) vs shared bot vs Fabric re-policy (original)

    Decision tree

    1. Does BI authenticate each person into Databricks?
      • Yes (OAuth / U2M) → UC grants, row filters, ABAC, and views evaluate as that user. Prefer this when you need true per-person country/region RLS into the lakehouse.
      • No (PAT / service principal / M2M) → One shared scope. Filters still run, but as the SP. Everyone with that connection sees the SP’s rows (or nothing). Do not call this “per-analyst RLS.”
    2. Is data copied into Fabric / OneLake (mirror or shortcut)?
      • Yes → UC row filters / column masks on Databricks do not apply as the Fabric user. Re-apply policy in OneLake / Power BI, or keep DirectQuery → Databricks SQL so UC still evaluates.
      • No → Stay on live query to Databricks; identity (step 1) dominates.
    3. Then choose the UC method (many tables → ABAC; one simple table → row filter; join mapping → dynamic view). See the picker examples.

    Fiction: Ada (HK) vs Ben (SG)

    Retail lakehouse table sales.orders with country = HK / SG. Ada should see only HK; Ben only SG. Platform already has a UC row filter (or ABAC tag) keyed on country.

    Names and tools are educational. Wire real SSO and grants from your IdP + UC docs.

    What this page does not do

    Sources (first-hand)

    Open UC RLS method picker Governance guides