%3CLINGO-SUB%20id%3D%22lingo-sub-1393795%22%20slang%3D%22en-US%22%3EApproximate%2C%20partial%20and%20combined%20lookups%20in%20Azure%20Sentinel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1393795%22%20slang%3D%22en-US%22%3E%3CP%3EMany%20of%20you%20found%20Nir%20Gafni's%20%22%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-sentinel%2Fimplementing-lookups-in-azure-sentinel-part-1-reference-files%2Fba-p%2F1091306%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3EImplementing%20Lookups%20in%20Azure%20Sentinel%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3E%22%20article%20useful.%20A%20common%20question%20you%20made%20was%20how%20to%20lookup%20partial%20values.%20For%20example%2C%20does%20the%20account%20name%20matches%20a%20list%20of%20patterns%3F%20Or%20is%20an%20IP%20address%20in%20a%20list%20of%20subnets%3F%20Partial%20lookups%20are%20a%20significant%20challenge%20with%20lookups%20in%20other%20SIEM%20products%20and%20often%20require%20reverting%20to%20hard%20to%20maintain%20methods%20such%20as%20nested%20filters.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3EIn%20this%20blog%20post%2C%20I%20will%20show%20you%20how%20to%20implement%20partial%20lookups%20with%20Azure%20Sentinel.%20I%20will%20also%20venture%20into%20more%20advanced%20areas%20such%20as%20combined%20multi-condition%20lookups.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23FF00FF%22%3E%3CSTRONG%3E%3CEM%3EThis%20post%20of%20part%20of%20a%20series%20of%20blog%20posts%20on%20writing%20rules%20in%20Azure%20Sentinel%3A%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CFONT%20color%3D%22%23FF00FF%22%3E%3CSTRONG%3E%3CEM%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-sentinel%2Fazure-sentinel-correlation-rules-active-lists-out-make-list-in%2Fba-p%2F1029225%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EAzure%20Sentinel%20correlation%20rules%20using%20lists%3C%2FA%3E%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20color%3D%22%23FF00FF%22%3E%3CSTRONG%3E%3CEM%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-sentinel%2Fazure-sentinel-correlation-rules-the-join-kql-operator%2Fba-p%2F1041500%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EAzure%20Sentinel%20correlation%20rules%20using%20the%20join%20operator%3C%2FA%3E%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20color%3D%22%23FF00FF%22%3E%3CSTRONG%3E%3CEM%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-sentinel%2Fimplementing-lookups-in-azure-sentinel-part-1-reference-files%2Fba-p%2F1091306%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EImplementing%20Lookups%20in%20Azure%20Sentinel%3C%2FA%3E%26nbsp%3B%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20color%3D%22%23FF00FF%22%3E%3CSTRONG%3E%3CFONT%20color%3D%22%23000080%22%3E%3CEM%3E%5B%23%24dp23%5D%3CEM%3E%3CA%20id%3D%22link_7%22%20class%3D%22page-link%20lia-link-navigation%20lia-custom-event%22%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-sentinel%2Fapproximate-partial-and-combined-lookups-in-azure-sentinel%2Fba-p%2F1393795%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EApproximate%2C%20partial%20and%20combined%20lookups%3C%2FA%3E%3C%2FEM%3E%3C%2FEM%3E%3C%2FFONT%3E%3CFONT%20color%3D%22%23000080%22%3E%3CEM%3E%3CEM%3E%26nbsp%3B(this%20post)%3C%2FEM%3E%3C%2FEM%3E%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20color%3D%22%23FF00FF%22%3E%3CSTRONG%3E%3CEM%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-sentinel%2Fhandling-sliding-windows-in-azure-sentinel-rules%2Fba-p%2F1505394%22%20target%3D%22_self%22%3EHandling%20sliding%20windows%20in%20Azure%20Sentinel%20rules%3C%2FA%3E%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1350741601%22%20id%3D%22toc-hId--1350741601%22%20id%3D%22toc-hId--1350741601%22%20id%3D%22toc-hId--1350741601%22%20id%3D%22toc-hId--1350741601%22%20id%3D%22toc-hId--1350741601%22%3EPhrase%20lookup%3A%20the%20has_any%20operator%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3EThe%20simplest%20and%20most%20efficient%20way%20to%20do%20partial%20lookups%20in%20Azure%20Sentinel%20is%20to%20use%20the%20%22%3C%2FSPAN%3E-ERR%3AREF-NOT-FOUND-%3CSPAN%20data-preserver-spaces%3D%22true%22%3Ehas_any%3C%2FSPAN%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3E%22%20operator.%20While%20the%20examples%20in%26nbsp%3B%3C%2FSPAN%3E-ERR%3AREF-NOT-FOUND-%3CSPAN%20data-preserver-spaces%3D%22true%22%3EImplementing%20Lookups%20in%20Azure%20Sentinel%3C%2FSPAN%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3E%26nbsp%3Bused%20the%20%22in%22%20and%20%22!in%22%20operators%20which%20do%20an%20exact%20match%2C%20the%20%22has_any%22%20operator%20searches%20for%20any%20one%20of%20a%20list%20of%20lookup%20phrases%20in%20the%20target%20field.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3ELet's%20look%20into%20a%20user%20watchlist%20example%20in%20Linux%20Syslog%20messages.%20We%20want%20to%20alert%20only%20when%20specific%20users%2C%20stored%20in%20a%20list%2C%20fail%20to%20login%20with%20a%20wrong%20password.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3ELet's%20start%20with%20the%20lookup%20table%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Elet%20keywords_table%20%3D%20datatable%20(w%3A%20string)%20%5B'postgres'%2C'nagios'%2C'doker'%5D%3B%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20am%20using%20the%26nbsp%3B-ERR%3AREF-NOT-FOUND-%3CSPAN%20data-preserver-spaces%3D%22true%22%3Edatatable%3C%2FSPAN%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3E%26nbsp%3Boperator%20to%20create%20the%20table%20for%20convenience%20so%20that%20you%20can%20use%20the%20example.%20However%2C%20you%20can%20use%20any%20lookup%20table%20source%20as%20described%20in%26nbsp%3B%3C%2FSPAN%3E-ERR%3AREF-NOT-FOUND-%3CSPAN%20data-preserver-spaces%3D%22true%22%3Eimplementing%20Lookups%20in%20Azure%20Sentinel%2C%3C%2FSPAN%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3E%26nbsp%3Bsuch%20as%20using%20the%20%22externaldata%22%20data%20operator%2C%20custom%20tables%2C%20or%20storing%20the%20%22datatable%22%20operator%20in%20a%20function.%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3ENext%2C%20we%20need%20to%20convert%20the%20table%20to%20a%20list%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Elet%20lookup%20%3D%20toscalar(keywords_table%7C%20summarize%20l%3Dmake_list(w))%3B%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20command%20could%20be%20combined%20with%20the%20previous%20or%20the%20next%20and%20is%20separated%20here%20to%20make%20it%20more%20readable.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELastly%2C%20we%20use%20the%20has_any%20operator%20to%20look%20for%20only%20failed%20password%20events%20for%20the%20users%20in%20the%20lookup%20table%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3ESyslog%3CBR%20%2F%3E%7C%20where%20SyslogMessage%20startswith%20%22Failed%20password%22%3CBR%20%2F%3E%7C%20where%20SyslogMessage%20has_any%20(lookup)%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20%22has_any%22%20operator%20is%20handy%2C%20but%20is%20limited%20to%20a%20phrase%20delimited%20by%20word%20boundaries%20and%20would%20not%20match%20any%20substring.%20We%20need%20another%20solution%20for%20substring%20matching%20and%20other%20partial%20matching%20operators.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1136771232%22%20id%3D%22toc-hId-1136771232%22%20id%3D%22toc-hId-1136771232%22%20id%3D%22toc-hId-1136771232%22%20id%3D%22toc-hId-1136771232%22%20id%3D%22toc-hId-1136771232%22%3EWatch%20listing%20by%20IP%20ranges%3A%20the%20mv-apply%20operator%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EA%20widespread%20watch%20list%20scenario%20that%20requires%20partial%20lookups%20is%20selecting%20events%20based%20on%20IP%20ranges.%20IP%20ranges%20are%20usually%20represented%20in%20a%26nbsp%3B-ERR%3AREF-NOT-FOUND-%3CSPAN%20data-preserver-spaces%3D%22true%22%3ECIDR%20notation%3C%2FSPAN%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3E.%20For%20example%2C%20the%20internal%20IP%20address%20range%20192.168.x.x%20is%20represented%20by%20the%20CIDR%20notation%20192.168.0.0%2F16.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3EAs%20an%20example%2C%20let's%20implement%20an%20IP%20range%20watch%20list%20using%20Azure%20Sentinel%20that%20selects%20only%20events%20that%20originated%20in%20an%20internal%20network.%20The%20lookup%20table%20is%20the%20following%20table%2C%20which%20includes%26nbsp%3B%3C%2FSPAN%3E-ERR%3AREF-NOT-FOUND-%3CSPAN%20data-preserver-spaces%3D%22true%22%3Eprivate%20IP%20address%20ranges%3C%2FSPAN%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3E%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Elet%20private_ranges%20%3D%20datatable%20(ip_range%3A%20string)%20%5B'192.168.0.0%2F16'%2C%20'172.16.0.0%2F12'%2C%26nbsp%3B'10.0.0.0%2F8'%5D%3B%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20mentioned%2C%20the%20%E2%80%9Cdatatable%E2%80%9D%20operator%20can%20be%20%E2%80%9Cexternaldata%E2%80%9D%2C%20a%20custom%20table%2C%20or%20a%20function.%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHere%20again%2C%20we%20need%20to%20convert%20the%20table%20to%20a%20list%2C%20using%20the%20following%20command%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Elet%20lookup%20%3D%20toscalar(private_ranges%7C%20summarize%20l%3Dmake_list(ip_range))%3B%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%2C%20that%20we%20have%20the%20watch%20list%20ready%2C%20we%20can%20use%20it%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3ECommonSecurityLog%3CBR%20%2F%3E%7C%20where%20TimeGenerated%20%26gt%3B%20ago(5m)%3CBR%20%2F%3E%7C%20where%20%E2%80%A6%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3E%7C%20mv-apply%20l%3Dlookup%20to%20typeof(string)%20on%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3E(%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3E%26nbsp%3B%20where%20ipv4_is_match%20(SourceIP%2C%20l)%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3E)%3C%2FFONT%3E%3CBR%20%2F%3E%7C%20project-away%20l%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20important%20operator%20here%20is%20%22-ERR%3AREF-NOT-FOUND-%3CSPAN%20data-preserver-spaces%3D%22true%22%3Emv-apply%3C%2FSPAN%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3E%22%2C%20which%20applies%20the%20query%20(in%20red)%20to%20every%20value%20in%20the%20lookup%20list%20over%20every%20record.%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3ESince%20mv-apply%20applies%20every%20value%20in%20the%20lookup%20table%20to%20every%20record%2C%20it%20is%20performance%20and%20memory%20intensive.%20If%20not%20used%20carefully%2C%20your%20query%20may%20fail.%20Therefore%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3E%20Ensure%20that%20you%20use%20it%20at%20the%20end%20of%20your%20query%20after%20you%20filtered%20by%20other%20criteria%20that%20are%20less%20demanding.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3E%20Limit%20the%20timespan%20on%20which%20you%20perform%20the%20query%20as%20much%20as%20possible.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3E%20Use%20a%20reasonably%20sized%20lookup%20table.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3E%20Lastly%2C%20the%20slightly%20more%20complex%20method%20presented%20below%20for%20allow-listing%20can%20be%20used%20for%20watch%20lists%20as%20well%20and%20has%20better%20performance.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3EA%20corner%20case%20you%20may%20encounter%20is%20duplicate%20results.%20The%20result%20set%20includes%20a%20record%20for%20each%20match%2C%20so%20if%20an%20input%20record%20matches%20two%20elements%2C%20it%20appears%20twice%20in%20the%20result%20set.%20The%20duplication%20cannot%20happen%20in%20the%20example%20above%20as%20the%20lookup%20values%20are%20mutually%20exclusive.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20some%20cases%2C%20duplicate%20records%20are%20useful%2C%20as%20you%20would%20like%20to%20analyze%20each%20lookup%20value%20the%20record%20matched.%20If%20not%2C%20you%20might%20need%20to%20add%20something%20along%20the%20following%20lines.%20The%20query%20requires%20that%20a%20set%20of%20fields%20uniquely%20identify%20an%20event.%20For%20SecurityEvents%2C%20%22EventOriginId%22%20does%20the%20trick%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%7C%20summarize%20arg_max(TimeGenerated%2C%20*)%20by%20EventOriginId%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20solution%20presented%20for%20allow-lists%20below%20also%20overcomes%20this%20issue.%3C%2FP%3E%0A%3CP%3EThere%20are%20also%20a%20few%20subtleties%20when%20using%20mv-apply%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EYou%20need%20to%20explicitly%20say%20what%20the%20type%20of%20%22l%22%20is%20using%20the%20%22to%20typeof()%22%20phrase%20is.%3C%2FLI%3E%0A%3CLI%3E%22l%22%20is%20added%20to%20every%20record%20and%20has%20to%20be%20%22projected-away%22%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--670683231%22%20id%3D%22toc-hId--670683231%22%20id%3D%22toc-hId--670683231%22%20id%3D%22toc-hId--670683231%22%20id%3D%22toc-hId--670683231%22%20id%3D%22toc-hId--670683231%22%3EAllow-listing%20by%20username%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESince%20it%20returns%20a%20record%20for%20every%20match%2C%20the%20technique%20above%20cannot%20be%20used%20for%20allow-listing.%20For%20example%2C%20if%20you%20try%20to%20exclude%20private%20IP%20ranges%20by%20reversing%20the%20logic%20to%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Ewhere%20not(ipv4_is_match%20(SourceIP%2C%20l))%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20get%203%20repeats%20of%20every%20record%20that%20does%20not%20match%20the%20ranges%2C%20and%202%20repeats%20for%20each%20one%20that%20matches%20one%20of%20them.%20Certainly%20not%20the%20intended%20result.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESo%2C%20how%20can%20we%20allow-list%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20solution%20is%20to%20find%20using%20the%20technique%20presented%20for%20watchlists%20the%20list%20of%20matching%20values%20and%20apply%20it%20using%20a%20regular%2C%20exact%2C%20lookup.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESetting%20up%20the%20lookup%20table%20is%20similar%20to%20the%20examples%20above.%20In%20this%20case%2C%20I%20combined%20the%20table%20and%20list%20creation%20into%20one%20statement%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Elet%20lookup%3Dtoscalar(datatable(p%3Astring)%20%5B'user'%2C'admin'%5D%20%7C%20summarize%20l%3Dmake_list(p))%3B%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENext%2C%20we%20use%20the%20same%20mv-apply%20to%20check%20the%20Account%20names%20against%20the%20lookup%20list%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Elet%20matched_users%20%3D%20toscalar(%3CBR%20%2F%3ESecurityEvent%3CBR%20%2F%3E%7C%20where%20TimeGenerated%20%26gt%3B%20ago(5m)%3CBR%20%2F%3E%7C%20where%20%E2%80%A6%3CBR%20%2F%3E%3CFONT%20color%3D%22%23008000%22%3E%7C%20summarize%20by%20Account%3C%2FFONT%3E%3CBR%20%2F%3E%7C%20mv-apply%20l%3Dlookup%20to%20typeof(string)%20on%3CBR%20%2F%3E(%3CBR%20%2F%3E%26nbsp%3B%20where%20Account%20contains%20l%3CBR%20%2F%3E)%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF6600%22%3E%7C%20summarize%20make_list(Account))%3B%3C%2FFONT%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENotice%20that%20here%20we%20used%20the%20%E2%80%9Ccontains%E2%80%9D%20operator.%20Any%20operator%2C%20complex%20expressions%2C%20or%20even%20full%20queries%2C%20can%20be%20used%20in%20an%20%E2%80%9Cmv-apply%E2%80%9D%20sub-query.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESince%20we%20do%20not%20need%20the%20events%20but%20only%20user%20names%20to%20continue%20the%20analysis%2C%20we%20can%20summarize%20by%20account%20(in%20%3CFONT%20color%3D%22%23008000%22%3Egreen%3C%2FFONT%3E)%20to%20get%20a%20list%20of%20unique%20account%20names%2C%20making%20this%20version%20much%20more%20efficient.%20Lastly%2C%20we%20have%20created%20a%20list%20of%20the%20resulting%20values%20(%3CFONT%20color%3D%22%23FF6600%22%3Eorange%3C%2FFONT%3E)%2C%20which%20is%20a%20list%20of%20account%20names%20that%20contain%20any%20of%20the%20lookup%20values.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20use%20the%20list%20generated%20above%20as%20a%20allow%20list%20using%20the%20%22!in%22%20operator%20(%3CFONT%20color%3D%22%230000FF%22%3Eblue%3C%2FFONT%3E)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3ESecurityEvent%3CBR%20%2F%3E%7C%20where%20TimeGenerated%20%26gt%3B%20ago(5m)%3CBR%20%2F%3E%7C%20where%20%E2%80%A6%3CBR%20%2F%3E%7C%20where%20Account%20%3CFONT%20color%3D%22%230000FF%22%3E!in%3C%2FFONT%3E%20(matched_users)%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20used%20the%20same%20event%20filter%20when%20generating%20the%20exclusion%20list%20and%20when%20using%20it.%20While%20in%20a%20simple%20Azure%20Sentinel%20analytics%20rule%20which%20does%20not%20filter%20explicitly%20by%20the%20time%20this%20would%20work%2C%20it%20runs%20a%20risk%2C%20in%20some%20circumstance%2C%20that%20the%20two%20runs%20will%20not%20apply%20to%20the%20same%20event%20set.%20The%20following%20variant%20uses%20the%20%22materialize%22%20operator%20(%3CFONT%20color%3D%22%23FF00FF%22%3Emagenta%3C%2FFONT%3E)%20to%20resolve%20that%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Elet%20lookup%3Dtoscalar(datatable(p%3Astring)%20%5B'user'%2C'admin'%5D%20%7C%20summarize%20l%3Dmake_list(p))%3B%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF00FF%22%3Elet%20events%3Dmaterialize(SecurityEvent%20%7C%20where%20TimeGenerated%26nbsp%3B%20%26gt%3B%20ago(5m)%20%7C%20where%20%E2%80%A6)%3B%3C%2FFONT%3E%3CBR%20%2F%3Elet%20matched_users%20%3D%20toscalar(events%3CBR%20%2F%3E%7C%20summarize%20by%20Account%3CBR%20%2F%3E%7C%20mv-apply%20l%3Dlookup%20to%20typeof(string)%20on%3CBR%20%2F%3E(%3CBR%20%2F%3E%26nbsp%3B%20where%20Account%20contains%20l%3CBR%20%2F%3E)%3CBR%20%2F%3E%7C%20summarize%20make_list(Account))%3B%3CBR%20%2F%3Eevents%3CBR%20%2F%3E%7C%20where%20Account%20!in%20(matched_users)%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1816829602%22%20id%3D%22toc-hId-1816829602%22%20id%3D%22toc-hId-1816829602%22%20id%3D%22toc-hId-1816829602%22%20id%3D%22toc-hId-1816829602%22%20id%3D%22toc-hId-1816829602%22%3EHandling%20multiple%20conditions%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EReady%20to%20get%20the%20full%20strength%20of%20Azure%20Sentinel%3F%20The%20following%20example%20demonstrated%20how%20to%20take%20the%20technique%20presented%20in%20this%20blog%20post%20a%20step%20further.%20It%20adds%20a%20couple%20of%20dimensions%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EAllowing%20a%20different%20operator%20to%20be%20selected%20for%20each%20lookup%20value%3C%2FLI%3E%0A%3CLI%3ECombining%20conditions%20over%20several%20fields%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFirst%2C%20the%20lookup%20table%20includes%2C%20in%20addition%20to%20the%20username%20pattern%2C%20also%20an%20operator.%20The%20query%20supports%20%E2%80%9Ccontains%E2%80%9D%2C%20%E2%80%9Cstartswith%E2%80%9D%20and%20%E2%80%9Cendswith%E2%80%9D.%20It%20also%20includes%20the%20condition%20for%20the%20additional%20field%20we%20want%20to%20lookup%2C%20AccountType%20in%20this%20case.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Elet%20lookup%3Dtoscalar(datatable(op%3Astring%2C%20account%3Astring%2C%20accounttype%3Astring)%20%5B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B'startswith'%2C%20'%5C%5Cadmin'%2C%20'User'%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B'endswith'%2C%20'dc%24'%2C%20'Machine'%5D%3CBR%20%2F%3E%7C%20summarize%20l%3Dmake_list(pack('op'%2Cop%2C'account'%2Caccount%2C%20'accounttype'%2Caccounttype)))%3B%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENotice%20that%20to%20make%20all%20the%20values%20available%20to%20the%20mv-apply%20operation%20which%20requires%20a%20list%20input%2C%20the%20list%20is%20now%20make%20of%20tuples%20using%20KQL%20%E2%80%9C-ERR%3AREF-NOT-FOUND-dynamic%E2%80%9D%20type%20and%20the%20%E2%80%9C-ERR%3AREF-NOT-FOUND-pack%E2%80%9D%20function%20which%20creates%20the%20dynamic%20value.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20main%20template%20used%20below%20for%20the%20query%20is%20the%20user%20allow-listing%20described%20above.%20However%2C%20the%20sub-query%20used%20by%20the%20mv-apply%20operator%20now%20handles%20both%20the%20operator%20selection%20and%20the%20additional%20condition%2C%20demonstrating%20the%20capabilities%20available%20when%20using%20mv-apply%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Elet%20events%3Dmaterialize(SecurityEvent%20%7C%20where%20TimeGenerated%20%26gt%3B%20ago(5m)%20%7C%20where%20%E2%80%A6)%3B%3CBR%20%2F%3Elet%20matched_users%20%3D%20toscalar(%3CBR%20%2F%3Eevents%3CBR%20%2F%3E%7C%20summarize%20by%20Account%2C%20AccountType%3CBR%20%2F%3E%7C%20mv-apply%20l%3Dlookup%20on%3CBR%20%2F%3E(%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3Bextend%20match%20%3D%20case%20(%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3Bl%5B'op'%5D%20%3D%3D%20%22contains%22%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BAccount%20contains%20l%5B'account'%5D%20and%20AccountType%20%3D%3D%20l%5B'accounttype'%5D%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3Bl%5B'op'%5D%20%3D%3D%20%22startswith%22%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BAccount%20startswith%20l%5B'account'%5D%20and%20AccountType%20%3D%3D%20l%5B'accounttype'%5D%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3Bl%5B'op'%5D%20%3D%3D%20%22endswith%22%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BAccount%20endswith%20l%5B'account'%5D%20and%20AccountType%20%3D%3D%20l%5B'accounttype'%5D%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BFalse%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B)%3CBR%20%2F%3E)%3CBR%20%2F%3E%7C%20where%20match%20%7C%20summarize%20make_list(strcat(AccountType%2C%20Account)))%3B%3CBR%20%2F%3Eevents%20%7C%20where%20strcat(AccountType%2C%20Account)%20in%20(matched_users)%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-9375139%22%20id%3D%22toc-hId-9375139%22%20id%3D%22toc-hId-9375139%22%20id%3D%22toc-hId-9375139%22%20id%3D%22toc-hId-9375139%22%20id%3D%22toc-hId-9375139%22%3ESummary%3C%2FH2%3E%0A%3CP%3EWhile%20exact%20lookups%20are%20useful%2C%20many%20use%20cases%20require%20partial%20lookups%2C%20which%20challenge%20every%20SIEM%20system.%20In%20this%20article%2C%20I%20presented%20how%20to%20implement%20such%20approximate%20and%20partial%20lookups%20in%20Azure%20Sentinel.%20I%20hope%20you%20will%20find%20it%20useful.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1393795%22%20slang%3D%22en-US%22%3E%3CP%3EEvery%20SIEM%20can%20perform%20exact%20lookups.%20However%2C%20for%20partial%2C%20approximate%2C%20and%20multi-condition%20lookups%2C%20you%20need%20to%20revert%20to%20complex%20rule%20logic.%20Azure%20Sentinel%20can%20do%20all%20those%20lookups.%20Learn%20here%20how.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1780490%22%20slang%3D%22en-US%22%3ERe%3A%20Approximate%2C%20partial%20and%20combined%20lookups%20in%20Azure%20Sentinel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1780490%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F293879%22%20target%3D%22_blank%22%3E%40Ofer_Shezaf%3C%2FA%3E%26nbsp%3B%3CBR%20%2F%3EThank%20you%20for%20this%20post.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EMay%20I%20ask%20you%20how%20to%20query%20public%2F%20remote%20IP%20events%20in%20CommonSecurityLogs%20%3F%20if%20my%20ranges%20are%20stored%20in%20WatchList%20%3F%3C%2FP%3E%3CDIV%3E%3CSPAN%3E_GetWatchlist(%3C%2FSPAN%3E%3CSPAN%3E'PrivateIPs'%3C%2FSPAN%3E%3CSPAN%3E)%3CBR%20%2F%3E%3C%2FSPAN%3EPrivateIPs%20are%20ranges%20e.g%26nbsp%3B%3CSPAN%3E192.168.0.0%2F%2F16%3C%2FSPAN%3E%3CSPAN%3E%2C%20%3C%2FSPAN%3E%3CSPAN%3E172.16.0.0%2F%2F12%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%3CSPAN%3E%3CBR%20%2F%3Ein%20other%20words%2C%20Im%20interested%20in%20the%20opposite%20case%20that%20you%20mentioned%20in%20this%20post%2C%20something%20like%20this%20but%20more%20dynamic%2F%20from%20Watchlist%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3ECommonSecurityLog%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20not(ipv4_is_match%20(SourceIP%2C%20%3C%2FSPAN%3E%3CSPAN%3E'10.111.40.51'%3C%2FSPAN%3E%3CSPAN%3E))%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20not(ipv4_is_match%20(SourceIP%2C%20%3C%2FSPAN%3E%3CSPAN%3E'172.16.0.0%2F12'%3C%2FSPAN%3E%3CSPAN%3E))%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3ERegards%2C%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E
Microsoft

