Created
February 15, 2024 03:25
-
-
Save hfleitas/26b64e2a244c548bb8e846c7e2a6f15c to your computer and use it in GitHub Desktop.
RLS.kql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ingestionLogs | |
| where Timestamp between (datetime(2014-03-08T00:00:00) .. datetime(2014-03-08T10:00:00)) | |
| summarize count() by Level | |
| render piechart | |
//my RLS query | |
let IsManager = false; //let IsManager=current_principal_is_member_of("[email protected]"); | |
let OnlyErrors = ingestionLogs | where Level == "Error" and not(IsManager); | |
let allData = ingestionLogs | where IsManager; | |
union OnlyErrors,allData | |
//create RLS function using my query | |
.create-or-alter function RLSFunction() { | |
let IsManager = false; | |
let OnlyErrors = ingestionLogs | where Level == "Error" and not(IsManager); | |
let allData = ingestionLogs | where IsManager; | |
union OnlyErrors,allData | |
} | |
//enable it | |
.alter table ingestionLogs policy row_level_security disable 'RLSFunction()' | |
//test | |
ingestionLogs | |
| where Timestamp between (datetime(2014-03-08T00:00:00) .. datetime(2014-03-08T10:00:00)) | |
| summarize count() by Level | |
| render piechart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment