In Azure Data Explorer how do I parametrize metadata to be used in Row Level Security function in a query optimized way

My timeseries table T has the columns: location, sensor_id, timestamp and value. The table has thousands of sensor_id, billions of values per year and about 100 locations. The 100 locations are in 6 countries.

For table T there exist about 10 user groups and each user group are only allowed to see locations from particular countries. For example:

  • user group 1 can only see locations in Spain and France
  • user group 2 can only see locations in Spain and Germany

To ensure that we are data compliant we want to use row level security. One approach is to hard code the locations in for each user group:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>.create-or-alter function My_RLS_function(TableName:string) {
table(TableName)
| where (current_principal_is_member_of('aadgroup=user_group_1') and location in ('Location1, Location3, ..., location 50')
or ...
or ...
}
</code>
<code>.create-or-alter function My_RLS_function(TableName:string) { table(TableName) | where (current_principal_is_member_of('aadgroup=user_group_1') and location in ('Location1, Location3, ..., location 50') or ... or ... } </code>
.create-or-alter function  My_RLS_function(TableName:string) {
    table(TableName)
    | where (current_principal_is_member_of('aadgroup=user_group_1') and location in ('Location1, Location3, ..., location 50')
      or ...
      or ...
}

We think that this is the most query optimized way, however typing in each location would be messy and error prone. It would also be cumbersome to add or remove a location.

Therefore, our approach is to create a new table called location_and_countries. This is a table of
100 rows where the first column is country, and the second column is location. Assuming user group 1 can see locations in Spain and France the RLS becomes:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>.create-or-alter function My_RLS_function(TableName:string) {
table(TableName)
| where (current_principal_is_member_of('aadgroup=user_group_1') and toscalar(location_and_countries| where countries in ('Spain', 'France') | summarize make_list(location))
or ...
or ...
}
</code>
<code>.create-or-alter function My_RLS_function(TableName:string) { table(TableName) | where (current_principal_is_member_of('aadgroup=user_group_1') and toscalar(location_and_countries| where countries in ('Spain', 'France') | summarize make_list(location)) or ... or ... } </code>
.create-or-alter function  My_RLS_function(TableName:string) {
    table(TableName)
    | where (current_principal_is_member_of('aadgroup=user_group_1') and toscalar(location_and_countries| where countries in ('Spain', 'France') | summarize make_list(location))
      or ...
      or ...
}

What we are wondering about now is the following:

  1. Does anyone know a more query optimized way to store and retrieve metadata to be used in KQL queries?
  2. Is there a way we can hide the table location_and_countries so that the user cannot query it?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật