我正在尝试在 Azure Kusto 集群表中实现行级安全性,但我看到的所有示例都仅适用于单个表数据。在我的例子中,要应用过滤器,我需要连接两个表。例如我有表 X 和 Y,我需要在表 X 上应用行级安全性,但表 X 中没有可以帮助我应用过滤器的列,该列/数据位于表 Y 中。 那么,这种情况在 ADX 中可能吗?
最佳答案
是的,支持。
这是一个快速演示
.set-or-replace MyEventsTable <|
range EventID from 1 to 10 step 1
| extend EventTimestamp = ago(365d*rand())
| extend UserID = tolong(rand(3))
<小时/>
MyEventsTable
.set-or-replace MyUsersTable <|
print UserEmail = pack_array("<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="75011c1635181c16071a061a13015b161a18" rel="noreferrer noopener nofollow">[email protected]</a>", "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7501141635181c16071a061a13015b161a18" rel="noreferrer noopener nofollow">[email protected]</a>", current_principal_details().UserPrincipalName)
| mv-expand with_itemindex=UserID UserEmail to typeof(string)
| project-reorder UserID
<小时/>
MyUsersTable
.create-or-alter function MyEventsTable_RLS(){
MyEventsTable
| where UserID == toscalar(MyUsersTable | where UserEmail == current_principal_details().UserPrincipalName | project UserID)
}
<小时/>
.alter table MyEventsTable policy row_level_security enable "MyEventsTable_RLS"
<小时/>
MyEventsTable
关于Azure kusto集群表通过数据列实现行级安全性,基于哪些数据列可以跨多个表进行过滤?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72309127/