Many of you found Nir Gafni's "Implementing Lookups in Azure Sentinel" article useful. A common question you made was how to lookup partial values. For example, does the account name matches a list of patterns? Or is an IP address in a list of subnets? Partial lookups are a significant challenge with lookups in other SIEM products and often require reverting to hard to maintain methods such as nested filters.

 

In this blog post, I will show you how to implement partial lookups with Azure Sentinel. I will also venture into more advanced areas such as combined multi-condition lookups.

 

This post of part of a series of blog posts on writing rules in Azure Sentinel:

 

Phrase lookup: the has_any operator

 

The simplest and most efficient way to do partial lookups in Azure Sentinel is to use the "has_any" operator. While the examples in Implementing Lookups in Azure Sentinel used the "in" and "!in" operators which do an exact match, the "has_any" operator searches for any one of a list of lookup phrases in the target field.

 

Let's look into a user watchlist example in Linux Syslog messages. We want to alert only when specific users, stored in a list, fail to login with a wrong password.

Let's start with the lookup table:

 

let keywords_table = datatable (w: string) ['postgres','nagios','doker'];

 

I am using the datatable operator to create the table for convenience so that you can use the example. However, you can use any lookup table source as described in implementing Lookups in Azure Sentinel, such as using the "externaldata" data operator, custom tables, or storing the "datatable" operator in a function.  

 

