{"componentChunkName":"component---src-templates-blog-post-js","path":"/blog/power-bi-object-level-security-ols-tabelas-colunas/","result":{"data":{"markdownRemark":{"frontmatter":{"title":"Power BI: object-level security (OLS) para esconder tabelas e colunas","description":"Diferente do RLS, que filtra linhas, o OLS esconde tabelas e colunas inteiras por role no Power BI. Veja como configurar via Tabular Editor e os cuidados em modelos corporativos.","date":"29 de novembro de 2026","thumbnail":null},"html":"<p>Quando o assunto é segurança em modelos semânticos do Power BI, quase todo mundo pensa em <strong>Row-Level Security (RLS)</strong> — filtrar as linhas que cada usuário enxerga. Mas há um cenário que o RLS simplesmente não resolve: esconder a <em>existência</em> de uma tabela ou coluna inteira para determinados perfis. É aí que entra o <strong>Object-Level Security (OLS)</strong>, um recurso muito menos conhecido e que resolve um problema real de confidencialidade em modelos corporativos compartilhados.</p>\n<p><strong>A diferença conceitual entre RLS e OLS</strong></p>\n<p>RLS atua no nível da linha: o usuário vê a tabela, vê as colunas, mas só enxerga o subconjunto de registros autorizado por uma expressão DAX de filtro. A estrutura do modelo continua visível para todos. OLS atua no nível do metadado: para a role sem permissão, a tabela ou a coluna deixa de existir — não aparece no painel de campos, não pode ser referenciada em uma query, e qualquer visual que dependa dela quebra com um erro genérico. Não é um filtro de dados, é uma remoção de superfície.</p>\n<p>O caso de uso clássico é uma tabela de <code>Salario</code> ou <code>Remuneracao</code> dentro de um modelo de RH compartilhado com a empresa inteira. Com RLS você conseguiria filtrar quais funcionários aparecem, mas a coluna de salário continuaria visível na estrutura. Com OLS, para a role <code>Geral</code>, a coluna <code>Salario</code> simplesmente não existe; só a role <code>RH</code> a enxerga.</p>\n<p><strong>Como se configura: Tabular Editor, não o Desktop</strong></p>\n<p>Este é o primeiro ponto prático importante: o Power BI Desktop <strong>não tem interface nativa</strong> para OLS. Você configura via External Tool, tipicamente o <strong>Tabular Editor</strong>, editando a propriedade de metadata object permission de cada tabela/coluna por role.</p>\n<p>O fluxo é:</p>\n<ol>\n<li>Criar as roles no Desktop (em <em>Manage roles</em>), com ou sem filtro RLS.</li>\n<li>Abrir o modelo no Tabular Editor via External Tools.</li>\n<li>Para cada role, selecionar a tabela ou coluna e definir a <code>MetadataPermission</code> como <code>None</code> (esconde) ou <code>Read</code> (padrão, mostra).</li>\n<li>Salvar de volta ao modelo (ou publicar via XMLA write em capacidade Premium/PPU/Fabric).</li>\n</ol>\n<p>Uma role com OLS em uma coluna ainda pode ter RLS em outra tabela — os dois mecanismos coexistem e são complementares, não excludentes.</p>\n<p><strong>A armadilha dos visuais e medidas que quebram</strong></p>\n<p>O maior risco de OLS em produção é que ele não degrada graciosamente. Se um visual referencia uma coluna escondida para a role do usuário, o visual inteiro retorna um erro, não um valor em branco. Isso significa que <strong>um único relatório não serve para todos os perfis</strong> se ele contém visuais sobre objetos restritos.</p>\n<p>Os pontos de atenção que mais causam incidente:</p>\n<ul>\n<li><strong>Medidas que dependem de coluna escondida.</strong> Se uma medida faz <code>SUM(Folha[Salario])</code> e a role não enxerga <code>Salario</code>, a medida quebra para aquela role — mesmo que a coluna em si não esteja no visual. A dependência é transitiva.</li>\n<li><strong>Colunas usadas em relacionamento.</strong> Esconder uma coluna que participa de um relacionamento pode invalidar o relacionamento para a role, afetando filtros em cadeia.</li>\n<li><strong>Q&#x26;A e export.</strong> O recurso de perguntas em linguagem natural e as exportações respeitam OLS, o que é bom para segurança, mas pode gerar resultados inconsistentes entre perfis.</li>\n<li><strong>Combinação com RLS.</strong> Uma role pode ter RLS <em>e</em> OLS; teste a interação, porque um filtro RLS sobre uma tabela parcialmente escondida tem comportamento que precisa ser validado em cada role.</li>\n</ul>\n<p><strong>OLS vs. dividir em modelos separados</strong></p>\n<p>Antes de aplicar OLS em um modelo grande, vale o roteiro de decisão:</p>\n<ul>\n<li>Se o conjunto de objetos sensíveis é pequeno e o público geral e o restrito compartilham a maior parte das análises, <strong>OLS é a escolha certa</strong> — evita duplicar o modelo.</li>\n<li>Se os relatórios são estruturalmente diferentes entre os perfis (o público restrito tem páginas inteiras que o geral nunca veria), pode ser mais limpo manter <strong>relatórios separados sobre o mesmo dataset</strong> com RLS/OLS, em vez de um único relatório cheio de visuais condicionais.</li>\n<li>Se há muitas combinações de confidencialidade e a matriz de permissões fica complexa, considere <strong>dividir em modelos semânticos distintos</strong> — a governança de um modelo com dezenas de regras de OLS entrelaçadas com RLS vira um pesadelo de manutenção.</li>\n</ul>\n<p><strong>Governança e versionamento</strong></p>\n<p>Como OLS vive no metadado do modelo, trate-o como código: versione as definições de role (idealmente via formato TMDL/PBIP no Git) e valide as permissões no pipeline com o Best Practice Analyzer do Tabular Editor. Documente para cada role quais objetos estão com <code>MetadataPermission = None</code> — porque, ao contrário de um filtro RLS visível no Desktop, uma coluna escondida é literalmente invisível para quem não sabe que ela existe, e isso vale também para o próprio time de BI que herda o modelo depois.</p>\n<p>Segurança em camadas no Power BI raramente é só RLS. Em modelos corporativos com dados de RH, financeiro ou jurídico convivendo com análises de uso geral, combinar RLS (linha), OLS (tabela/coluna) e column-level security na origem no Dataverse é o que separa um modelo auditável de um vazamento esperando acontecer. Se sua empresa opera modelos semânticos compartilhados em escala e precisa estruturar essa governança de ponta a ponta, a Dynamic Soluções pode ajudar a desenhar a arquitetura de segurança e o ALM que a sustenta.</p>\n<p>When the topic is security in Power BI semantic models, almost everyone thinks of <strong>Row-Level Security (RLS)</strong> — filtering the rows each user can see. But there is a scenario RLS simply cannot solve: hiding the <em>existence</em> of an entire table or column from certain profiles. That is where <strong>Object-Level Security (OLS)</strong> comes in — a far less known feature that solves a real confidentiality problem in shared corporate models.</p>\n<p><strong>The conceptual difference between RLS and OLS</strong></p>\n<p>RLS works at the row level: the user sees the table, sees the columns, but only sees the subset of records allowed by a DAX filter expression. The model structure stays visible to everyone. OLS works at the metadata level: for a role without permission, the table or column ceases to exist — it does not appear in the fields pane, cannot be referenced in a query, and any visual that depends on it breaks with a generic error. It is not a data filter, it is a removal of surface.</p>\n<p>The classic use case is a <code>Salary</code> or <code>Compensation</code> table inside an HR model shared with the whole company. With RLS you could filter which employees appear, but the salary column would still be visible in the structure. With OLS, for the <code>General</code> role, the <code>Salary</code> column simply does not exist; only the <code>HR</code> role sees it.</p>\n<p><strong>How to configure it: Tabular Editor, not Desktop</strong></p>\n<p>This is the first important practical point: Power BI Desktop has <strong>no native interface</strong> for OLS. You configure it through an External Tool, typically <strong>Tabular Editor</strong>, editing the metadata object permission of each table/column per role.</p>\n<p>The flow is:</p>\n<ol>\n<li>Create the roles in Desktop (under <em>Manage roles</em>), with or without an RLS filter.</li>\n<li>Open the model in Tabular Editor via External Tools.</li>\n<li>For each role, select the table or column and set <code>MetadataPermission</code> to <code>None</code> (hides) or <code>Read</code> (default, shows).</li>\n<li>Save back to the model (or publish via XMLA write in Premium/PPU/Fabric capacity).</li>\n</ol>\n<p>A role with OLS on a column can still have RLS on another table — the two mechanisms coexist and are complementary, not mutually exclusive.</p>\n<p><strong>The trap of broken visuals and measures</strong></p>\n<p>The biggest OLS risk in production is that it does not degrade gracefully. If a visual references a column hidden from the user's role, the entire visual returns an error, not a blank value. This means <strong>a single report does not serve every profile</strong> if it contains visuals over restricted objects.</p>\n<p>The pain points that most often cause incidents:</p>\n<ul>\n<li><strong>Measures that depend on a hidden column.</strong> If a measure does <code>SUM(Payroll[Salary])</code> and the role cannot see <code>Salary</code>, the measure breaks for that role — even if the column itself is not in the visual. The dependency is transitive.</li>\n<li><strong>Columns used in a relationship.</strong> Hiding a column that participates in a relationship can invalidate the relationship for the role, affecting chained filters.</li>\n<li><strong>Q&#x26;A and export.</strong> Natural language Q&#x26;A and exports honor OLS, which is good for security but can produce inconsistent results across profiles.</li>\n<li><strong>Combination with RLS.</strong> A role can have RLS <em>and</em> OLS; test the interaction, because an RLS filter over a partially hidden table has behavior that must be validated per role.</li>\n</ul>\n<p><strong>OLS vs. splitting into separate models</strong></p>\n<p>Before applying OLS to a large model, run the decision checklist:</p>\n<ul>\n<li>If the set of sensitive objects is small and the general and restricted audiences share most analyses, <strong>OLS is the right choice</strong> — it avoids duplicating the model.</li>\n<li>If the reports are structurally different across profiles (the restricted audience has entire pages the general one would never see), it may be cleaner to keep <strong>separate reports over the same dataset</strong> with RLS/OLS, instead of one report full of conditional visuals.</li>\n<li>If there are many confidentiality combinations and the permission matrix gets complex, consider <strong>splitting into distinct semantic models</strong> — governing one model with dozens of OLS rules intertwined with RLS becomes a maintenance nightmare.</li>\n</ul>\n<p><strong>Governance and versioning</strong></p>\n<p>Since OLS lives in the model metadata, treat it as code: version the role definitions (ideally via TMDL/PBIP format in Git) and validate permissions in the pipeline with Tabular Editor's Best Practice Analyzer. Document, per role, which objects have <code>MetadataPermission = None</code> — because, unlike an RLS filter visible in Desktop, a hidden column is literally invisible to whoever does not know it exists, and that applies to the BI team that inherits the model later too.</p>\n<p>Layered security in Power BI is rarely just RLS. In corporate models where HR, finance or legal data live alongside general-purpose analytics, combining RLS (row), OLS (table/column) and column-level security at the source in Dataverse is what separates an auditable model from a leak waiting to happen. If your company runs shared semantic models at scale and needs to structure this governance end to end, Dynamic Soluções can help design the security architecture and the ALM that sustains it.</p>"}},"pageContext":{"slug":"/blog/power-bi-object-level-security-ols-tabelas-colunas/","previousPost":null,"nextPost":{"frontmatter":{"title":"Dataverse: business process flows e stages em processos longos"},"fields":{"slug":"/blog/dataverse-business-process-flows-stages-processos-longos/"}}}},"staticQueryHashes":["2269431855"]}