Implementing security in semantic models
1. Implementing security in semantic models
Not every viewer of a shared semantic model should see the same data. In this lesson, you'll control what each viewer can see.2. Choose rows or objects to protect
Semantic models support two kinds of security. Row-level security, or RLS, filters records while leaving the model structure available. For example, a North region manager sees only rows where Region equals North. Object-level security, or OLS, hides an entire table or column. For example, OLS can hide a Margin column from external partners. You apply both through roles. A role holds RLS filters, OLS restrictions, or both, and every viewer assigned to it receives those rules.3. Choose static or dynamic RLS
Static RLS applies the same filter to everyone in a role. For example, a NorthSales role filters Sales to Region equals North, so every member sees only North rows. A different region needs another role. Dynamic RLS uses one role that returns different rows per viewer. Each sales manager sees only the region assigned to the account they sign in with. A UserRegion mapping table could link user Aisha to North and user Mateo to South. The rule uses USERPRINCIPALNAME to identify the viewer and LOOKUPVALUE to find their region in UserRegion, keeping only those rows. Adding a viewer then means adding a mapping row, not a new role.4. OLS removes sensitive objects
Suppose external partners are allowed to analyze products, quantities, and revenue, but Margin is sensitive. An ExternalPartner role can hide Margin, so reports viewed through that role cannot query or discover it. Use OLS when the object itself is restricted, not just some of its records. Setting a column's Is hidden property only removes it from the field list; it doesn't stop queries.5. Managing roles
RLS roles are managed via the Manage roles option on the semantic model ribbon. You can select a table and define its rule visually or with DAX. OLS rules are added to roles in TMDL view or with external tools such as Tabular Editor. In this course, you'll be able to create the role and enter the expression, but won't be able to save it. Outside the course, saving requires a workspace on a supported Fabric capacity.6. Validating the viewer experience
Defining a role only creates the rule; it affects no one until you assign viewers to it. Testing then confirms what those viewers actually see. After saving, open the semantic model's Security page to assign viewers. There, open the role's More options menu and select Test as role. A connected report opens through that role. Roles only restrict Viewers; workspace Admins, Members, and Contributors can edit the model, so the rules don't apply to them.7. Source data needs protection too
Model rules apply only when data is accessed through the model. Users who can query the underlying warehouse or lakehouse directly can bypass them, so source permissions must control that direct access.8. Model security is one of the access layers
RLS and OLS control which rows and objects viewers get back when they query the model, such as through a report. Workspace and item permissions govern who can open, edit, or manage Fabric content. OneLake and source permissions govern underlying data access, including Direct Lake paths. Test as role validates the model filter, not workspace or source access. Validate each layer separately.9. Let's practice!
Now let's put model security into practice!Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.