Next, we need to convert the table to a list:

 

let lookup = toscalar(keywords_table| summarize l=make_list(w));

 

This command could be combined with the previous or the next and is separated here to make it more readable.

 

Lastly, we use the has_any operator to look for only failed password events for the users in the lookup table:

 

Syslog
| where SyslogMessage startswith "Failed password"
| where SyslogMessage has_any (lookup)

 

The "has_any" operator is handy, but is limited to a phrase delimited by word boundaries and would not match any substring. We need another solution for substring matching and other partial matching operators.

 

Watch listing by IP ranges: the mv-apply operator

 

A widespread watch list scenario that requires partial lookups is selecting events based on IP ranges. IP ranges are usually represented in a CIDR notation. For example, the internal IP address range 192.168.x.x is represented by the CIDR notation 192.168.0.0/16.

 

As an example, let's implement an IP range watch list using Azure Sentinel that selects only events that originated in an internal network. The lookup table is the following table, which includes private IP address ranges:

 

let private_ranges = datatable (ip_range: string) ['192.168.0.0/16', '172.16.0.0/12', '10.0.0.0/8'];

 

As mentioned, the “datatable” operator can be “externaldata”, a custom table, or a function.  

Here again, we need to convert the table to a list, using the following command:

 

let lookup = toscalar(private_ranges| summarize l=make_list(ip_range));

 

