%3CLINGO-SUB%20id%3D%22lingo-sub-1092194%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20Lookups%20in%20Azure%20Sentinel%20part%20%231%3A%20reference%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1092194%22%20slang%3D%22en-US%22%3E%3CP%3ELooks%20like%20a%20word%20or%20two%20may%20have%20been%20left%20out%20this%20this%20sentence(s)%3C%2FP%3E%3CP%3E%22%3CSPAN%3ENext%2C%20we%20provided%20the%20URL.%20in%20front%20of%20the%20string%3A%20this%20ensures%20that%20we%20don%E2%80%99t%20log%20the%20string%22%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1092265%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20Lookups%20in%20Azure%20Sentinel%20part%20%231%3A%20reference%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1092265%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%2C%20for%20noticing%2C%20updated%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1093954%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20Lookups%20in%20Azure%20Sentinel%20part%20%231%3A%20reference%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1093954%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F502083%22%20target%3D%22_blank%22%3E%40nirgafni%3C%2FA%3E%26nbsp%3Bthis%20article%20is%20really%20helpful%20and%20the%20presentation%20is%20crystal%20clear.%20Thanks%20for%20making%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F46875%22%20target%3D%22_blank%22%3E%40Gary%20Bushey%3C%2FA%3E%26nbsp%3Bthanks%20for%20sharing%20this%20link.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1096279%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20Lookups%20in%20Azure%20Sentinel%20part%20%231%3A%20reference%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1096279%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F502083%22%20target%3D%22_blank%22%3E%40nirgafni%3C%2FA%3E%26nbsp%3Bi%20have%20tested%20this%20scenario.%20Here%20are%20my%20findings.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1.%26nbsp%3B%3CSPAN%3Eobfuscation%20is%20not%20working%20even%20i%20used%20h%20or%20H.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E2.%20Storage%20account%20i.e%20blob%20is%20only%20accessible%20if%20i%20use%20allow%20access%20from%20All%20Networks%20option.%20%23%20im%20looking%20if%20we%20can%20only%20allow%20connection%20from%20log%20analytics%20workspace.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E3.%20In%20my%20case%20i%20need%20access%20to%20blob%20for%20more%20time.%20Because%20my%20correlation%20rule%20fetch%20data%20every%20time%20from%20blob%20whenever%20it%20runs.%20%23%20so%20i%20tried%20to%20using%20the%20Blob%20service%20SAS%20URL.%20But%20its%20not%20working.%20i%20compared%20the%20GET%20SAS%20n%26nbsp%3BBlob%20service%20SAS%20URL%20both%20are%20different.%20In%20Blob%20service%20SAS%20URL%20container%20and%20blob%20is%20not%20available.%20I%20think%20that's%20the%20reason%20its%20not%20working.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3ECan%20you%2C%20please%20suggest%20on%20this%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1098092%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20Lookups%20in%20Azure%20Sentinel%20part%20%231%3A%20reference%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1098092%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%2F492724%22%20target%3D%22_blank%22%3E%40Pavan_Gelli1910%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EThe%20obfuscation%20reflects%20in%20our%20logs%2C%20and%20you%20won't%20see%20anything%20on%20your%20side%2C%20see%20details%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2Fscalar-data-types%2Fstring%23obfuscated-string-literals%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EUnfortunately%2C%20currently%20there%20is%20no%20such%20option%3C%2FLI%3E%0A%3CLI%3E%26nbsp%3BNot%20sure%20I%20follow%20the%20issue%2C%20will%20continue%20in%20private%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EThanks%20for%20reading%20and%20testing%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1098304%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20Lookups%20in%20Azure%20Sentinel%20part%20%231%3A%20reference%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1098304%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F502083%22%20target%3D%22_blank%22%3E%40nirgafni%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20your%20response.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20did%20some%20testing%20and%20now%20Im%20able%20to%20use%20shared%20access%20signature%20with%20longer%20duration.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1142308%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20Lookups%20in%20Azure%20Sentinel%20part%20%231%3A%20reference%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1142308%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%2F502083%22%20target%3D%22_blank%22%3E%40nirgafni%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20we%20import%20IOCs%20from%20an%20excel%20file%20in%20a%20local%20computer%20with%20creating%20a%20BLOB%20object%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3EMitesh%20Agrawal%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1213526%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20Lookups%20in%20Azure%20Sentinel%20part%20%231%3A%20reference%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1213526%22%20slang%3D%22en-US%22%3E%3CP%3EIs%20there%20some%20way%20to%20output%20results%20from%20a%20query%20to%20a%20blob%20object%20that%20can%20then%20be%20accessed%20from%20subsequent%20queries%20as%20above%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1264791%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20Lookups%20in%20Azure%20Sentinel%20part%20%231%3A%20reference%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1264791%22%20slang%3D%22en-US%22%3E%3CP%3EHow%20can%20we%20authenticate%20to%20an%20HTTP%20server%20using%20externaldata%20function%20%3F%20For%20example%2C%20an%20HTTP%20server%20that%20requires%20NTLM%20or%20Basic%20Authentication.%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F502083%22%20target%3D%22_blank%22%3E%40nirgafni%3C%2FA%3E%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%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1265030%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20Lookups%20in%20Azure%20Sentinel%20part%20%231%3A%20reference%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1265030%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F469462%22%20target%3D%22_blank%22%3E%40majo1%3C%2FA%3E%26nbsp%3B%3A%26nbsp%3Bexternaldata%20works%20the%20best%20with%20Azure%20storage%20signatures%20as%20described%20in%20the%20post.%20As%20hack%2C%20you%20can%20create%20an%20azure%20function%20or%20a%20Logic%20App%20that%20serves%20as%20a%20webhook%2C%20accepting%20a%20single%20HTTPS%20request%20and%20issuing%20multiple%20ones.%20It%20is%20important%20to%20note%20that%20this%20is%20a%20hack%2C%20we%20don't%20have%20a%20lot%20of%20experience%20with%20it%20and%20may%20not%20work%20in%20the%20future.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1281098%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20Lookups%20in%20Azure%20Sentinel%20part%20%231%3A%20reference%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1281098%22%20slang%3D%22en-US%22%3E%3CP%3Ehi%2C%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F502083%22%20target%3D%22_blank%22%3E%40nirgafni%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGreat%20post.%3C%2FP%3E%3CP%3E%3CSPAN%3EIs%20this%20post%20out%2C%20%22I%20will%20show%20you%20how%20to%20implement%20these%20use%20cases%20for%20reference%20tables%2C%20which%20are%20not%20available%20as%20files.%22%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1282533%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20Lookups%20in%20Azure%20Sentinel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1282533%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%2F387181%22%20target%3D%22_blank%22%3E%40joseph2165%3C%2FA%3E%26nbsp%3B%3A%20we%20have%20now%20updated%20the%20post%20to%20include%20this%20as%20well.%20See%20%22Using%20a%20workspace%20table%20as%20a%20reference%20table%22%20above.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1357446%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20Lookups%20in%20Azure%20Sentinel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1357446%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20nirgafni%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3EI%20tried%20using%20lookups%20for%20watchlist%20of%20particular%20users..%20I%20uploaded%20the%20users%20list%20in%20the%20blob%20container%20generated%20the%20sas%20url%20and%20used%20it%20in%20the%20query%20which%20you%20provided%20for%20watchlist%2Cbut%20I'm%20not%20able%20to%20fetch%20the%20results.Can%20you%20please%20help%20me%20fix%20this.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1363746%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20Lookups%20in%20Azure%20Sentinel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1363746%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20nirgafni%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20was%20able%20to%20achieve%20results%20for%20the%20above%20concern%2C%20but%20there%20is%20one%20more%20issue%20I%20need%20help%20on%20.%3CBR%20%2F%3E%22When%20I%20try%20to%20use%20externaldata%20operator%20it%20displays%20the%20data%20of%20first%20and%20second%20columns%20irrespective%20of%20the%20column%20names.%20For%20example%20%3A%3C%2FP%3E%3CP%3E%3CSTRONG%3EAlternateSignInName%2CDisplayName%2CLocation%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CA%20href%3D%22mailto%3Axyz%40abc.com%2C%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Exyz%40abc.com%2C%3C%2FA%3E%20XYZ%2C%20IN%3C%2FP%3E%3CP%3Efrom%20the%20above%20data%20if%20I%20use%20externaldata%20operator%20to%20fetch%20details%20in%202nd%20and%203rd%20columns%20(i.e%20Displayname%20and%20Location)%20it%20displays%20the%20results%20as%20below%3A%3C%2FP%3E%3CP%3E%3CSTRONG%3EDisplayName%2CLocation%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CA%20href%3D%22mailto%3Axyz%40abc.com%2C%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Exyz%40abc.com%2C%3C%2FA%3E%20XYZ%3C%2FP%3E%3CP%3EIt%20is%20taking%20the%20data%20of%201st%20and%202nd%20columns%20irrespective%20of%20the%20required%20column%20names.%3C%2FP%3E%3CP%3ECould%20you%20please%20let%20me%20know%20why%20is%20it%20this%20way%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1363812%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20Lookups%20in%20Azure%20Sentinel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1363812%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%2F646607%22%20target%3D%22_blank%22%3E%40sindhu173%3C%2FA%3E%26nbsp%3B%3A%26nbsp%3B%20This%20is%20the%20expected%20behavior.%20The%20CSV%20header%20field%20names%20are%20not%20relevant.%20You%20always%20read%20the%20first%20fields%20in%20each%20row%20and%20name%20them%20based%20on%20the%20externaldata%20definition.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1503210%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20Lookups%20in%20Azure%20Sentinel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1503210%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%202%20columns%20in%20my%20datatable%20both%20are%20string%20values.%20I%20need%20to%20whitelist%20both%20the%20column%20name%20values%20in%20my%20query.%20If%20I%20have%20one%20column%20in%20mydatable%2C%20I%20am%20able%20to%20use%20%22%7C%20where%20mycolumn%20!in~(mydatable)%22%20but%20how%20to%20whitelist%20both%20column%20name%20values%20which%20occur%20in%20a%20single%20row.%20If%20the%20column%20name%20values%20doesn't%20occur%20in%20the%20same%20row%2C%20I%20would%20like%20to%20see%20them.%20Thanks%20in%20advance.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1503307%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20Lookups%20in%20Azure%20Sentinel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1503307%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F717142%22%20target%3D%22_blank%22%3E%40raviannangi%3C%2FA%3E%26nbsp%3B%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20either%3A%3C%2FP%3E%0A%3CP%3E1.%20Use%20the%20join%20operator%20described%20above.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E2.%20Use%20the%20%22!in~%22%20or%20concatenated%20values%20like%20this%3A%3C%2FP%3E%0A%3CPRE%3Elet%20list%20%3D%20toscalar%20(%3CSPAN%3Emydatable%26nbsp%3B%3C%2FSPAN%3E%7C%20summarize%20make_list(strcat%20(col1%2C%20%22%7C%22%2C%20col2)))%3B%26nbsp%3B%3CBR%20%2F%3E....%3CBR%20%2F%3E%7C%20where%20strcat%20(col1%2C%20%22%7C%22%2C%20col2)%20!in~%20(list)%26nbsp%3B%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1503453%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20Lookups%20in%20Azure%20Sentinel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1503453%22%20slang%3D%22en-US%22%3E%3CP%3E%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%3C%2FP%3E%3CP%3EHi%20Ofer%2C%3C%2FP%3E%3CP%3EThanks%20for%20your%20quick%20response.%20I%20tried%20this%2C%20it%20didn't%20give%20me%20expected%20result.%20I%20think%20I%20should%20explain%20in%20a%20better%20way.%26nbsp%3B%3C%2FP%3E%3CP%3EBelow%20is%20my%20query%20sample%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3Elet%20WhiteList%20%3D%20datatable%20(WorkstationName%3C%2FSPAN%3E%3CSPAN%3E%3A%3C%2FSPAN%3E%3CSPAN%3Estring%3C%2FSPAN%3E%3CSPAN%3E%2C%20TargetUserName%3C%2FSPAN%3E%3CSPAN%3E%3A%3C%2FSPAN%3E%3CSPAN%3Estring%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%5B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E'x'%2C'a'%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2C%20'y'%2C%20'b'%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2C'z'%2C'c'%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%5D%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3ESecurityEvent%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20where%20AccountType%20%3D~%22User%22%20and%20EventID%20%3D%3D%204625%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E....%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E....%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%2F%2FIf%20a%20TargetUserName%20lets%20say%20'a'%20logons%20on%20to%20a%20WorkstationName%20lets%20say%20'x'%20and%20even%20has%20a%20failure%20count%2C%20I%20would%20ignore.%20Same%20for%20the%20rest%20of%20the%20created%20datatable%20%22WhiteList%22.%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EPlease%20provide%20your%20valuable%20inputs%20%3A)%3C%2Fimg%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1504692%22%20slang%3D%22en-US%22%3ERe%3A%20Implementing%20Lookups%20in%20Azure%20Sentinel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1504692%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20should%20pull%20the%20trick%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%3E%0A%3CDIV%3E%3CSPAN%3Elet%20allowlist%20%3D%20datatable%20(WorkstationName%3C%2FSPAN%3E%3CSPAN%3E%3A%3C%2FSPAN%3E%3CSPAN%3Estring%3C%2FSPAN%3E%3CSPAN%3E%2C%20TargetUserName%3C%2FSPAN%3E%3CSPAN%3E%3A%3C%2FSPAN%3E%3CSPAN%3Estring%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%5B%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%20%3CSPAN%3E'x'%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E'a'%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%20%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E'y'%3C%2FSPAN%3E%3CSPAN%3E%2C%20%3C%2FSPAN%3E%3CSPAN%3E'b'%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%20%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E'z'%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E'c'%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%5D%3B%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3Elet%20allowlistconcat%20%3D%20toscalar%20(allowlist%20%7C%20%3C%2FSPAN%3E%3CSPAN%3Esummarize%3C%2FSPAN%3E%3CSPAN%3E%20make_list(strcat(WorkstationName%2C%20%3C%2FSPAN%3E%3CSPAN%3E%22%7C%22%3C%2FSPAN%3E%3CSPAN%3E%2C%20TargetUserName)))%3B%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3ESecurityEvent%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20AccountType%20%3D~%3C%2FSPAN%3E%3CSPAN%3E%22User%22%3C%2FSPAN%3E%20%3CSPAN%3Eand%3C%2FSPAN%3E%3CSPAN%3E%20EventID%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E4625%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20strcat(Computer%2C%20%3C%2FSPAN%3E%3CSPAN%3E%22%7C%22%3C%2FSPAN%3E%3CSPAN%3E%2C%20Account)%20!in~%20(allowlistconcat)%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1091306%22%20slang%3D%22en-US%22%3EImplementing%20Lookups%20in%20Azure%20Sentinel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1091306%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20this%20blog%20post%20%E2%80%9C%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%3EActive%20Lists%20out%3B%20make_list()%20in%3C%2FA%3E%E2%80%9D%2C%20%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%3Breferred%20to%20one%20of%20the%20uses%20of%20Active%20Lists%20(ArcSight)%20or%20reference%20sets%20(QRadar)%2C%20namely%20implementing%20correlation.%20But%20Active%20Lists%2C%20reference%20sets%2C%20and%20the%20appropriately%20named%20Lookups%20in%20Splunk%20have%20another%20important%20use%3A%20lookups.%20In%20this%20blog%20post%2C%20I%20take%20an%20initial%20stub%20at%20doing%20lookups%20in%20Azure%20Sentinel.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAzure%20Sentinel%20has%20a%20variety%20of%20methods%20to%20perform%20lookups%2C%20enabling%20diverse%20sources%20for%20the%20lookup%20data%20and%20different%20ways%20to%20process%20it.%20Overall%2C%20I%20think%20you%20will%20find%20that%20Azure%20Sentinel%20capabilities%20offer%20unparallel%20lookup%20prowess.%26nbsp%3B%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%3CFONT%20color%3D%22%23000080%22%3E%3CEM%3E%5B%23%24dp21%5DImplementing%20Lookups%20in%20Azure%20Sentinel%26nbsp%3B%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%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%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--1436746204%22%20id%3D%22toc-hId--1436746204%22%3EWhy%20lookups%3F%3C%2FH2%3E%0A%3CP%3EWhy%20do%20you%20need%20to%20look%20up%20information%20in%20a%20SIEM%20query%2C%20whether%20hunting%20queries%20or%20detection%20rules%3F%20The%20top%20reasons%20are%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EAllow-listing%20-%20making%20sure%20a%20query%20ignores%20known%20outliers%20that%20do%20not%20justify%20alerting%20on.%20For%20example%2C%20excluding%20a%20backup%20process%20from%20a%20query%20identifying%20access%20to%20large%20amounts%20of%20data.%3C%2FLI%3E%0A%3CLI%3EWatch%20lists%20-%20in%20reverse%2C%20making%20sure%20that%20alerts%20with%20the%20listed%20entities%20are%20promoted%2C%20whether%20by%20assigning%20a%20higher%20severity%20or%20by%20alerting%20only%20on%20those.%20For%20example%2C%20flagging%20access%20to%20sensitive%20finance%20files.%3C%2FLI%3E%0A%3CLI%3EEnrichment%20%E2%80%93%20extending%20events%20or%20alerts%20with%20additional%20information%20needed%20for%20detection%20or%20investigation.%20Common%20enrichment%20sources%20include%20user%20information%2C%20asset%20or%20resource%20information%2C%20geoinformation%2C%20and%20threat%20intelligence.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThose%20are%20critical%20capabilities%20of%20a%20SIEM.%20While%20each%20specialized%20security%20tool%20has%20a%20partial%20view%20of%20the%20world%2C%20a%20SIEM%20can%20utilize%20its%20broader%20outreach%20to%20enrich%20event%20and%20alert%20data%20and%20centrally%20manage%20allow-lists%20and%20watch%20lists.%3C%2FP%3E%0A%3CP%3EIn%20this%20blog%20post%2C%20I%20examine%20implementing%20all%20those%20use%20cases%20in%20Azure%20Sentinel.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1050766629%22%20id%3D%22toc-hId-1050766629%22%3ELookup%20data%3C%2FH2%3E%0A%3CP%3ETo%20reference%20the%20data%2C%20we%20first%20need%20to%20locate%20it.%20The%20variety%20of%20use%20cases%20above%20implies%20that%20the%20data%20may%20exist%20in%20many%20places%20and%20accessible%20by%20different%20means.%20Azure%20Sentinel%20supports%20two%20methods%20for%20accessing%20lookup%20information%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EStored%20as%20files%20or%20tables%20in%20Azure%20Storage%3C%2FLI%3E%0A%3CLI%3EStored%20in%20the%20Sentinel%20workspace%20as%20a%20custom%20table%2C%20uploaded%20using%20any%20-ERR%3AREF-NOT-FOUND-custom%20connector%20technique.%26nbsp%3B%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EWhich%20one%20should%20I%20use%3F%20If%20the%20data%20is%20available%20as%20a%20file%2C%20Azure%20Storage%20is%20probably%20preferable.%20If%20ou%20need%20to%20create%20a%20script%20to%20process%20the%20data%20and%20prepare%20it%2C%20you%20might%20as%20well%20write%20it%20to%20the%20workspace.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--756687834%22%20id%3D%22toc-hId--756687834%22%3EReferencing%20an%20Azure%20Storage%20file%20using%20the%20KQL%20externaldata%20operator%3C%2FH2%3E%0A%3CP%3ETo%20support%20a%20lookup%20from%20an%20external%20file%2C%20KQL%20offers%20the%20%22-ERR%3AREF-NOT-FOUND-exernaldata%22%20operator.%20Unlike%20lookup%20implementation%20in%20other%20SIEM%20products%2C%20externaldata%20is%20not%20a%20lookup%20operator.%20Instead%2C%20externaldata%20enable%20using%20files%20as%20if%20they%20were%20Azure%20Sentinel%20tables%2C%20which%20allows%20pre-processing%20of%20the%20file%20before%20actually%20performing%20the%20lookup%2C%20for%20example%20filtering%2C%20parsing.%20I%20will%20demonstrate%20each%20in%20the%20examples%20below.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--66126360%22%20id%3D%22toc-hId--66126360%22%3ECreating%20the%20file%3C%2FH3%3E%0A%3CUL%3E%0A%3CLI%3ECreate%20an%20Azure%20storage%20account.%3C%2FLI%3E%0A%3CLI%3ECreate%20a%20blob%20container.%20Note%20that%20by%20default%20the%20container%20is%20private%20and%20does%20not%20allow%20public%20access%2C%20which%20is%20probably%20what%20you%20want.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22storage%20private.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F199939i7B6CB1ED14156D04%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22storage%20private.png%22%20alt%3D%22storage%20private.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3EAs%20an%20alternative%20to%20blobs%2C%20you%20can%20also%20use%20Azure%20Files%20or%20Azure%20Tables.%20The%20main%20difference%20is%20how%20you%20update%20the%20files%3A%3C%2FSPAN%3E%3CUL%3E%0A%3CLI%20class%3D%22ql-indent-1%22%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3EAzure%20Files%20allows%26nbsp%3B%3C%2FSPAN%3E-ERR%3AREF-NOT-FOUND-%3CSPAN%20data-preserver-spaces%3D%22true%22%3Eeasy%20sync%3C%2FSPAN%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3E%26nbsp%3Bto%20a%20Windows%20computer%2C%20allowing%20editing%20of%20the%20lookup%20table%20using%20standard%20software%20such%20as%20Excel.%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20class%3D%22ql-indent-1%22%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3EAzure%20Tables%20allows%20table-style%20editing%20within%20the%20portal.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20class%3D%22ql-indent-1%22%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3EUsing%20blobs%2C%20you%20can%20still%20edit%20using%20the%20internal%20Azure%20Blob%20storage%20editor%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20data-preserver-spaces%3D%22true%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22lookup%20edit.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F200025iD436919DE9C062FE%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22lookup%20edit.png%22%20alt%3D%22lookup%20edit.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EUpload%20to%20it%20your%20lookup%20file%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EIn%20the%20following%20sections%20I%20will%20use%20the%20following%20CSV%20file%2C%20conveniently%20created%20in%20Excel%3A%3C%2FP%3E%0A%3CPRE%3E%3CFONT%20size%3D%221%202%203%204%205%206%207%22%3E%3CEM%3EUserName%2CDisplayName%2CRisk%2CLocation%3CBR%20%2F%3E%3C%2FEM%3E%3C%2FFONT%3E%3CFONT%20size%3D%221%202%203%204%205%206%207%22%3E%3CEM%3Echris%40contoso.com%2CChris%20Green%2C70%2C%22%7B%20%22%22City%22%22%3A%20%22%22Redmond%22%22%2C%20%22%22State%22%22%3A%20%22%22Washintgon%22%22%2C%20%22%22Country%22%22%3A%20%22%22US%22%22%20%7D%22%3CBR%20%2F%3E%3C%2FEM%3E%3C%2FFONT%3E%3CFONT%20size%3D%221%202%203%204%205%206%207%22%3E%3CEM%3Eben%40contoso.com%2CBen%20Andrews%2C100%2C%22%7B%20%22%22City%22%22%3A%20%22%22Oxford%22%22%2C%20%22%22State%22%22%3A%20%22%22Oxfordshare%22%22%2C%20%22%22Country%22%22%3A%20%22%22UK%22%22%20%7D%22%3CBR%20%2F%3E%3C%2FEM%3E%3C%2FFONT%3E%3CFONT%20size%3D%221%202%203%204%205%206%207%22%3E%3CEM%3Enir%40contoso.com%2CNir%20Cohen%2C50%2C%22%7B%20%22%22City%22%22%3A%20%22%22Tel-Aviv%22%22%2C%20%22%22State%22%22%3A%20%22%22%22%22%2C%20%22%22Country%22%22%3A%20%22%22IL%22%22%20%7D%22%3CBR%20%2F%3E%3C%2FEM%3E%3C%2FFONT%3E%3CFONT%20size%3D%221%202%203%204%205%206%207%22%3E%3CEM%3EGabriela%40contoso.com%2CCynthia%20Silva%2C20%2C%22%7B%20%22%22City%22%22%3A%20%22%22Rio%20de%20Janeiro%22%22%2C%20%22%22State%22%22%3A%20%22%22Rio%20de%20Janeiro%22%22%2C%20%22%22Country%22%22%3A%20%22%22BR%22%22%20%7D%22%3CBR%20%2F%3E%3C%2FEM%3E%3C%2FFONT%3E%3CFONT%20size%3D%221%202%203%204%205%206%207%22%3E%3CEM%3Emelissa%40contoso.com%2CChandana%26nbsp%3B%20Agarwals%26nbsp%3B%2C100%2C%22%7B%20%22%22City%22%22%3A%20%22%22Mumbai%22%22%2C%20%22%22State%22%22%3A%20%22%22Maharashtra%22%22%2C%20%22%22Country%22%22%3A%20%22%22IN%22%22%20%7D%22%3C%2FEM%3E%3C%2FFONT%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20get%20a%20secure%20access%20URL%2C%20use%20the%20%E2%80%9CGet%20Shared%20Access%20Signature%E2%80%A6%E2%80%9D%20feature%2C%20which%20generates%20for%20you%20a%20URL%20similar%20to%20this%20one%3A%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23993300%22%3Ehttps%3A%2F%2F***.blob.core.windows.net%2Fexternaldata%2Fusers.csv%3Fsp%3Drl%26amp%3Bst%3D2019-12-23T12%3A49%3A20Z%26amp%3Bse%3D2019-12-24T12%3A49%3A20Z%26amp%3Bsv%3D2019-02-02%26amp%3Bsr%3Db%26amp%3Bsig%3D***...***%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22clipboard_image_0.png%22%20style%3D%22width%3A%20688px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F163799iEF464DF20BF8954B%2Fimage-dimensions%2F688x432%3Fv%3D1.0%22%20width%3D%22688%22%20height%3D%22432%22%20title%3D%22clipboard_image_0.png%22%20alt%3D%22clipboard_image_0.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1873580823%22%20id%3D%22toc-hId--1873580823%22%3EUsing%20the%20reference%20file%20in%20KQL%3C%2FH3%3E%0A%3CP%3ESince%20we%20start%20with%20a%20allow-list%20example%2C%20we%20need%20only%20the%20first%20column%20from%20the%20lookup%20file%20and%20can%20use%20the%20following%20KQL%20command%20to%20reference%20the%20file%3A%3C%2FP%3E%0A%3CPRE%3Eexternaldata%20(UserPrincipalName%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Estring%3C%2FFONT%3E)%20%5Bh%3CFONT%20color%3D%22%23993300%22%3E%22https%3A%2F%2F...%22%3C%2FFONT%3E%5D%20with%20(ignoreFirstRecord%3D%3CFONT%20color%3D%22%230000FF%22%3Etrue%3C%2FFONT%3E)%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet%E2%80%99s%20examine%20the%20query.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EFirst%2C%20we%20defined%20the%20type%20for%20the%20first%20column%20in%20the%20CSV%20file.%20String%20in%20this%20case.%3C%2FLI%3E%0A%3CLI%3ENext%2C%20we%20provided%20the%20URL.%20Note%20the%20%E2%80%9Ch%E2%80%9D%20added%20in%20front%20of%20the%20string%3A%20this%20ensures%20that%20we%20don%E2%80%99t%20log%20the%20string%2C%20which%20includes%20sensitive%20information%2C%20to%20our%20internal%20audit%20logs.%20For%20more%20information%20on%20query%20obfuscation%20read%20-ERR%3AREF-NOT-FOUND-here.%3C%2FLI%3E%0A%3CLI%3ELast%2C%20we%20use%20the%20attribute%20ignoreFirstRecord%3D%3CFONT%20color%3D%22%230000FF%22%3Etrue%3C%2FFONT%3E%2C%20since%20the%20first%20line%20includes%20column%20names%20and%20is%20not%20relevant.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EWhen%20you%20run%20this%20query%2C%20you%20get%20this%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22clipboard_image_1.png%22%20style%3D%22width%3A%20225px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F163797i31119FF3581B09D2%2Fimage-dimensions%2F225x196%3Fv%3D1.0%22%20width%3D%22225%22%20height%3D%22196%22%20title%3D%22clipboard_image_1.png%22%20alt%3D%22clipboard_image_1.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EOnly%20the%20first%20column%20of%20the%20file%20is%20used%20since%20we%20defined%20a%20type%20only%20for%20it.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20filename%20extension%20identifies%20the%20file%20as%20CSV%3B%20however%2C%20we%20could%20have%20overridden%20the%20type.%20For%20example%2C%20if%20we%20force%20%E2%80%9Ctxt%E2%80%9D%20as%20the%20file%20type%2C%20each%20file%20line%20is%20considered%20a%20single%20field%2C%20and%20the%20query%20returns%20in%20the%20UserName%20field%20the%20entire%20line.%20Other%20supported%20formats%20include%20JSON%20and%20AVRO%2C%20as%20well%20as%20compressed%20files.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Eexternaldata%20(UserPrincipalName%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Estring%3C%2FFONT%3E)%20%5Bh%3CFONT%20color%3D%22%23993300%22%3E%22https%3A%2F%2F...%22%3C%2FFONT%3E%5D%20with%20(ignoreFirstRecord%3D%3CFONT%20color%3D%22%230000FF%22%3Etrue%3CFONT%20color%3D%22%23000000%22%3E%2C%20format%3D%3C%2FFONT%3E%22txt%22%3C%2FFONT%3E)%3C%2FPRE%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22clipboard_image_2.png%22%20style%3D%22width%3A%20722px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F163798iBDB4B80853D47ABE%2Fimage-dimensions%2F722x186%3Fv%3D1.0%22%20width%3D%22722%22%20height%3D%22186%22%20title%3D%22clipboard_image_2.png%22%20alt%3D%22clipboard_image_2.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EFor%20a%20full%20list%20of%20supported%20file%20types%20and%20other%20attributes%2C%20refer%20to%20-ERR%3AREF-NOT-FOUND-this%20page.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1884083927%22%20id%3D%22toc-hId--1884083927%22%3EAllow-listing%20users%3C%2FH2%3E%0A%3CP%3ETo%20implement%20while%20listing%2C%20let%E2%80%99s%20take%20Azure%20Sentinel%E2%80%99s%20rules%20to%20detect%20-ERR%3AREF-NOT-FOUND-Failed%20login%20attempts%20to%20Azure%20Portal.%20The%20modified%20(and%20abbreviated)%20query%20is%20below%2C%20with%20the%20modifications%20marked%20in%20yellow%3A%3C%2FP%3E%0A%3CPRE%3Elet%20timeRange%20%3D%201d%3B%3CBR%20%2F%3E%3CSTRONG%3E%3CSPAN%20style%3D%22background-color%3A%20yellow%3B%22%3Elet%20allowlist%20%3D%20externaldata%20(UserPrincipalName%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Estring%3C%2FFONT%3E)%20%5Bh%3CFONT%20color%3D%22%23993300%22%3E%22https%3A%2F%2F...%22%3C%2FFONT%3E%5D%20with%20(ignoreFirstRecord%3D%3CFONT%20color%3D%22%230000FF%22%3Etrue%3C%2FFONT%3E)%3B%3C%2FSPAN%3E%3C%2FSTRONG%3E%3CBR%20%2F%3ESigninLogs%3CBR%20%2F%3E%7C%20%3CFONT%20color%3D%22%230000FF%22%3Ewhere%3C%2FFONT%3E%20TimeGenerated%20%26gt%3B%3D%20ago(timeRange)%3CBR%20%2F%3E%E2%80%A6%3CBR%20%2F%3E%3CFONT%20color%3D%22%23339966%22%3E%2F%2F%20Exclude%20non-failure%20types%3C%2FFONT%3E%3CBR%20%2F%3E%7C%20%3CFONT%20color%3D%22%230000FF%22%3Ewhere%3C%2FFONT%3E%20ResultType%20!in%20(%3CFONT%20color%3D%22%23993300%22%3E%220%22%3C%2FFONT%3E%2C%20%3CFONT%20color%3D%22%23993300%22%3E%2250125%22%3C%2FFONT%3E%2C%20%3CFONT%20color%3D%22%23993300%22%3E%2250140%22%3C%2FFONT%3E)%3CBR%20%2F%3E%3CSTRONG%3E%3CSPAN%20style%3D%22background-color%3A%20yellow%3B%22%3E%3CFONT%20color%3D%22%23339966%22%3E%2F%2F%20Exclude%20allow-listed%20users%3C%2FFONT%3E%3CBR%20%2F%3E%7C%20%3CFONT%20color%3D%22%230000FF%22%3Ewhere%3C%2FFONT%3E%20UserPrincipalName%20!in~%20(allowlist)%3C%2FSPAN%3E%3C%2FSTRONG%3E%3CBR%20%2F%3E%E2%80%A6%3C%2FPRE%3E%0A%3CP%3EThe%20first%20modification%20defined%20the%20allow-list%20table%20using%20the%20externaldata%20command.%20Strictly%20speaking%2C%20you%20don%E2%80%99t%20have%20to%20define%20in%20advance%20the%20allow-list%20table%2C%20but%20it%20adds%20a%20lot%20to%20readability.%20The%20second%20modification%20checked%20that%20the%20UPN%20is%20not%20in%20the%20allow-list%20table.%20That%E2%80%99s%20all.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3EWonder%20why%20the%20%E2%80%9C~%E2%80%9D%3B%20in%20the%20%E2%80%9Cnot%20in%E2%80%9D%20operator%3F%20It%20means%20that%20the%20comparison%20is%20case%20insensitive.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBut%20what%20if%20I%20want%20to%20allow-list%20by%20two%20fields%2C%20i.e.%20use%20a%20table%20that%20has%20users%20and%20apps%20and%20allow-list%20the%20users%20only%20to%20specific%20apps.%20You%20can%20do%20that%20using%20concatenation%20as%20follows%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CSPAN%3E...%3CBR%20%2F%3Elet%20allowlist%20...%3CBR%20%2F%3E%3CEM%3E%2F%2F%20--%20Add%20the%20following%20line%2C%20assuming%20that%20allowlist%20included%20both%20UserPrincipalName%20and%20AppDiscplayName%3C%2FEM%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%230000FF%22%3Elet%20allowlistconcat%20%3D%20toscalar%20(allowlist%20%7C%26nbsp%3B%3C%2FFONT%3E%3C%2FSPAN%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%3Esummarize%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3Bmake_list(strcat(UserPrincipalName%2C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22%7C%22%3C%2FSPAN%3E%3CSPAN%3E%2C%20AppDisplayName)))%3B%20%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FFONT%3E%3CSPAN%3ESigninLogs%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3E...%3CBR%20%2F%3E%3CEM%3E%2F%2F%20--%20Replace%20the%20allow-list%20lookup%20line%20with%20the%20following%3C%2FEM%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%230000FF%22%3E%7C%26nbsp%3B%3C%2FFONT%3E%3C%2FSPAN%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3Bstrcat(UserPrincipalName%2C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22%7C%22%3C%2FSPAN%3E%3CSPAN%3E%2C%20AppDisplayName)%20!in~%20(allowlistconcat)%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CEM%3ENote%3A%20the%20%22in%22%20operator%20is%20limited%20to%26nbsp%3B%201%2C000%2C000%20values.%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EIf%20you%20need%20more%2C%20use%20the%20%22join%22%20method%20described%20later.%26nbsp%3B%3C%2FEM%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-603428906%22%20id%3D%22toc-hId-603428906%22%3EUsing%20the%20lookup%20as%20a%20watch%20list%3C%2FH2%3E%0A%3CP%3ELet%E2%80%99s%20use%20the%20same%20alert%20rule%20to%20demonstrate%20a%20watch%20list.%20Login%20failures%20are%20not%20particularly%20interesting%3B%20however%2C%20there%20might%20be%20a%20few%20users%20for%20which%20we%20want%20to%20check%20each%20failure.%20Assume%20that%20those%20are%20the%20users%20for%20which%20the%20risk%20is%20higher%20in%20our%20lookup%20table.%3C%2FP%3E%0A%3CP%3ENow%20we%20need%20additional%20fields%20in%20the%20reference%20table%2C%20so%20let%E2%80%99s%20extend%20the%20mapping%20of%20the%20fields.%20By%20specifying%20the%20other%20columns%20in%20the%20source%20file%2C%20we%20make%20them%20all%20available%20for%20our%20queries%3A%3C%2FP%3E%0A%3CPRE%3Eexternaldata%20(UserPrincipalName%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Estring%3CFONT%20color%3D%22%23000000%22%3E%2C%20DisplayName%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Estring%3C%2FFONT%3E%2C%20Risk%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Eint%3C%2FFONT%3E%2C%20Location%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Edynamic%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E)%20%5Bh%3CFONT%20color%3D%22%23993300%22%3E%22https%3A%2F%2F...%22%3C%2FFONT%3E%5D%20with%20(ignoreFirstRecord%3D%3CFONT%20color%3D%22%230000FF%22%3Etrue%3C%2FFONT%3E)%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22clipboard_image_3.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F163800i44D3D6A39801B62E%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22clipboard_image_3.png%22%20alt%3D%22clipboard_image_3.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%2C%20by%20slightly%20modifying%20the%20alert%20rule%20query%20we%20implement%20our%20watch%20list%3A%3C%2FP%3E%0A%3CPRE%3Elet%20timeRange%20%3D%201d%3B%3CBR%20%2F%3E%3CSTRONG%3E%3CSPAN%20style%3D%22background-color%3A%20yellow%3B%22%3Elet%20%3CSPAN%20style%3D%22background-color%3A%20%2300fefe%3B%22%3Ewatchlist%3C%2FSPAN%3E%20%3D%20externaldata%20(UserPrincipalName%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Estring%3CFONT%20color%3D%22%23000000%22%3E%20%3CSPAN%20style%3D%22background-color%3A%20%2300ff00%3B%22%3E%2C%20DisplayName%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Estring%3C%2FFONT%3E%2C%20Risk%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Eint%3C%2FFONT%3E%2C%20Location%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Estring%3C%2FFONT%3E%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FFONT%3E)%20%5Bh%3CFONT%20color%3D%22%23993300%22%3E%22https%3A%2F%2F...%22%3C%2FFONT%3E%5D%20with%20(ignoreFirstRecord%3D%3CFONT%20color%3D%22%230000FF%22%3Etrue%3C%2FFONT%3E)%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22background-color%3A%20%23ff00ff%3B%22%3E%7C%20where%20Risk%20%26gt%3B%20%3CFONT%20color%3D%22%23339966%22%3E90%3C%2FFONT%3E%3B%3C%2FSPAN%3E%3C%2FSTRONG%3E%3CBR%20%2F%3ESigninLogs%3CBR%20%2F%3E%7C%20%3CFONT%20color%3D%22%230000FF%22%3Ewhere%3C%2FFONT%3E%20TimeGenerated%20%26gt%3B%3D%20ago(timeRange)%3CBR%20%2F%3E%E2%80%A6%3CBR%20%2F%3E%3CFONT%20color%3D%22%23339966%22%3E%2F%2F%20Exclude%20non-failure%20types%3C%2FFONT%3E%3CBR%20%2F%3E%7C%20%3CFONT%20color%3D%22%230000FF%22%3Ewhere%3C%2FFONT%3E%20ResultType%20!in%20(%3CFONT%20color%3D%22%23993300%22%3E%220%22%3C%2FFONT%3E%2C%20%3CFONT%20color%3D%22%23993300%22%3E%2250125%22%3C%2FFONT%3E%2C%20%3CFONT%20color%3D%22%23993300%22%3E%2250140%22%3C%2FFONT%3E)%3CBR%20%2F%3E%3CSTRONG%3E%3CSPAN%20style%3D%22background-color%3A%20yellow%3B%22%3E%3CFONT%20color%3D%22%23339966%22%3E%2F%2F%20%3CSPAN%20style%3D%22background-color%3A%20%2300fefe%3B%22%3EInclude%20only%20watched%3C%2FSPAN%3E%20users%3C%2FFONT%3E%3CBR%20%2F%3E%7C%20%3CFONT%20color%3D%22%230000FF%22%3Ewhere%3C%2FFONT%3E%20UserPrincipalName%20%3CSPAN%20style%3D%22background-color%3A%20%23ff00ff%3B%22%3Ein~%3C%2FSPAN%3E%20(%3CSPAN%20style%3D%22background-color%3A%20%2300fefe%3B%22%3Ewatchlist%3C%2FSPAN%3E)%3C%2FSPAN%3E%3C%2FSTRONG%3E%3CBR%20%2F%3E%E2%80%A6%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20changes%20are%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EIn%20%3CSPAN%20style%3D%22background-color%3A%20%2300ff00%3B%22%3Egreen%3C%2FSPAN%3E%2C%20As%20discussed%2C%20we%20now%20map%20all%20the%20fields%20in%20the%20reference%20file.%20Though%20we%20still%20don%E2%80%99t%20need%20the%20location%20field%2C%20it%20will%20be%20handy%20in%20the%20next%20exercise.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CLI%3EIn%20%3CSPAN%20style%3D%22background-color%3A%20%23ff00ff%3B%22%3Epink%3C%2FSPAN%3E%2C%20%26nbsp%3Bthe%20logic%20changes%3A%20first%20filtering%20the%20lookup%20table%20only%20for%20users%20with%20a%20risk%20higher%20than%2090%2C%20and%20then%20changing%20the%20selection%20criteria%20in%20the%20query%20itself%20from%20%E2%80%9C!in%E2%80%9D%20to%20%E2%80%9Cin%E2%80%9D%2C%20as%20now%20we%20want%20to%20match%20only%20on%20users%20in%20the%20list%20rather%20than%20exclude%20them.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CLI%3EIn%20%3CSPAN%20style%3D%22background-color%3A%20%2300fefe%3B%22%3Ecyan%3C%2FSPAN%3E%2C%20cosmetic%20changes%3A%20changing%20the%20lookup%20table%20name%20from%20allow-list%20to%20watchlist%20and%20updating%20the%20comments.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EYou%20may%20notice%20that%20the%20watchlist%20table%20has%204%20columns%20and%20ask%20yourself%20how%20is%20it%20used%20in%20an%20%E2%80%9Cin%E2%80%9D%20clause.%20When%20a%20table%20is%20used%20with%20the%20%E2%80%9Cin%E2%80%9D%20clause%2C%20the%20first%20column%20is%20used%2C%20which%20is%20what%20we%20need%20here.%20If%20we%20had%20liked%20to%20check%20against%20a%20different%20column%2C%20we%20could%20have%20appended%20a%20%E2%80%9C%3CSPAN%20style%3D%22background-color%3A%20yellow%3B%22%3Eproject%3C%2FSPAN%3E%E2%80%9D%20operator%20after%20the%20%E2%80%9Cwhere%20Risk%20%26gt%3B%2090%E2%80%9D%20phrase%20to%20select%20the%20field%20we%20want%20to%20match%20against%3A%3C%2FP%3E%0A%3CPRE%3Elet%20watchlist%20%3D%20externaldata%20(UserPrincipalName%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Estring%3CFONT%20color%3D%22%23000000%22%3E%2C%20DisplayName%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Estring%3C%2FFONT%3E%2C%20Risk%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Eint%3C%2FFONT%3E%2C%20Location%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Estring%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E)%20%5Bh%3CFONT%20color%3D%22%23993300%22%3E%22https%3A%2F%2F...%22%3C%2FFONT%3E%5D%20with%20(ignoreFirstRecord%3D%3CFONT%20color%3D%22%230000FF%22%3Etrue%3C%2FFONT%3E)%3CBR%20%2F%3E%7C%20%3CFONT%20color%3D%22%230000FF%22%3Ewhere%3C%2FFONT%3E%20Risk%20%26gt%3B%20%3CFONT%20color%3D%22%23339966%22%3E90%3C%2FFONT%3E%20%7C%20%3CSPAN%20style%3D%22background-color%3A%20yellow%3B%22%3E%3CFONT%20color%3D%22%230000FF%22%3Eproject%20%3C%2FFONT%3EUserPrincipalName%3C%2FSPAN%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1204025557%22%20id%3D%22toc-hId--1204025557%22%3EEnrichment%20and%20field%20extraction%3C%2FH2%3E%0A%3CP%3ELet%E2%80%99s%20look%20at%20an%20additional%20piece%20of%20information%20available%20in%20the%20lookup%20file%3A%20the%20location%20of%20the%20user.%20Another%20option%20for%20making%20the%20failed%20login%20rule%20better%20is%20to%20alert%20only%20on%20failed%20login%20attempts%20by%20users%20originating%20not%20from%20their%20home%20country.%20To%20do%20that%2C%20we%20need%20to%20enrich%20the%20failed%20login%20event%20with%20information%20about%20the%20user%E2%80%99s%20home%20country.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20requires%20two%20significant%20additions%20to%20the%20toolbox%20we%20used%20for%20allow%20lists%20and%20watch%20lists%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EThe%20country%20information%20is%20a%20part%20of%20a%20field%20value.%20We%20need%20to%20extract%20it%20to%20use%20it.%3C%2FLI%3E%0A%3CLI%3ETo%20look%20up%20a%20user%20and%20enrich%20the%20event%20with%20the%20country%20information%2C%20the%20%E2%80%9Cin%E2%80%9D%20operator%20would%20not%20do.%20We%20need%20a%20more%20versatile%20method%3A%20the%20%E2%80%9Cjoin%E2%80%9D%20operator.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--513464083%22%20id%3D%22toc-hId--513464083%22%3EExtract%20fields%3C%2FH3%3E%0A%3CP%3EExtracting%20the%20country%20code%20from%20the%20reference%20table%20is%20an%20excellent%20example%20of%20the%20versatility%20that%20externaldata%20provides.%20By%20making%20the%20reference%20file%20a%20native%20table%2C%20it%20enables%20further%20processing%20it.%3C%2FP%3E%0A%3CP%3EFor%20example%2C%20we%20can%20extract%20the%20country%20code%20from%20the%20location%20string%20using%20the%20-ERR%3AREF-NOT-FOUND-extract%20function%2C%20which%20applies%20a%20regex%20to%20the%20Location%20field%20and%20assigns%20the%20identified%20part%20to%20the%20user_country%20calculated%20field%3A%3C%2FP%3E%0A%3CPRE%3Eexternaldata%20(UserPrincipalName%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Estring%3CFONT%20color%3D%22%23000000%22%3E%2C%20DisplayName%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Estring%3C%2FFONT%3E%2C%20Risk%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Eint%3C%2FFONT%3E%2C%20Location%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Estring%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E)%20%5Bh%3CFONT%20color%3D%22%23993300%22%3E%22https%3A%2F%2F...%22%3C%2FFONT%3E%5D%20with%20(ignoreFirstRecord%3D%3CFONT%20color%3D%22%230000FF%22%3Etrue%3C%2FFONT%3E)%3CBR%20%2F%3E%3CSPAN%20style%3D%22background-color%3A%20yellow%3B%22%3E%7C%20%3CFONT%20color%3D%22%230000FF%22%3Eextend%3C%2FFONT%3E%20user_country%20%3D%20extract%20(%3CFONT%20color%3D%22%23800000%22%3E'Country%22%3A%20%22(.*)%22'%3C%2FFONT%3E%2C%20%3CFONT%20color%3D%22%23339966%22%3E1%3C%2FFONT%3E%2C%20Location)%3C%2FSPAN%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHowever%2C%20since%20the%20Location%20field%20is%20in%20JSON%20format%2C%20an%20alternative%20would%20be%20to%20use%20it%20as%20such.%20By%20changing%20the%20type%20of%20the%20Location%20field%20to%20%E2%80%9Cdynamic%E2%80%9D%2C%20we%20can%20get%20user_country%20much%20more%20directly%3A%3C%2FP%3E%0A%3CPRE%3Eexternaldata%20(UserPrincipalName%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Estring%3CFONT%20color%3D%22%23000000%22%3E%2C%20DisplayName%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20string%2C%20%3CFONT%20color%3D%22%230000FF%22%3ERisk%3C%2FFONT%3E%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20int%2C%20Location%3CFONT%20color%3D%22%23FF0000%22%3E%3A%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20style%3D%22background-color%3A%20yellow%3B%22%3Edynamic%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E)%20%5Bh%3CFONT%20color%3D%22%23993300%22%3E%22https%3A%2F%2F...%22%3C%2FFONT%3E%5D%20with%20(ignoreFirstRecord%3D%3CFONT%20color%3D%22%230000FF%22%3Etrue%3C%2FFONT%3E)%3CBR%20%2F%3E%7C%20%3CFONT%20color%3D%22%230000FF%22%3Eextend%3C%2FFONT%3E%20user_country%20%3D%20%3CSPAN%20style%3D%22background-color%3A%20yellow%3B%22%3ELocation.Country%3C%2FSPAN%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1974048750%22%20id%3D%22toc-hId-1974048750%22%3EDetection%20using%20the%20country%20value%3C%2FH3%3E%0A%3CP%3EOnce%20the%20country%20code%20is%20available%2C%20regardless%20of%20the%20method%2C%20we%20can%20apply%20it%20to%20the%20events%20for%20detection%20purposes%20using%20the%20-ERR%3AREF-NOT-FOUND-join%20operator%3A%3C%2FP%3E%0A%3CPRE%3Elet%20timeRange%20%3D%20%3CFONT%20color%3D%22%23008000%22%3E1%3C%2FFONT%3Ed%3B%3CBR%20%2F%3Elet%20userinfo%20%3D%20externaldata%3CBR%20%2F%3E%E2%80%A6%3CBR%20%2F%3Elet%20failed_singins%20%3D%20SigninLogs%3CBR%20%2F%3E%E2%80%A6%3CBR%20%2F%3E%3CSTRONG%3E%3CSPAN%20style%3D%22background-color%3A%20yellow%3B%22%3Efailed_singins%20%7C%20%3CFONT%20color%3D%22%230000FF%22%3Ejoin%3C%2FFONT%3E%20kind%3D%20inner%20(userinfo)%20%3CFONT%20color%3D%22%230000FF%22%3Eon%3C%2FFONT%3E%20UserPrincipalName%3CBR%20%2F%3E%7C%20%3CFONT%20color%3D%22%230000FF%22%3Ewhere%20%3C%2FFONT%3ELocation%20!%3D%20user_country%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20join%20statement%20works%20as%20follows%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EThe%20query%20assigns%20the%20label%20%E2%80%9Cuserinfo%E2%80%9D%20to%20the%20parsed%20reference%20table%20from%20the%20previous%20section.%3C%2FLI%3E%0A%3CLI%3EIt%20then%20labels%20the%20original%20rule%20query%20as%20%E2%80%9Cfailed_signins%E2%80%9D.%3C%2FLI%3E%0A%3CLI%3EThe%20%E2%80%9Cjoin%E2%80%9D%20operator%20than%20enriches%20the%20failed_singins%20by%20matching%20the%20relevant%20userinfo%20records%20and%20appending%20all%20its%20fields%20to%20the%20failed%20signin%20event.%3C%2FLI%3E%0A%3CLI%3ELastly%2C%20the%20%E2%80%9CLocation%E2%80%9D%20of%20the%20original%20event%20is%20compared%20to%20the%20%E2%80%9Cuser_country%E2%80%9D%20which%20is%20the%20home%20country%20of%20the%20user%20and%20was%20appended%20in%20the%20previous%20step%20and%20alert%20only%20if%20they%20are%20different.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--657651911%22%20id%3D%22toc-hId--657651911%22%3EHunting%20and%20investigation%3C%2FH2%3E%0A%3CP%3ETo%20make%20reference%20tables%20easier%20to%20use%20interactively%20by%20analysts%2C%20you%20can%20save%20the%20externaldata%20query%20as%20a%26nbsp%3B-ERR%3AREF-NOT-FOUND-function.%20This%20way%2C%20it%20can%20be%20used%20in%20any%20of%20the%20use%20cases%20above%20without%20needing%20to%20include%20the%20URL%20or%20the%20parsing%20clauses%20directly.%20So%2C%20for%20example%2C%20if%20the%20last%20externaldata%20query%20above%20is%20saved%20as%20the%20function%20%22userinfo%22%2C%20the%20%22join%22%20statement%20could%20have%20used%20userinfo%20without%20explicitly%20defining%20it%20in%20the%20query%20itself.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1829860922%22%20id%3D%22toc-hId-1829860922%22%3EAdditonal%20options%20for%20maintaining%20a%20reference%20table%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-151489178%22%20id%3D%22toc-hId-151489178%22%3EUsing%20a%20workspace%20table%20as%20a%20reference%20table%26nbsp%3B%3C%2FH3%3E%0A%3CP%3ESometimes%20is%20it%20more%20convenient%20to%20use%20a%20custom%20log%20table%20in%20the%20workspace%20as%20a%20lookup%20table.%20Any%20-ERR%3AREF-NOT-FOUND-method%20to%20ingest%20data%20to%20a%20custom%20table%20would%20work%20to%20populate%20it.%20A%20simple%20method%20is%20using%20the%20a%20PowerShell%20script%2C%20in%20this%20case%20to%20upload%20the%20exact%20same%20file%20as%20a%20custom%20table%2C%20facilitating%20the%20exact%20same%20use%20cases%20described%20above%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3EImport-Csv%20.%5Cuser_list.csv%20%7C%20Upload-AzMonitorLog.ps1%20-WorkspaceId%20'%E2%80%A6'%20-WorkspaceKey%20'%E2%80%A6'%20-LogTypeName%20'users_lookup'%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20command%20uploads%20the%20file%20to%20a%20table%20called%20user_lookup_CL%20(CL%20is%20always%20appended%20to%20custom%20log%20tables).%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThere%20are%20two%20tweaks%20to%20keep%20in%20mind%20when%20using%20a%20custom%20table%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFirst%2C%20since%20you%20cannot%20delete%20data%2C%20just%20add%20to%20it%2C%20if%20you%20want%20to%20update%20records%20in%20the%20table%2C%20you%20need%20to%20upload%20the%20records%20again%2C%20creating%20duplicates.%20KQL%20-ERR%3AREF-NOT-FOUND-arg_max%20operator%20can%20help%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Elet%20allowlist%20%3D%20users_lookup_CL%20%7C%20summarize%20arg_max%20(TimeGenerated%2C%20*)%20by%20UserName_s%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhile%20each%20user%20will%20have%20multiple%20records%2C%20the%20allow-list%20will%20will%20include%20only%20the%20last%20record%20for%20each%20user%20based%20on%20the%20timestamp.%20This%20way%2C%20the%20allow-list%20table%20is%20a%20plug-in%20replacement%20for%20the%20externaldata%20implementation%20above.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESecondly%2C%20since%20analytic%20rules%20can%20inspect%20only%20data%20from%20the%20last%2014%20days%20in%20a%20table%2C%20you%20may%20need%20to%20refresh%20the%20custom%20table%20periodically.%20The%20simplest%20solution%20to%20that%20is%20a%20scheduled%20Logic%20Apps%20workflow%20that%20will%20read%20the%20table%20and%20write%20the%20data%20back%20to%20the%20same%20table.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1655965285%22%20id%3D%22toc-hId--1655965285%22%3EUsing%20a%20KQL%20function%20with%20the%20datatable%20operator%20as%20a%20reference%20table%26nbsp%3B%3C%2FH3%3E%0A%3CP%3EAnother%20option%20is%20to%20use%20-ERR%3AREF-NOT-FOUND-KQL%20functions%26nbsp%3Butilizingn%20the%20datatable%20operator%20as%20reference%20tables.%20To%20create%20the%20same%20lookup%20used%20throughout%20this%20article%2C%20type%20in%20the%20%22Log%22%20screen%20the%20following%20query%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%3E%0A%3CPRE%3E%3CSPAN%3Elet%20Lookup%20%3D%20datatable%20(UserName%3C%2FSPAN%3E%3CSPAN%3E%3A%3C%2FSPAN%3E%3CSPAN%3Estring%3C%2FSPAN%3E%3CSPAN%3E%2CDisplayName%3C%2FSPAN%3E%3CSPAN%3E%3A%3C%2FSPAN%3E%3CSPAN%3Estring%3C%2FSPAN%3E%3CSPAN%3E%2CRisk%3C%2FSPAN%3E%3CSPAN%3E%3A%3C%2FSPAN%3E%20%3CSPAN%3Eint%3C%2FSPAN%3E%3CSPAN%3E%2CLocation%3C%2FSPAN%3E%3CSPAN%3E%3A%3C%2FSPAN%3E%3CSPAN%3Edynamic)%3CBR%20%2F%3E%3C%2FSPAN%3E%5B%3CBR%20%2F%3E%3CSPAN%3E%20%20'chris%40contoso.com'%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E'Chris%20Green'%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E70%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E'%7B%20%22City%22%3A%20%22Redmond%22%2C%20%22State%22%3A%20%22Washintgon%22%2C%20%22Country%22%3A%20%22US%22%20%7D'%3C%2FSPAN%3E%3CSPAN%3E%2C%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3E%20%20'ben%40contoso.com'%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E'Ben%20Andrews'%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E100%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E'%7B%22City%22%3A%20%22Oxford%22%2C%20%22State%22%3A%20%22Oxfordshare%22%2C%20%22Country%22%3A%20%22UK%22%20%7D'%3C%2FSPAN%3E%3CSPAN%3E%2C%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3E%20%20'nir%40contoso.com'%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E'Nir%20Cohen'%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E50%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E'%7B%20%22City%22%3A%20%22Tel-Aviv%22%2C%20%22State%22%3A%20%22%22%2C%20%22Country%22%3A%20%22IL%22%20%7D'%3C%2FSPAN%3E%3CSPAN%3E%2C%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3E%20%20'Gabriela%40contoso.com'%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E'Cynthia%20Silva'%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E20%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E'%7B%20%22City%22%3A%20%22Rio%20de%20Janeiro%22%2C%20%22State%22%3A%20%22Rio%20de%20Janeiro%22%2C%20%22Country%22%3A%20%22BR%22%20%7D'%3C%2FSPAN%3E%3CSPAN%3E%2C%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3E%20%20'melissa%40contoso.com'%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E'Chandana%26nbsp%3B%20Agarwals'%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%2C%3C%2FSPAN%3E%3CSPAN%3E100%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E'%7B%20%22City%22%3A%20%22Mumbai%22%2C%20%22State%22%3A%20%22Maharashtra%22%2C%20%22Country%22%3A%20%22IN%22%20%7D'%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3E%5D%3B%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3ELookup%3C%2FSPAN%3E%3C%2FPRE%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3EThe%20query%20uses%20a%20-ERR%3AREF-NOT-FOUND-datatable%20operator%20to%20declare%20the%20lookup%20table.%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3ESave%20it%20using%20the%20Save%20option%3A%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22save%20menu.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F199925i83D9CBE74E5B5F92%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22save%20menu.png%22%20alt%3D%22save%20menu.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3EMake%20sure%20that%20you%20use%20the%20following%20values%20in%20the%20Save%20dialog%20box%3A%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CUL%3E%0A%3CLI%3E%3CSPAN%3EChoose%20%22Save%20as%22%20function%20(2)%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%3EChoose%20in%20%22Function%20alias%22%20(3)%20the%20name%20that%20will%20be%20used%20to%20refer%20to%20the%20table%20in%20KQL.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%3EThe%20name%20and%20category%20(1%20and%204%20respectively)%20are%20less%20relevant%20and%20are%20used%20to%20specify%20the%20location%20in%20the%20query%20explorer.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22save%20dialog.png%22%20style%3D%22width%3A%20446px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F199926i6F30109855170DFC%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22save%20dialog.png%22%20alt%3D%22save%20dialog.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3EYou%20can%20also%20use%20an%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2Farg-max-aggfunction%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EAPI%3C%2FA%3E%20to%20create%20and%20update%20KQL%20stored%20functions%2C%20and%20this%20way%20automate%20lookup%20table%20management.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20the%20you%20use%20%22users_looup%22%20in%20the%20lookup%20queries%20presented%20in%20this%20article%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Elet%20allowlist%20%3D%20users_lookup%20%7C%20project%20UserName%3CBR%20%2F%3Elet%20watchlist%20%3D%20users_lookup%20%7C%20where%20Risk%20%26gt%3B%2090%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-831547548%22%20id%3D%22toc-hId-831547548%22%3EWhich%20one%20should%20I%20use%3F%3C%2FH3%3E%0A%3CP%3EWe%20presented%20three%20methods%20to%20manage%20the%20lookup%20table.%20While%20the%20actual%20use%20in%20queries%20is%20essentially%20identical%2C%20the%20methods%20differ%20in%20respect%20to%20the%20lookup%20table%20features%3A%20size%2C%20cost%2C%20performance%2C%20update%20options%20and%20security.%20The%20following%20tables%20provides%20a%20comparison%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CTABLE%20class%3D%22tg%22%3E%0A%3CTHEAD%3E%0A%3CTR%3E%0A%3CTH%20class%3D%22tg-thnp%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3EAttribute%3C%2FSPAN%3E%3C%2FTH%3E%0A%3CTH%20class%3D%22tg-t41u%22%20colspan%3D%222%22%3EKQL%20function%3C%2FTH%3E%0A%3CTH%20class%3D%22tg-t41u%22%20colspan%3D%222%22%3ECustom%20table%3C%2FTH%3E%0A%3CTH%20class%3D%22tg-t41u%22%20colspan%3D%222%22%3EExternaldata%3C%2FTH%3E%0A%3C%2FTR%3E%0A%3C%2FTHEAD%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20class%3D%22tg-fymr%22%3ETable%20size%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-q4tt%22%3ESmall%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-0pky%22%3EA%20query%2C%20including%20the%20function%2C%20is%20limited%20to%202MB.%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-5upd%22%3EVirtually%20unlimited%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-0pky%22%3E%26nbsp%3B%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-3qbk%22%3ELarge%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-0pky%22%3E%26nbsp%3B%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20class%3D%22tg-fymr%22%3ECost%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-q4tt%22%3EFree%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-0pky%22%3E%26nbsp%3B%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-5upd%22%3EHigher%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-0pky%22%3ESentinel%20(and%20Log%20Analytics)%20ingestion%20cost.%20Note%20that%20data%20might%20need%20to%20be%20periodically%20re-ingested%20to%20allow%20use%20in%20Analytic%20Rules%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-3qbk%22%3ELow%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-0pky%22%3EAzure%20Storage%20cost.%20While%20there%20is%20both%20storage%20and%20read%20cost%2C%20the%20latter%20per%20lookup%20operation%2C%20the%20total%20is%20usually%20minimal.%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20class%3D%22tg-fymr%22%3EPerformance%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-q4tt%22%3EFastest%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-0pky%22%3EIn%20memory%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-5upd%22%3EFast%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-0pky%22%3ELog%20Analytics%20tables%20are%20cached%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-3qbk%22%3ESlower%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-0pky%22%3EAdditional%20network%20latency%20and%20dependent%20on%20choice%20of%20storage%20technology%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20class%3D%22tg-fymr%22%3EAutomatic%20update%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-q4tt%22%3ESupported%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-0pky%22%3EFunction%20update%20API%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-5upd%22%3ESupported%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-0pky%22%3EThe%20Log%20Analytics%20Data%20Collector%20API%20and%20any%20custom%20connector%20option%20using%20it.%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-3qbk%22%3ESupported%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-0pky%22%3EThe%20Azure%20Storage%20API%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20class%3D%22tg-fymr%22%3EManual%20update%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-q4tt%22%3ELimited%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-0pky%22%3EBy%20editing%20in%20the%20%22log%22%20screen%20in%20Sentinel.%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-5upd%22%3ENo%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-0pky%22%3E%26nbsp%3B%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-3qbk%22%3EYes%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-0pky%22%3EBlobs%20-%20text%20editor%20in%20portalTables%20-%20table%20editor%20in%20portalFiles%20-%20Any%20desktop%20app%20using%20desktop%20sync%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20class%3D%22tg-fymr%22%3ERead%20Access%20control%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-q4tt%22%3EAny%20SOC%20user%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-0pky%22%3EAny%20SOC%20user%20can%20read%20the%20content%20of%20a%20function%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-5upd%22%3EAny%20SOC%20user%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-0pky%22%3ELookup%20information%20accessible%20to%20those%20with%20workspace%20access.%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-3qbk%22%3EAny%20SOC%20user%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-0pky%22%3EAccess%20control%20to%20the%20table%20in%20Azure%20Storage%20can%20be%20managed%20in%20detail.%20However%2C%20table%20is%20indirectly%20accessible%20to%20anyone%20with%20workspace%20access%20which%20holds%20the%20SaaS%20key.%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20class%3D%22tg-fymr%22%3EWrite%20Access%20control%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-q4tt%22%3ECan%20be%20fine%20grained%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-0pky%22%3EPermissions%20for%20updating%20a%20function%20can%20be%20granularly%20set.%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-5upd%22%3EAny%20SOC%20user%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-0pky%22%3EThe%20workspace%20ingestion%20key%20is%20needed%20to%20update%20the%20data.%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-3qbk%22%3ECan%20be%20fine%20grained%3C%2FTD%3E%0A%3CTD%20class%3D%22tg-0pky%22%3EUsing%20Azure%20Storage%20permissions%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1091306%22%20slang%3D%22en-US%22%3E%3CP%3ELearn%20how%20to%20combine%20external%20data%20sources%20as%20part%20of%20your%20queries%20in%20Sentinel%20to%20implement%20lookups%2C%20allow-lists%2C%20watchlists%20and%20enrichments.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1091306%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EQuery%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

In this blog post “Active Lists out; make_list() in”, @Ofer_Shezaf referred to one of the uses of Active Lists (ArcSight) or reference sets (QRadar), namely implementing correlation. But Active Lists, reference sets, and the appropriately named Lookups in Splunk have another important use: lookups. In this blog post, I take an initial stub at doing lookups in Azure Sentinel.

 

Azure Sentinel has a variety of methods to perform lookups, enabling diverse sources for the lookup data and different ways to process it. Overall, I think you will find that Azure Sentinel capabilities offer unparallel lookup prowess. 

 

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

 

Why lookups?

Why do you need to look up information in a SIEM query, whether hunting queries or detection rules? The top reasons are:

  • Allow-listing - making sure a query ignores known outliers that do not justify alerting on. For example, excluding a backup process from a query identifying access to large amounts of data.
  • Watch lists - in reverse, making sure that alerts with the listed entities are promoted, whether by assigning a higher severity or by alerting only on those. For example, flagging access to sensitive finance files.
  • Enrichment – extending events or alerts with additional information needed for detection or investigation. Common enrichment sources include user information, asset or resource information, geoinformation, and threat intelligence.

Those are critical capabilities of a SIEM. While each specialized security tool has a partial view of the world, a SIEM can utilize its broader outreach to enrich event and alert data and centrally manage allow-lists and watch lists.

In this blog post, I examine implementing all those use cases in Azure Sentinel.

 

Lookup data

To reference the data, we first need to locate it. The variety of use cases above implies that the data may exist in many places and accessible by different means. Azure Sentinel supports two methods for accessing lookup information:

  • Stored as files or tables in Azure Storage
  • Stored in the Sentinel workspace as a custom table, uploaded using any custom connector technique

Which one should I use? If the data is available as a file, Azure Storage is probably preferable. If ou need to create a script to process the data and prepare it, you might as well write it to the workspace.

 

Referencing an Azure Storage file using the KQL externaldata operator

To support a lookup from an external file, KQL offers the "exernaldata" operator. Unlike lookup implementation in other SIEM products, externaldata is not a lookup operator. Instead, externaldata enable using files as if they were Azure Sentinel tables, which allows pre-processing of the file before actually performing the lookup, for example filtering, parsing. I will demonstrate each in the examples below.

 

Creating the file

  • Create an Azure storage account.
  • Create a blob container. Note that by default the container is private and does not allow public access, which is probably what you want.

storage private.png

  • As an alternative to blobs, you can also use Azure Files or Azure Tables. The main difference is how you update the files:
    • Azure Files allows easy sync to a Windows computer, allowing editing of the lookup table using standard software such as Excel. 
    • Azure Tables allows table-style editing within the portal.
    • Using blobs, you can still edit using the internal Azure Blob storage editor

lookup edit.png

  • Upload to it your lookup file

In the following sections I will use the following CSV file, conveniently created in Excel:

UserName,DisplayName,Risk,Location
chris@contoso.com,Chris Green,70,"{ ""City"": ""Redmond"", ""State"": ""Washintgon"", ""Country"": ""US"" }"
ben@contoso.com,Ben Andrews,100,"{ ""City"": ""Oxford"", ""State"": ""Oxfordshare"", ""Country"": ""UK"" }"
nir@contoso.com,Nir Cohen,50,"{ ""City"": ""Tel-Aviv"", ""State"": """", ""Country"": ""IL"" }"
Gabriela@contoso.com,Cynthia Silva,20,"{ ""City"": ""Rio de Janeiro"", ""State"": ""Rio de Janeiro"", ""Country"": ""BR"" }"
melissa@contoso.com,Chandana  Agarwals ,100,"{ ""City"": ""Mumbai"", ""State"": ""Maharashtra"", ""Country"": ""IN"" }"

 

To get a secure access URL, use the “Get Shared Access Signature…” feature, which generates for you a URL similar to this one:

https://***.blob.core.windows.net/externaldata/users.csv?sp=rl&st=2019-12-23T12:49:20Z&se=2019-12-24T12:49:20Z&sv=2019-02-02&sr=b&sig=***...***

 

clipboard_image_0.png

 

Using the reference file in KQL

Since we start with a allow-list example, we need only the first column from the lookup file and can use the following KQL command to reference the file:

externaldata (UserPrincipalName: string) [h"https://..."] with (ignoreFirstRecord=true)

 

Let’s examine the query.

  • First, we defined the type for the first column in the CSV file. String in this case.
  • Next, we provided the URL. Note the “h” added in front of the string: this ensures that we don’t log the string, which includes sensitive information, to our internal audit logs. For more information on query obfuscation read here.
  • Last, we use the attribute ignoreFirstRecord=true, since the first line includes column names and is not relevant.

When you run this query, you get this:

clipboard_image_1.png

Only the first column of the file is used since we defined a type only for it.

 

The filename extension identifies the file as CSV; however, we could have overridden the type. For example, if we force “txt” as the file type, each file line is considered a single field, and the query returns in the UserName field the entire line. Other supported formats include JSON and AVRO, as well as compressed files.

 

externaldata (UserPrincipalName: string) [h"https://..."] with (ignoreFirstRecord=true, format="txt")

clipboard_image_2.png

For a full list of supported file types and other attributes, refer to this page.

 

Allow-listing users

To implement while listing, let’s take Azure Sentinel’s rules to detect Failed login attempts to Azure Portal. The modified (and abbreviated) query is below, with the modifications marked in yellow:

let timeRange = 1d;
let allowlist = externaldata (UserPrincipalName: string) [h"https://..."] with (ignoreFirstRecord=true);
SigninLogs
| where TimeGenerated >= ago(timeRange)

// Exclude non-failure types
| where ResultType !in ("0", "50125", "50140")
// Exclude allow-listed users
| where UserPrincipalName !in~ (allowlist)

The first modification defined the allow-list table using the externaldata command. Strictly speaking, you don’t have to define in advance the allow-list table, but it adds a lot to readability. The second modification checked that the UPN is not in the allow-list table. That’s all.

Wonder why the “~”; in the “not in” operator? It means that the comparison is case insensitive.

 

But what if I want to allow-list by two fields, i.e. use a table that has users and apps and allow-list the users only to specific apps. You can do that using concatenation as follows:

 

...
let allowlist ...
// -- Add the following line, assuming that allowlist included both UserPrincipalName and AppDiscplayName
let allowlistconcat = toscalar (allowlist | 
summarize make_list(strcat(UserPrincipalName, "|", AppDisplayName)));
SigninLogs
...
// -- Replace the allow-list lookup line with the following
where strcat(UserPrincipalName, "|", AppDisplayName) !in~ (allowlistconcat)

 

 

Note: the "in" operator is limited to  1,000,000 values.
If you need more, use the "join" method described later. 

 

Using the lookup as a watch list

Let’s use the same alert rule to demonstrate a watch list. Login failures are not particularly interesting; however, there might be a few users for which we want to check each failure. Assume that those are the users for which the risk is higher in our lookup table.

Now we need additional fields in the reference table, so let’s extend the mapping of the fields. By specifying the other columns in the source file, we make them all available for our queries:

externaldata (UserPrincipalName: string, DisplayName: string, Risk: int, Location: dynamic) [h"https://..."] with (ignoreFirstRecord=true)

 

clipboard_image_3.png

 

Now, by slightly modifying the alert rule query we implement our watch list:

let timeRange = 1d;
let watchlist = externaldata (UserPrincipalName: string , DisplayName: string, Risk: int, Location: string) [h"https://..."] with (ignoreFirstRecord=true)
| where Risk > 90;

SigninLogs
| where TimeGenerated >= ago(timeRange)

// Exclude non-failure types
| where ResultType !in ("0", "50125", "50140")
// Include only watched users
| where UserPrincipalName in~ (watchlist)

 

The changes are:

  • In green, As discussed, we now map all the fields in the reference file. Though we still don’t need the location field, it will be handy in the next exercise.
  • In pink,  the logic changes: first filtering the lookup table only for users with a risk higher than 90, and then changing the selection criteria in the query itself from “!in” to “in”, as now we want to match only on users in the list rather than exclude them.
  • In cyan, cosmetic changes: changing the lookup table name from allow-list to watchlist and updating the comments.

You may notice that the watchlist table has 4 columns and ask yourself how is it used in an “in” clause. When a table is used with the “in” clause, the first column is used, which is what we need here. If we had liked to check against a different column, we could have appended a “project” operator after the “where Risk > 90” phrase to select the field we want to match against:

let watchlist = externaldata (UserPrincipalName: string, DisplayName: string, Risk: int, Location: string) [h"https://..."] with (ignoreFirstRecord=true)
| where Risk > 90 | project UserPrincipalName

 

Enrichment and field extraction

Let’s look at an additional piece of information available in the lookup file: the location of the user. Another option for making the failed login rule better is to alert only on failed login attempts by users originating not from their home country. To do that, we need to enrich the failed login event with information about the user’s home country.

 

This requires two significant additions to the toolbox we used for allow lists and watch lists:

  • The country information is a part of a field value. We need to extract it to use it.
  • To look up a user and enrich the event with the country information, the “in” operator would not do. We need a more versatile method: the “join” operator.

 

Extract fields

Extracting the country code from the reference table is an excellent example of the versatility that externaldata provides. By making the reference file a native table, it enables further processing it.

For example, we can extract the country code from the location string using the extract function, which applies a regex to the Location field and assigns the identified part to the user_country calculated field:

externaldata (UserPrincipalName: string, DisplayName: string, Risk: int, Location: string) [h"https://..."] with (ignoreFirstRecord=true)
| extend user_country = extract ('Country": "(.*)"', 1, Location)

 

However, since the Location field is in JSON format, an alternative would be to use it as such. By changing the type of the Location field to “dynamic”, we can get user_country much more directly:

externaldata (UserPrincipalName: string, DisplayName: string, Risk: int, Location: dynamic) [h"https://..."] with (ignoreFirstRecord=true)
| extend user_country = Location.Country

 

Detection using the country value

Once the country code is available, regardless of the method, we can apply it to the events for detection purposes using the join operator:

let timeRange = 1d;
let userinfo = externaldata

let failed_singins = SigninLogs

failed_singins | join kind= inner (userinfo) on UserPrincipalName
| where Location != user_country

 

The join statement works as follows:

  • The query assigns the label “userinfo” to the parsed reference table from the previous section.
  • It then labels the original rule query as “failed_signins”.
  • The “join” operator than enriches the failed_singins by matching the relevant userinfo records and appending all its fields to the failed signin event.
  • Lastly, the “Location” of the original event is compared to the “user_country” which is the home country of the user and was appended in the previous step and alert only if they are different.

 

Hunting and investigation

To make reference tables easier to use interactively by analysts, you can save the externaldata query as a function. This way, it can be used in any of the use cases above without needing to include the URL or the parsing clauses directly. So, for example, if the last externaldata query above is saved as the function "userinfo", the "join" statement could have used userinfo without explicitly defining it in the query itself.

 

Additonal options for maintaining a reference table

 

Using a workspace table as a reference table 

Sometimes is it more convenient to use a custom log table in the workspace as a lookup table. Any method to ingest data to a custom table would work to populate it. A simple method is using the a PowerShell script, in this case to upload the exact same file as a custom table, facilitating the exact same use cases described above:

 

Import-Csv .\user_list.csv | Upload-AzMonitorLog.ps1 -WorkspaceId '…' -WorkspaceKey '…' -LogTypeName 'users_lookup'

 

The command uploads the file to a table called user_lookup_CL (CL is always appended to custom log tables). 

 

There are two tweaks to keep in mind when using a custom table:

 

First, since you cannot delete data, just add to it, if you want to update records in the table, you need to upload the records again, creating duplicates. KQL arg_max operator can help:

 

let allowlist = users_lookup_CL | summarize arg_max (TimeGenerated, *) by UserName_s

 

While each user will have multiple records, the allow-list will will include only the last record for each user based on the timestamp. This way, the allow-list table is a plug-in replacement for the externaldata implementation above. 

 

Secondly, since analytic rules can inspect only data from the last 14 days in a table, you may need to refresh the custom table periodically. The simplest solution to that is a scheduled Logic Apps workflow that will read the table and write the data back to the same table.

 

Using a KQL function with the datatable operator as a reference table 

Another option is to use KQL functions utilizingn the datatable operator as reference tables. To create the same lookup used throughout this article, type in the "Log" screen the following query:

 

let Lookup = datatable (UserName:string,DisplayName:string,Risk: int,Location:dynamic)
[
'chris@contoso.com','Chris Green',70,'{ "City": "Redmond", "State": "Washintgon", "Country": "US" }',
'ben@contoso.com','Ben Andrews',100,'{"City": "Oxford", "State": "Oxfordshare", "Country": "UK" }',
'nir@contoso.com','Nir Cohen',50,'{ "City": "Tel-Aviv", "State": "", "Country": "IL" }',
'Gabriela@contoso.com','Cynthia Silva',20,'{ "City": "Rio de Janeiro", "State": "Rio de Janeiro", "Country": "BR" }',
'melissa@contoso.com','Chandana  Agarwals' ,100,'{ "City": "Mumbai", "State": "Maharashtra", "Country": "IN" }'
];
Lookup
 
The query uses a datatable operator to declare the lookup table.
 
Save it using the Save option:
 
save menu.png
 
Make sure that you use the following values in the Save dialog box:
  • Choose "Save as" function (2)
  • Choose in "Function alias" (3) the name that will be used to refer to the table in KQL.
  • The name and category (1 and 4 respectively) are less relevant and are used to specify the location in the query explorer.
 
save dialog.png

You can also use an API to create and update KQL stored functions, and this way automate lookup table management. 

 

Now the you use "users_looup" in the lookup queries presented in this article:

 

let allowlist = users_lookup | project UserName
let watchlist = users_lookup | where Risk > 90

 

Which one should I use?

We presented three methods to manage the lookup table. While the actual use in queries is essentially identical, the methods differ in respect to the lookup table features: size, cost, performance, update options and security. The following tables provides a comparison:

 

Attribute KQL function Custom table Externaldata
Table size Small A query, including the function, is limited to 2MB. Virtually unlimited   Large  
Cost Free   Higher Sentinel (and Log Analytics) ingestion cost. Note that data might need to be periodically re-ingested to allow use in Analytic Rules Low Azure Storage cost. While there is both storage and read cost, the latter per lookup operation, the total is usually minimal.
Performance Fastest In memory Fast Log Analytics tables are cached Slower Additional network latency and dependent on choice of storage technology
Automatic update Supported Function update API Supported The Log Analytics Data Collector API and any custom connector option using it. Supported The Azure Storage API
Manual update Limited By editing in the "log" screen in Sentinel. No   Yes Blobs - text editor in portalTables - table editor in portalFiles - Any desktop app using desktop sync
Read Access control Any SOC user Any SOC user can read the content of a function Any SOC user Lookup information accessible to those with workspace access. Any SOC user Access control to the table in Azure Storage can be managed in detail. However, table is indirectly accessible to anyone with workspace access which holds the SaaS key.
Write Access control Can be fine grained Permissions for updating a function can be granularly set. Any SOC user The workspace ingestion key is needed to update the data. Can be fine grained Using Azure Storage permissions
19 Comments
Super Contributor

Looks like a word or two may have been left out this this sentence(s)

"Next, we provided the URL. in front of the string: this ensures that we don’t log the string"

Microsoft

Thanks, for noticing, updated

Occasional Contributor

@nirgafni this article is really helpful and the presentation is crystal clear. Thanks for making it.

 

@Gary Bushey thanks for sharing this link.

Occasional Contributor

@nirgafni i have tested this scenario. Here are my findings.

 

1. obfuscation is not working even i used h or H.

2. Storage account i.e blob is only accessible if i use allow access from All Networks option. # im looking if we can only allow connection from log analytics workspace.

3. In my case i need access to blob for more time. Because my correlation rule fetch data every time from blob whenever it runs. # so i tried to using the Blob service SAS URL. But its not working. i compared the GET SAS n Blob service SAS URL both are different. In Blob service SAS URL container and blob is not available. I think that's the reason its not working.

 

Can you, please suggest on this?

Microsoft

Hi @Pavan_Gelli1910 

  1. The obfuscation reflects in our logs, and you won't see anything on your side, see details here
  2. Unfortunately, currently there is no such option
  3.  Not sure I follow the issue, will continue in private

Thanks for reading and testing

Occasional Contributor

Hi @nirgafni 

 

Thanks for your response.

 

I did some testing and now Im able to use shared access signature with longer duration. 

Contributor

Hi @nirgafni ,

 

Can we import IOCs from an excel file in a local computer with creating a BLOB object?

 

Regards,

Mitesh Agrawal

Occasional Contributor

Is there some way to output results from a query to a blob object that can then be accessed from subsequent queries as above?

Occasional Contributor

How can we authenticate to an HTTP server using externaldata function ? For example, an HTTP server that requires NTLM or Basic Authentication.

@nirgafni @Ofer_Shezaf 

Microsoft

@majo1 : externaldata works the best with Azure storage signatures as described in the post. As hack, you can create an azure function or a Logic App that serves as a webhook, accepting a single HTTPS request and issuing multiple ones. It is important to note that this is a hack, we don't have a lot of experience with it and may not work in the future.

New Contributor

hi, @nirgafni 

Great post.

Is this post out, "I will show you how to implement these use cases for reference tables, which are not available as files."

Microsoft

Hi @Joseph-Abraham : we have now updated the post to include this as well. See "Using a workspace table as a reference table" above.

Occasional Visitor

Hi nirgafni,

 

I tried using lookups for watchlist of particular users.. I uploaded the users list in the blob container generated the sas url and used it in the query which you provided for watchlist,but I'm not able to fetch the results.Can you please help me fix this.

Occasional Visitor

Hi nirgafni,

 

I was able to achieve results for the above concern, but there is one more issue I need help on .
"When I try to use externaldata operator it displays the data of first and second columns irrespective of the column names. For example :

AlternateSignInName,DisplayName,Location

xyz@abc.com, XYZ, IN

from the above data if I use externaldata operator to fetch details in 2nd and 3rd columns (i.e Displayname and Location) it displays the results as below:

DisplayName,Location

xyz@abc.com, XYZ

It is taking the data of 1st and 2nd columns irrespective of the required column names.

Could you please let me know why is it this way?

Microsoft

Hi @sindhu173 :  This is the expected behavior. The CSV header field names are not relevant. You always read the first fields in each row and name them based on the externaldata definition.

Established Member

I have 2 columns in my datatable both are string values. I need to whitelist both the column name values in my query. If I have one column in mydatable, I am able to use "| where mycolumn !in~(mydatable)" but how to whitelist both column name values which occur in a single row. If the column name values doesn't occur in the same row, I would like to see them. Thanks in advance.

Microsoft

@raviannangi :

 

You can either:

1. Use the join operator described above.

 

2. Use the "!in~" or concatenated values like this:

let list = toscalar (mydatable | summarize make_list(strcat (col1, "|", col2))); 
....
| where strcat (col1, "|", col2) !in~ (list) 

 

Established Member

@Ofer_Shezaf 

Hi Ofer,

Thanks for your quick response. I tried this, it didn't give me expected result. I think I should explain in a better way. 

Below is my query sample:

 

let WhiteList = datatable (WorkstationName:string, TargetUserName:string)
[
'x','a'
, 'y', 'b'
,'z','c'
];
SecurityEvent
| where AccountType =~"User" and EventID == 4625
....
....
//If a TargetUserName lets say 'a' logons on to a WorkstationName lets say 'x' and even has a failure count, I would ignore. Same for the rest of the created datatable "WhiteList". 
 
Please provide your valuable inputs :)
Microsoft

This should pull the trick

 

let allowlist = datatable (WorkstationName:string, TargetUserName:string)
[
  'x','a'
  ,'y', 'b'
  ,'z','c'
];
let allowlistconcat = toscalar (allowlist | summarize make_list(strcat(WorkstationName, "|", TargetUserName)));
SecurityEvent
| where AccountType =~"User" and EventID == 4625
| where strcat(Computer, "|", Account) !in~ (allowlistconcat)