Now, that we have the watch list ready, we can use it:

 

CommonSecurityLog
| where TimeGenerated > ago(5m)
| where …
| mv-apply l=lookup to typeof(string) on
(
  where ipv4_is_match (SourceIP, l)
)
| project-away l

 

The important operator here is "mv-apply", which applies the query (in red) to every value in the lookup list over every record.  

 

Since mv-apply applies every value in the lookup table to every record, it is performance and memory intensive. If not used carefully, your query may fail. Therefore:

  • Ensure that you use it at the end of your query after you filtered by other criteria that are less demanding.
  • Limit the timespan on which you perform the query as much as possible.
  • Use a reasonably sized lookup table.
  • Lastly, the slightly more complex method presented below for allow-listing can be used for watch lists as well and has better performance.

 

A corner case you may encounter is duplicate results. The result set includes a record for each match, so if an input record matches two elements, it appears twice in the result set. The duplication cannot happen in the example above as the lookup values are mutually exclusive.

 

In some cases, duplicate records are useful, as you would like to analyze each lookup value the record matched. If not, you might need to add something along the following lines. The query requires that a set of fields uniquely identify an event. For SecurityEvents, "EventOriginId" does the trick:

 

| summarize arg_max(TimeGenerated, *) by EventOriginId

 

The solution presented for allow-lists below also overcomes this issue.

There are also a few subtleties when using mv-apply

  • You need to explicitly say what the type of "l" is using the "to typeof()" phrase is.
  • "l" is added to every record and has to be "projected-away"

 

Allow-listing by username

 

Since it returns a record for every match, the technique above cannot be used for allow-listing. For example, if you try to exclude private IP ranges by reversing the logic to:

 

where not(ipv4_is_match (SourceIP, l))

 

You get 3 repeats of every record that does not match the ranges, and 2 repeats for each one that matches one of them. Certainly not the intended result.

 

So, how can we allow-list?

 

The solution is to find using the technique presented for watchlists the list of matching values and apply it using a regular, exact, lookup.

 

Setting up the lookup table is similar to the examples above. In this case, I combined the table and list creation into one statement:

 

let lookup=toscalar(datatable(p:string) ['user','admin'] | summarize l=make_list(p));

 

Next, we use the same mv-apply to check the Account names against the lookup list:

 

let matched_users = toscalar(
SecurityEvent
| where TimeGenerated > ago(5m)
| where …
| summarize by Account
| mv-apply l=lookup to typeof(string) on
(
  where Account contains l
)
| summarize make_list(Account));

 

Notice that here we used the “contains” operator. Any operator, complex expressions, or even full queries, can be used in an “mv-apply” sub-query.

 

Since we do not need the events but only user names to continue the analysis, we can summarize by account (in green) to get a list of unique account names, making this version much more efficient. Lastly, we have created a list of the resulting values (orange), which is a list of account names that contain any of the lookup values.

 

We use the list generated above as a allow list using the "!in" operator (blue)

 

SecurityEvent
| where TimeGenerated > ago(5m)
| where …
| where Account !in (matched_users)

 

We used the same event filter when generating the exclusion list and when using it. While in a simple Azure Sentinel analytics rule which does not filter explicitly by the time this would work, it runs a risk, in some circumstance, that the two runs will not apply to the same event set. The following variant uses the "materialize" operator (magenta) to resolve that:

 

let lookup=toscalar(datatable(p:string) ['user','admin'] | summarize l=make_list(p));
let events=materialize(SecurityEvent | where TimeGenerated  > ago(5m) | where …);
let matched_users = toscalar(events
| summarize by Account
| mv-apply l=lookup to typeof(string) on
(
  where Account contains l
)
| summarize make_list(Account));
events
| where Account !in (matched_users)

 

Handling multiple conditions

 

Ready to get the full strength of Azure Sentinel? The following example demonstrated how to take the technique presented in this blog post a step further. It adds a couple of dimensions:

  • Allowing a different operator to be selected for each lookup value
  • Combining conditions over several fields

 

First, the lookup table includes, in addition to the username pattern, also an operator. The query supports “contains”, “startswith” and “endswith”. It also includes the condition for the additional field we want to lookup, AccountType in this case.

 

let lookup=toscalar(datatable(op:string, account:string, accounttype:string) [
    'startswith', '\\admin', 'User',
    'endswith', 'dc$', 'Machine']
| summarize l=make_list(pack('op',op,'account',account, 'accounttype',accounttype)));

 

Notice that to make all the values available to the mv-apply operation which requires a list input, the list is now make of tuples using KQL “dynamic” type and the “pack” function which creates the dynamic value.

 

The main template used below for the query is the user allow-listing described above. However, the sub-query used by the mv-apply operator now handles both the operator selection and the additional condition, demonstrating the capabilities available when using mv-apply:

 

 

let events=materialize(SecurityEvent | where TimeGenerated > ago(5m) | where …);
let matched_users = toscalar(
events
| summarize by Account, AccountType
| mv-apply l=lookup on
(
    extend match = case (
        l['op'] == "contains",
            Account contains l['account'] and AccountType == l['accounttype'],
        l['op'] == "startswith",
            Account startswith l['account'] and AccountType == l['accounttype'],
        l['op'] == "endswith",
            Account endswith l['account'] and AccountType == l['accounttype'],
        False
    )
)
| where match | summarize make_list(strcat(AccountType, Account)));
events | where strcat(AccountType, Account) in (matched_users)

 

Summary

While exact lookups are useful, many use cases require partial lookups, which challenge every SIEM system. In this article, I presented how to implement such approximate and partial lookups in Azure Sentinel. I hope you will find it useful.

1 Comment
Occasional Contributor

Hi @Ofer_Shezaf 
Thank you for this post.


May I ask you how to query public/ remote IP events in CommonSecurityLogs ? if my ranges are stored in WatchList ?

_GetWatchlist('PrivateIPs')
PrivateIPs are ranges e.g 192.168.0.0//16, 172.16.0.0//12

in other words, Im interested in the opposite case that you mentioned in this post, something like this but more dynamic/ from Watchlist
CommonSecurityLog
| where not(ipv4_is_match (SourceIP, '10.111.40.51'))
| where not(ipv4_is_match (SourceIP, '172.16.0.0/12'))
 
Regards,