%3CLINGO-SUB%20id%3D%22lingo-sub-1450345%22%20slang%3D%22en-US%22%3EUsing%20external%20data%20sources%20to%20enrich%20network%20logs%20using%20Azure%20storage%20and%20KQL%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1450345%22%20slang%3D%22en-US%22%3E%3CP%3ENetwork%20data%20sources%20are%20one%20of%20the%20highest%20volume%20data%20sources%20hence%20threat%20hunting%20on%20such%20data%20sources%20becomes%20often%20challenging%20if%20we%20do%20not%20enrich%20such%20datasets.%20One%20of%20the%20common%20first%20steps%20done%20is%20matching%20against%20Threat%20Intel%20feeds.%20Apart%20from%20that%2C%20public%20ip%20addresses%20are%20difficult%20to%20investigate%20at%20scale%20unless%20we%20populate%20additional%20context%20around%20it%20or%20correlate%20with%20other%20data%20sources.%3C%2FP%3E%0A%3CP%3EOne%20of%20the%20common%20use-case%20request%20we%20have%20received%20from%20customers%20is%20tagging%20Azure%20Data%20Center%20ip%20Addresses%20in%20network%20telemetry%20so%20they%20can%20filter%20it%20out%20and%20focus%20on%20other%20telemetry%20to%20find%20suspicious%20traffic.%3C%2FP%3E%0A%3CP%3EIn%20this%20blog%2C%20we%20will%20show%20a%20custom%20solution%20to%20create%20reference%20lookup%20tables%20of%20such%20data%20sources%20in%20blob%20storage%20and%20call%20within%20KQL%20queries%20using%20native%20operators.%20Ofer%20has%20done%20a%20blog-post%20on%20%3CA%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%20which%20you%20can%20reference%20if%20you%20are%20new%20to%20lookup%20tables.%20Also%2C%20thanks%20to%20Dennis%20Pike%20from%20CyberSecurity%20Solutions%20Group%20who%20contributed%20with%20compiling%20Single%20data%20source%20KQL%20query.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ENote%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-align-left%22%3E%3CEM%3EMicrosoft%20do%20not%20recommend%20filtering%20or%20using%20these%20ranges%20as%20Allowed%20List%20for%20detections.%20Any%20such%20filtering%20needs%20to%20be%20reviewed%20and%20implemented%20with%20care%20so%20it%20does%20not%20introduce%20any%20blind%20spots%20in%20your%20security%20monitoring.%20However%2C%20these%20datasets%20can%20be%20used%20to%20enrich%20existing%20data%20sources%2C%20provide%20more%20context%20and%20to%20segregate%20or%20categorize%20the%20large%20portion%20of%20the%20network%20traffic%20for%20analysts%2Fthreat%20hunters%26nbsp%3B%3C%2FEM%3E%3CEM%3Ewhile%20hunting%20or%20investigating%20large%20data%20sets.%3C%2FEM%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-align-left%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1325957443%22%20id%3D%22toc-hId--1325957443%22%3EIdentification%20of%20Reliable%20Data%20sources%3A%3C%2FH2%3E%0A%3CP%3EMicrosoft%20and%20other%20vendors%20publish%20various%20network%20data%20sources%20which%20are%20updated%20regularly%20(sometimes%20weekly).%20These%20datasets%20can%20be%20used%20to%20enrich%20the%20existing%20network%20data%20sources.%20The%20datasets%20can%20be%20downloaded%20via%20public%20links%20and%20can%20be%20directly%20called%20via%20%3CEM%3Eexternaldata%3C%2FEM%3E%20operator%20if%20download%20links%20are%20static.%20These%20can%20be%20extended%20to%20Threat%20Intel%20feeds%20such%20as%20-ERR%3AREF-NOT-FOUND-COVID-19%20indicators.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EMSFT%20Public%20ips%20%3A%20-ERR%3AREF-NOT-FOUND-%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fdownload%2Fdetails.aspx%3Fid%3D53602%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.microsoft.com%2Fdownload%2Fdetails.aspx%3Fid%3D53602%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EAzure%20IP%20Ranges%20and%20Service%20Tags%20%E2%80%93%20Public%20Cloud%20%3A%20-ERR%3AREF-NOT-FOUND-%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D56519%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D56519%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EOffice%20Endpoints%20Worldwide%3A%20-ERR%3AREF-NOT-FOUND-%3CA%20href%3D%22https%3A%2F%2Fendpoints.office.com%2Fendpoints%2Fworldwide%3Fclientrequestid%3Db10c5ed1-bad1-445f-b386-b919946339a7%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fendpoints.office.com%2Fendpoints%2Fworldwide%3Fclientrequestid%3Db10c5ed1-bad1-445f-b386-b919946339a7%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EAzure%20IP%20Ranges%20and%20Service%20Tags%20%E2%80%93%20US%20Government%20Cloud%20%3A%20-ERR%3AREF-NOT-FOUND-%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D57063%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D57063%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EAzure%20China%20%3A%20-ERR%3AREF-NOT-FOUND-%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fdownload%2Fdetails.aspx%3Fid%3D57062%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.microsoft.com%2Fdownload%2Fdetails.aspx%3Fid%3D57062%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EAzure%20Germany%20%3A%20-ERR%3AREF-NOT-FOUND-%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fdownload%2Fdetails.aspx%3Fid%3D57064%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.microsoft.com%2Fdownload%2Fdetails.aspx%3Fid%3D57064%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EAWS%20IP%20Ranges%3A%20-ERR%3AREF-NOT-FOUND-%3CA%20href%3D%22https%3A%2F%2Fip-ranges.amazonaws.com%2Fip-ranges.json%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fip-ranges.amazonaws.com%2Fip-ranges.json%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3ECOVID-19%20Indicators%20%3A%26nbsp%3B-ERR%3AREF-NOT-FOUND-%3CA%20href%3D%22https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2FAzure-Sentinel%2Fmaster%2FSample%2520Data%2FFeeds%2FMicrosoft.Covid19.Indicators.json%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fraw.githubusercontent.com%2FAzure%2FAzure-Sentinel%2Fmaster%2FSample%2520Data%2FFeeds%2FMicrosoft.Covid19.Indicators.json%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH2%20id%3D%22toc-hId-1161555390%22%20id%3D%22toc-hId-1161555390%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId--645899073%22%20id%3D%22toc-hId--645899073%22%3EDownload%20and%20ingest%20datasets%3A%3C%2FH2%3E%0A%3CP%3EThe%20datasets%20may%20not%20be%20always%20available%20as%20static%20links%20depending%20upon%20how%20they%20are%20being%20published.%20Also%20for%20certain%20feeds%2C%20the%20download%20url%20has%20date%20appended%20which%20is%20dynamic%20and%20can%20not%20be%20called%20with%20scheduled%20queries%20unless%20normalized%20on%20external%20storage.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ee.g.%20For%20AzureDataCenter%20IP%20Ranges%20%E2%80%93%20Cloud.%3C%2FP%3E%0A%3CP%3EDownload%20Page%3A%20%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D56519%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D56519%3C%2FA%3E%26nbsp%3B%26nbsp%3Bwhich%20has%20download%20button%20linking%20to%20%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fconfirmation.aspx%3Fid%3D56519%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fconfirmation.aspx%3Fid%3D56519%3C%2FA%3E%3C%2FSPAN%3E%20When%20this%20link%20is%20visited%20from%20browser%2C%20it%20automatically%20redirects%20to%20the%20relevant%20URL%20with%20json%20behind%20the%20scenes%20and%20auto-downloads.%3C%2FP%3E%0A%3CP%3EHowever%2C%20this%20direct%20download%20link%20is%20not%20static%20and%20may%20change%20its%20location%20or%20date%20depending%20on%20when%20its%20updated%20and%20available%20to%20download.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B-ERR%3AREF-NOT-FOUND-%3CA%20href%3D%22https%3A%2F%2Fdownload.microsoft.com%2Fdownload%2F7%2F1%2FD%2F71D86715-5596-4529-9B13-DA13A5DE5B63%2FServiceTags_Public_20200601.json%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdownload.microsoft.com%2Fdownload%2F7%2F1%2FD%2F71D86715-5596-4529-9B13-DA13A5DE5B63%2FServiceTags_Public_20200601.json%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20find%20the%20actual%20download%20link%20programmatically%2C%20you%20can%20request%20HTML%20response%20for%20the%20download%20link%20and%20find%20href%20links%20ending%20with%20json.%26nbsp%3B%20Below%20is%20an%20example%20PowerShell%20console%20from%20windows%20Terminal%20to%20parse%20a%20HTML%20response%20of%20the%20original%20download%20links%20and%20retrieve%20direct%20download%20link%20to%20the%20json.%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%22terminal.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%2F197496iD2A1FCE9398AFBEB%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22terminal.png%22%20alt%3D%22terminal.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22tinyMceEditorAshwin_Patil_2%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3EFor%20working%20with%20static%20URLs%2C%20you%20can%20also%20directly%20use%20Azure%20playbooks%20which%20provides%20friendly%20UI%20and%20step%20by%20step%20process%20to%20ingest%20in%20AzureSentinel.%20You%20can%20check%20recent%20blogpost%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-sentinel%2Fusing-azure-playbooks-to-import-text-based-threat-indicators-to%2Fba-p%2F1383980%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EUsing%20Azure%20Playbooks%20to%20import%20text-based%20threat%20indicators%20to%20Azure%20Sentinel%3C%2FA%3E%26nbsp%3Bfor%20more%20details.%20For%20complex%20use-cases%20where%20download%20link%20is%20not%20static%2C%20we%20can%20automate%20this%20via%20a%20serverless%20Azure%20Function%20and%20PowerShell%20to%20store%20this%20data%20directly%20in%20Azure%20blob%20storage.%20Once%20these%20files%20are%20stored%20in%20blob%20storage%2C%20you%20can%20generate%20a%20read%20only%20shared%20access%20link%20in%20order%20to%20use%20within%20KQL%20queries.%20You%20can%20also%20ingest%20these%20directly%20in%20Sentinel%20as%20custom%20log%20table%20however%20dataset%20is%20very%20tiny%20so%20we%20will%20cover%20blob%20storage%20method%20in%20this%20article.%20For%20examples%20ingestion%20instructions%2C%20check%20the%20json%20ingestion%20tools%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2FAzure-Sentinel%2Ftree%2Fmaster%2FDataConnectors%2FJSON-Import%2Fdotnet_loganalytics_json_import%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Edotnet_loganalytics_json_import%3C%2FA%3E%20%26nbsp%3B%2C%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FCyb3rWard0g%2Fazure-loganalytics-api-clients%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Log%20Analytics%20API%20Clients%3C%2FA%3E%20.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1841613760%22%20id%3D%22toc-hId-1841613760%22%3EArchitecture%20Diagram%3A%3C%2FH2%3E%0A%3CP%3EThe%20below%20diagram%20explains%20the%20data%20workflow%20for%20our%20use-case.%20We%20will%20feed%20multiple%20URLs%20containing%20the%20datasets%20you%20want%20to%20use%20as%20reference%20tables.%20In%20the%20below%20example%2C%20we%20are%20using%204%20such%20datasets.%20These%20will%20be%20processed%20via%20our%20Azure%20Function%20which%20will%20parse%20URLs%20to%20find%20direct%20download%20links%20if%20required%20and%20upload%20to%20blob%20storage.%26nbsp%3B%20Once%20these%20files%20are%20uploaded%20to%20blob%20storage%2C%20you%20can%20generate%20read%20only%20shared%20access%20links%20to%20access%20via%20native%20KQL%20operators%20such%20as%20-ERR%3AREF-NOT-FOUND-externaldata.%20We%20will%20also%20see%20how%20to%20use%20these%20operators%20in%20queries%20later%20part%20of%20the%20article.%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-center%22%20image-alt%3D%22function-architecture-01.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%2F198778i5AE3B94C88E60CA6%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22function-architecture-01.png%22%20alt%3D%22function-architecture-01.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-34159297%22%20id%3D%22toc-hId-34159297%22%3EWhen%20to%20use%20the%20Architecture%3A%3C%2FH2%3E%0A%3CP%3EBelow%20are%20certain%20scenarios%20when%20you%20can%20consider%20deploying%20this%20into%20your%20environment.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ECentralized%20Lookup%20tables%20with%20normalized%20filenames%20to%20call%20in%20the%20scheduled%20KQL%20queries%20in%20Sentinel.%3C%2FLI%3E%0A%3CLI%3EWhen%20direct%20URL%20to%20download%20the%20file%20is%20not%20available%20and%20need%20normalization%20to%20use%20within%20queries.%3C%2FLI%3E%0A%3CLI%3EWhen%20you%20cannot%20use%20externaldata%20operator%20from%20KQL%20queries%20to%20access%20public%20sites%20directly%20but%20can%20reach%20to%20Azure%20storage%20domain.%20(blob.core.windows.net).%3C%2FLI%3E%0A%3CLI%3EWhen%20you%20need%20to%20store%20and%20access%20current%20or%20archived%20versions%20reliably%20when%20original%20source%20is%20not%20available.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH2%20id%3D%22toc-hId--1773295166%22%20id%3D%22toc-hId--1773295166%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId-714217667%22%20id%3D%22toc-hId-714217667%22%3EDeploy%20the%20function%3A%3C%2FH2%3E%0A%3CP%3EYou%20can%20deploy%20the%20function%20via%20two%20ways%20either%20through%20VS%20Code%20or%20directly%20via%20ARM%20template.%3C%2FP%3E%0A%3CP%3EDetailed%20instructions%20with%20both%20methods%20can%20be%20found%20on%20GitHub%20%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2FAzure-Sentinel%2Fblob%2Fmaster%2FTools%2FUploadToBlobLookupTables%2Freadme.md%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FAzure%2FAzure-Sentinel%2Fblob%2Fmaster%2FTools%2FUploadToBlobLookupTables%2Freadme.md%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1093236796%22%20id%3D%22toc-hId--1093236796%22%3EGenerating%20Shared%20Access%20Links%20from%20Azure%20Blob%20Storage%3A%3C%2FH2%3E%0A%3CP%3EIn%20order%20to%20access%20blob%20storage%20links%2C%20you%20can%20generate%20pre-approved%20shared%20access%20links%20with%20read-only%20permissions.%3C%2FP%3E%0A%3CP%3EYou%20can%20follow%20the%20tutorial%20%E2%80%93%20-ERR%3AREF-NOT-FOUND-Get%20SAS%20for%20a%20blob%20Container%20to%20generate%20links%20for%20each%20blob%20files.%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EStep%20-1%20%3A%3C%2FSTRONG%3E%20Get%20Shared%20Access%20Signature%20for%20the%20respective%20File%20in%20blob%20storage.%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%22Storageexplorer-SAS-01.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%2F197498i86B0258AC3B11F79%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Storageexplorer-SAS-01.png%22%20alt%3D%22Storageexplorer-SAS-01.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EStep-2%3A%3C%2FSTRONG%3E%20Set%20desired%20expiry%20period%20and%20Permissions%20as%20Read.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Storageexplorer-SAS-02.png%22%20style%3D%22width%3A%20488px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F197499i148F5AEBE782FF67%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Storageexplorer-SAS-02.png%22%20alt%3D%22Storageexplorer-SAS-02.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EStep%203%3A%3C%2FSTRONG%3E%20Copy%20the%20link%20from%20the%20last%20screen.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Storageexplorer-SAS-03.png%22%20style%3D%22width%3A%20587px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F197500i614C736DE5A9FB0B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Storageexplorer-SAS-03.png%22%20alt%3D%22Storageexplorer-SAS-03.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1394276037%22%20id%3D%22toc-hId-1394276037%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId--413178426%22%20id%3D%22toc-hId--413178426%22%3EKQL%20query%20with%20externaldata%20for%20Azure%20IP%20Ranges%3A%3C%2FH2%3E%0A%3CP%3EThis%20query%20gives%20us%20around%205k%20subnet%20ranges.%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EKQL%20%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CPRE%20style%3D%22font%3A%2010pt%20consolas%3B%22%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Elet%3C%2FSPAN%3E%20%3CFONT%20color%3D%22%23000000%22%3E%3CSPAN%20class%3D%22csl-let-variable%22%3EAzureIPRangesPublicCloud%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FFONT%3E%20%3D%20(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Eexternaldata%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-column%22%3EchangeNumber%3C%2FSPAN%3E%3CFONT%20color%3D%22%230000FF%22%3E%3Astring%3C%2FFONT%3E%2C%3CSPAN%20class%3D%22csl-column%22%3Ecloud%3C%2FSPAN%3E%3CFONT%20color%3D%22%230000FF%22%3E%3Astring%3C%2FFONT%3E%2C%20%3CSPAN%20class%3D%22csl-column%22%3Evalues%3C%2FSPAN%3E%3CFONT%20color%3D%22%230000FF%22%3E%3A%20dynamic%3C%2FFONT%3E)%0A%5B%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%40%22https%3A%2F%2Fuploadtobloblookuptables.blob.core.windows.net%2Flookuptables%2FServiceTags_Public.json%3Fsv%3D2019-02-02%26amp%3Bst%3D2020-06-08T17%253A21%253A23Z%26amp%3Bse%3D2020-06-09T17%253A21%253A23Z%26amp%3Bsr%3Db%26amp%3Bsp%3Dr%26amp%3Bsig%3DzTATanBOqaDbi2NAQirIMWRJmees2z0CQexk4XQiTb0%253D%22%3C%2FSPAN%3E%3C%2FFONT%3E%5D%3CBR%20%2F%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Ewith%3C%2FSPAN%3E%3C%2FFONT%3E%20(%3CFONT%20color%3D%22%2300CCFF%22%3E%3CSPAN%20class%3D%22csl-query-parameter%22%3Eformat%3C%2FSPAN%3E%3C%2FFONT%3E%3D%3CSPAN%20class%3D%22csl-string-literal%22%3E%22multijson%22%3C%2FSPAN%3E))%3B%0A%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Elet%3C%2FSPAN%3E%3C%2FFONT%3E%20%3CSPAN%20class%3D%22csl-let-variable%22%3EAzureSubnetRangelist%3C%2FSPAN%3E%20%3D%20%3CSPAN%20class%3D%22csl-let-variable%22%3EAzureIPRangesPublicCloud%3C%2FSPAN%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Emvexpand%3C%2FSPAN%3E%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3Evalues%3C%2FSPAN%3E%3C%2FFONT%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Eextend%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3Eplatform%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eparse_json%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eparse_json%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-column%22%3Evalues%3C%2FSPAN%3E).%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eproperties%3C%2FSPAN%3E%3C%2FFONT%3E).%3CSPAN%20class%3D%22csl-calculated-column%22%3Eplatform%3C%2FSPAN%3E%2C%20%0A%20%20%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3Esystemservice%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eparse_json%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eparse_json%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-column%22%3Evalues%3C%2FSPAN%3E).%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eproperties%3C%2FSPAN%3E%3C%2FFONT%3E).%3CSPAN%20class%3D%22csl-calculated-column%22%3EsystemService%3C%2FSPAN%3E%2C%0A%20%20%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3Eregion%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eparse_json%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eparse_json%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-column%22%3Evalues%3C%2FSPAN%3E).%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eproperties%3C%2FSPAN%3E%3C%2FFONT%3E).%3CSPAN%20class%3D%22csl-calculated-column%22%3Eregion%3C%2FSPAN%3E%2C%20%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EaddressPrefixes%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eparse_json%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eparse_json%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-column%22%3Evalues%3C%2FSPAN%3E).%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eproperties%3C%2FSPAN%3E%3C%2FFONT%3E).%3CSPAN%20class%3D%22csl-calculated-column%22%3EaddressPrefixes%3C%2FSPAN%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Emvexpand%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EaddressPrefixes%3C%2FSPAN%3E%3C%2FFONT%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Eproject%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3Eplatform%3C%2FSPAN%3E%2C%20%3CSPAN%20class%3D%22csl-column%22%3Esystemservice%3C%2FSPAN%3E%2C%20%3CSPAN%20class%3D%22csl-column%22%3Eregion%3C%2FSPAN%3E%2C%20%3CSPAN%20class%3D%22csl-column%22%3EaddressPrefixes%3C%2FSPAN%3E%3C%2FFONT%3E%3B%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ESample%20Output%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EThe%20above%20query%20result%20into%20around%205K%20subnets%20with%20contexts%20such%20as%20platform%2C%20region%20and%20systemservice%20associated%20with%20it.%20You%20can%20selectively%20pickup%20from%20this%20lookup%20table%20depending%20on%20how%20your%20azure%20infrastructure.%20For%20this%20blog%2C%20we%20are%20going%20to%20use%20this%20table%20as%20it%20is.%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-center%22%20image-alt%3D%22LookupTable.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%2F198774iFCE30CF9D244BC43%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22LookupTable.PNG%22%20alt%3D%22LookupTable.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--546863150%22%20id%3D%22toc-hId--546863150%22%3EKQL%20Query%20for%20filtering%20using%20Lookup%20for%20single%20datasource%3A%3C%2FH2%3E%0A%3CP%3EKQL%20Query%20using%26nbsp%3B%20single%20data%20source%20to%20do%20subnet%20matching%20and%20filter%20on%20target%2Fsource%20IP%20ranges%3A%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EDatasource%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EAzureNetworkAnalytics_CL%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CPRE%20style%3D%22font%3A%2010pt%20consolas%3B%22%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Elet%3C%2FSPAN%3E%20%3CFONT%20color%3D%22%23000000%22%3E%3CSPAN%20class%3D%22csl-let-variable%22%3EAzureIPRangesPublicCloud%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FFONT%3E%20%3D%20(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Eexternaldata%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-column%22%3EchangeNumber%3C%2FSPAN%3E%3CFONT%20color%3D%22%230000FF%22%3E%3Astring%3C%2FFONT%3E%2C%3CSPAN%20class%3D%22csl-column%22%3Ecloud%3C%2FSPAN%3E%3CFONT%20color%3D%22%230000FF%22%3E%3Astring%3C%2FFONT%3E%2C%20%3CSPAN%20class%3D%22csl-column%22%3Evalues%3C%2FSPAN%3E%3CFONT%20color%3D%22%230000FF%22%3E%3A%20dynamic%3C%2FFONT%3E)%20%3CBR%20%2F%3E%5B%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%40%22https%3A%2F%2Fuploadtobloblookuptables.blob.core.windows.net%2Flookuptables%2FServiceTags_Public.json%3Fsv%3D2019-02-02%26amp%3Bst%3D2020-06-08T17%253A21%253A23Z%26amp%3Bse%3D2020-06-09T17%253A21%253A23Z%26amp%3Bsr%3Db%26amp%3Bsp%3Dr%26amp%3Bsig%3DzTATanBOqaDbi2NAQirIMWRJmees2z0CQexk4XQiTb0%253D%22%3C%2FSPAN%3E%3C%2FFONT%3E%5D%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Ewith%3C%2FSPAN%3E%3C%2FFONT%3E%20(%3CFONT%20color%3D%22%2300CCFF%22%3E%3CSPAN%20class%3D%22csl-query-parameter%22%3Eformat%3C%2FSPAN%3E%3C%2FFONT%3E%3D%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%22multijson%22%3C%2FSPAN%3E%3C%2FFONT%3E))%3B%3CBR%20%2F%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Elet%3C%2FSPAN%3E%3C%2FFONT%3E%20%3CSPAN%20class%3D%22csl-let-variable%22%3EAzureSubnetRangelist%3C%2FSPAN%3E%20%3D%20%3CSPAN%20class%3D%22csl-let-variable%22%3EAzureIPRangesPublicCloud%3C%2FSPAN%3E%20%3CBR%20%2F%3E%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Emvexpand%3C%2FSPAN%3E%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3Evalues%3C%2FSPAN%3E%3C%2FFONT%3E%20%3CBR%20%2F%3E%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Eextend%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3Eplatform%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eparse_json%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eparse_json%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-column%22%3Evalues%3C%2FSPAN%3E).%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eproperties%3C%2FSPAN%3E%3C%2FFONT%3E).%3CSPAN%20class%3D%22csl-calculated-column%22%3Eplatform%3C%2FSPAN%3E%2C%20%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3Esystemservice%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eparse_json%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eparse_json%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-column%22%3Evalues%3C%2FSPAN%3E).%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eproperties%3C%2FSPAN%3E%3C%2FFONT%3E).%3CSPAN%20class%3D%22csl-calculated-column%22%3EsystemService%3C%2FSPAN%3E%2C%20%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3Eregion%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eparse_json%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eparse_json%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-column%22%3Evalues%3C%2FSPAN%3E).%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eproperties%3C%2FSPAN%3E%3C%2FFONT%3E).%3CSPAN%20class%3D%22csl-calculated-column%22%3Eregion%3C%2FSPAN%3E%2C%20%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EaddressPrefixes%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eparse_json%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eparse_json%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-column%22%3Evalues%3C%2FSPAN%3E).%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eproperties%3C%2FSPAN%3E%3C%2FFONT%3E).%3CSPAN%20class%3D%22csl-calculated-column%22%3EaddressPrefixes%3C%2FSPAN%3E%20%3CBR%20%2F%3E%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Emvexpand%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EaddressPrefixes%3C%2FSPAN%3E%3C%2FFONT%3E%20%3CBR%20%2F%3E%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Eproject%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3Eplatform%3C%2FSPAN%3E%2C%20%3CSPAN%20class%3D%22csl-column%22%3Esystemservice%3C%2FSPAN%3E%2C%20%3CSPAN%20class%3D%22csl-column%22%3Eregion%3C%2FSPAN%3E%2C%20%3CSPAN%20class%3D%22csl-column%22%3EaddressPrefixes%3C%2FSPAN%3E%3C%2FFONT%3E%3B%20%0A%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Elet%3C%2FSPAN%3E%3C%2FFONT%3E%20%3CSPAN%20class%3D%22csl-let-variable%22%3Elookup%3C%2FSPAN%3E%20%3D%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Etoscalar%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-let-variable%22%3EAzureSubnetRangelist%3C%2FSPAN%3E%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Esummarize%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CSPAN%20class%3D%22csl-column%22%3El%3C%2FSPAN%3E%3D%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Emake_list%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-column%22%3EaddressPrefixes%3C%2FSPAN%3E))%3B%0A%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Elet%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CSPAN%20class%3D%22csl-let-variable%22%3Estarttime%3C%2FSPAN%3E%20%3D%201d%3B%0A%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Elet%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CSPAN%20class%3D%22csl-let-variable%22%3Eendtime%3C%2FSPAN%3E%20%3D%201h%3B%0A%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Elet%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CSPAN%20class%3D%22csl-let-variable%22%3EPrivateIPregex%3C%2FSPAN%3E%20%3D%20%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%40'%5E127%5C.%7C%5E10%5C.%7C%5E172%5C.1%5B6-9%5D%5C.%7C%5E172%5C.2%5B0-9%5D%5C.%7C%5E172%5C.3%5B0-1%5D%5C.%7C%5E192%5C.168%5C.'%3C%2FSPAN%3E%3C%2FFONT%3E%3B%0A%3CSPAN%20class%3D%22csl-command%22%3Elet%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22csl-let-variable%22%3EAllNSGTrafficLogs%3C%2FSPAN%3E%20%3D%20%3CSPAN%20class%3D%22csl-calculated-column%22%3EAzureNetworkAnalytics_CL%3C%2FSPAN%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23000000%22%3E%3CSPAN%20class%3D%22csl-calculated-column%22%3ETimeGenerated%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Ebetween%3C%2FSPAN%3E%20%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Estartofday%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eago%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-let-variable%22%3Estarttime%3C%2FSPAN%3E))..%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Estartofday%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eago%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-let-variable%22%3Eendtime%3C%2FSPAN%3E)))%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23000000%22%3E%3CSPAN%20class%3D%22csl-calculated-column%22%3ESubType_s%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%3D%20%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%22FlowLog%22%3C%2FSPAN%3E%3C%2FFONT%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Edistinct%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23000000%22%3E%3CSPAN%20class%3D%22csl-calculated-column%22%3EDestIP_s%3C%2FSPAN%3E%3C%2FFONT%3E%3B%0A%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Elet%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CSPAN%20class%3D%22csl-let-variable%22%3EAzureSubnetMatchedIPs%3C%2FSPAN%3E%3D%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Ematerialize%3C%2FSPAN%3E%3C%2FFONT%3E(%0A%3CSPAN%20class%3D%22csl-let-variable%22%3EAllNSGTrafficLogs%3C%2FSPAN%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Emv-apply%3C%2FSPAN%3E%3C%2FFONT%3E%20%3CSPAN%20class%3D%22csl-column%22%3El%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22csl-let-variable%22%3Elookup%3C%2FSPAN%3E%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Eto%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22csl-command%22%3Etypeof%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3Estring%3C%2FFONT%3E)%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Eon%3C%2FSPAN%3E%3C%2FFONT%3E%0A(%0A%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eipv4_is_match%3C%2FSPAN%3E%3C%2FFONT%3E%20(%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EDestIP_s%3C%2FSPAN%3E%3C%2FFONT%3E%2C%20%3CSPAN%20class%3D%22csl-column%22%3El%3C%2FSPAN%3E)%0A)%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Eproject-away%3C%2FSPAN%3E%3C%2FFONT%3E%20%3CSPAN%20class%3D%22csl-column%22%3El%3C%2FSPAN%3E%0A)%3B%0A%3CSPAN%20class%3D%22csl-calculated-column%22%3EAzureNetworkAnalytics_CL%3C%2FSPAN%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23000000%22%3E%3CSPAN%20class%3D%22csl-calculated-column%22%3ETimeGenerated%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Ebetween%3C%2FSPAN%3E%20%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Estartofday%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eago%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-let-variable%22%3Estarttime%3C%2FSPAN%3E))..%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Estartofday%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eago%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-let-variable%22%3Eendtime%3C%2FSPAN%3E)))%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23000000%22%3E%3CSPAN%20class%3D%22csl-calculated-column%22%3ESubType_s%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%3D%20%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%22FlowLog%22%3C%2FSPAN%3E%3C%2FFONT%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eisnotempty%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%23000000%22%3E%3CSPAN%20class%3D%22csl-function%22%3EDestIP_s%3C%2FSPAN%3E%3C%2FFONT%3E)%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Eextend%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EDestinationIpType%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eiff%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%23000000%22%3E%3CSPAN%20class%3D%22csl-calculated-column%22%3EDestIP_s%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CSPAN%20class%3D%22csl-suboperator%22%3E%3CFONT%20color%3D%22%230000FF%22%3Ematches%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000FF%22%3Eregex%3C%2FFONT%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22csl-let-variable%22%3EPrivateIPregex%3C%2FSPAN%3E%2C%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%22private%22%3C%2FSPAN%3E%3C%2FFONT%3E%20%2C%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%22public%22%3C%2FSPAN%3E%3C%2FFONT%3E%20)%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EDestinationIpType%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%3D%20%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%22public%22%3C%2FSPAN%3E%3C%2FFONT%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23000000%22%3E%3CSPAN%20class%3D%22csl-calculated-column%22%3EDestIP_s%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CSPAN%20class%3D%22csl-command%22%3E!%3CFONT%20color%3D%22%230000FF%22%3Ein%3C%2FFONT%3E%3C%2FSPAN%3E%20((%3CSPAN%20class%3D%22csl-let-variable%22%3EAzureSubnetMatchedIPs%3C%2FSPAN%3E))%0A%7C%3CFONT%20color%3D%22%23FF6600%22%3E%20%3CSPAN%20class%3D%22csl-operator%22%3Eproject-reorder%3C%2FSPAN%3E%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23000000%22%3E%3CSPAN%20class%3D%22csl-calculated-column%22%3ETimeGenerated%3C%2FSPAN%3E%2C%20%3CSPAN%20class%3D%22csl-calculated-column%22%3EType%3C%2FSPAN%3E%2C%20%3CSPAN%20class%3D%22csl-calculated-column%22%3ESrcIP_s%3C%2FSPAN%3E%2C%20%3CSPAN%20class%3D%22csl-calculated-column%22%3EDestIP_s%3C%2FSPAN%3E%2C%3C%2FFONT%3E%20%3CSPAN%20class%3D%22csl-calculated-column%22%3E*%3C%2FSPAN%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ESample%20Results%20%3C%2FSTRONG%3E%3A%3C%2FP%3E%0A%3CP%3EResults%20showed%20below%20are%20from%20Traffic%20NSG%20logs(%3CSPAN%20class%3D%22csl-calculated-column%22%3EAzureNetworkAnalytics_CL%3C%2FSPAN%3E)%20with%20filtering%20applied%20via%20the%20lookup%20table%20Azure%20IP%20ranges%20in%20destination%20IP%20field.%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-center%22%20image-alt%3D%22singledatasource.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%2F198775i0A7BA6B7C4DF896A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22singledatasource.PNG%22%20alt%3D%22singledatasource.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1940649683%22%20id%3D%22toc-hId-1940649683%22%3EKQL%20Query%20for%20filtering%20using%20lookup%20for%20multiple%20datasources%3A%3C%2FH2%3E%0A%3CP%3EKQL%20query%20using%20multiple%20network%20data%20sources%20unioned%20to%20do%20subnet%20matching%20and%20allow%20listing%20on%20target%20ip%20ranges%2C%20the%20same%20can%20be%20done%20for%20source%20ip.%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EDataSources%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ECommonSecurityLogs%3C%2FLI%3E%0A%3CLI%3EVMConnection%3C%2FLI%3E%0A%3CLI%3EWireData%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EKQL%20Query%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CPRE%20style%3D%22font%3A%2010pt%20consolas%3B%22%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Elet%3C%2FSPAN%3E%3C%2FFONT%3E%20%3CSPAN%20class%3D%22csl-let-variable%22%3EAzureIPRangesPublicCloud%3C%2FSPAN%3E%20%3D%20(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Eexternaldata%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-column%22%3EchangeNumber%3C%2FSPAN%3E%3CFONT%20color%3D%22%230000FF%22%3E%3Astring%3C%2FFONT%3E%2C%20%3CSPAN%20class%3D%22csl-column%22%3Ecloud%3C%2FSPAN%3E%3CFONT%20color%3D%22%230000FF%22%3E%3Astring%3C%2FFONT%3E%2C%20%3CSPAN%20class%3D%22csl-column%22%3Evalues%3C%2FSPAN%3E%3CFONT%20color%3D%22%230000FF%22%3E%3A%20dynamic%3C%2FFONT%3E)%0A%5B%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%40%22https%3A%2F%2Fuploadtobloblookuptables.blob.core.windows.net%2Flookuptables%2FServiceTags_Public.json%3Fsv%3D2019-02-02%26amp%3Bst%3D2020-06-08T17%253A21%253A23Z%26amp%3Bse%3D2020-06-09T17%253A21%253A23Z%26amp%3Bsr%3Db%26amp%3Bsp%3Dr%26amp%3Bsig%3DzTATanBOqaDbi2NAQirIMWRJmees2z0CQexk4XQiTb0%253D%22%3C%2FSPAN%3E%3C%2FFONT%3E%5D%0A%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Ewith%3C%2FSPAN%3E%20%3C%2FFONT%3E(%3CFONT%20color%3D%22%2300CCFF%22%3E%3CSPAN%20class%3D%22csl-query-parameter%22%3Eformat%3C%2FSPAN%3E%3C%2FFONT%3E%3D%3CSPAN%20class%3D%22csl-string-literal%22%3E%22%3CFONT%20color%3D%22%23993300%22%3Emultijson%22%3C%2FFONT%3E%3C%2FSPAN%3E))%3B%0A%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Elet%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CSPAN%20class%3D%22csl-let-variable%22%3EAzureSubnetRangelist%3C%2FSPAN%3E%20%3D%20%3CSPAN%20class%3D%22csl-let-variable%22%3EAzureIPRangesPublicCloud%3C%2FSPAN%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Emvexpand%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3Evalues%3C%2FSPAN%3E%3C%2FFONT%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Eextend%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EaddressPrefixes%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eparse_json%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eparse_json%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3Evalues%3C%2FSPAN%3E%3C%2FFONT%3E).%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eproperties%3C%2FSPAN%3E%3C%2FFONT%3E).%3CSPAN%20class%3D%22csl-calculated-column%22%3EaddressPrefixes%3C%2FSPAN%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Eproject%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EaddressPrefixes%3C%2FSPAN%3E%3C%2FFONT%3E%3B%20%0A%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Elet%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CSPAN%20class%3D%22csl-let-variable%22%3Elookup%3C%2FSPAN%3E%20%3D%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Etoscalar%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-let-variable%22%3EAzureSubnetRangelist%3C%2FSPAN%3E%7C%20%3CSPAN%20class%3D%22csl-operator%22%3Esummarize%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22csl-column%22%3El%3C%2FSPAN%3E%3D%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Emake_set%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-column%22%3EaddressPrefixes%3C%2FSPAN%3E))%3B%0A%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Elet%3C%2FSPAN%3E%3C%2FFONT%3E%20%3CSPAN%20class%3D%22csl-let-variable%22%3Estarttime%3C%2FSPAN%3E%20%3D%202h%3B%0A%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Elet%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CSPAN%20class%3D%22csl-let-variable%22%3Eendtime%3C%2FSPAN%3E%20%3D%201h%3B%0A%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Elet%3C%2FSPAN%3E%3C%2FFONT%3E%20%3CSPAN%20class%3D%22csl-let-variable%22%3EPrivateIPregex%3C%2FSPAN%3E%20%3D%20%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%40'%5E127%5C.%7C%5E10%5C.%7C%5E172%5C.1%5B6-9%5D%5C.%7C%5E172%5C.2%5B0-9%5D%5C.%7C%5E172%5C.3%5B0-1%5D%5C.%7C%5E192%5C.168%5C.'%3C%2FSPAN%3E%3C%2FFONT%3E%3B%0A%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Elet%3C%2FSPAN%3E%3C%2FFONT%3E%20%3CSPAN%20class%3D%22csl-let-variable%22%3EAllDestIPs%3C%2FSPAN%3E%20%3D%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Ematerialize%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Eunion%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%2300CCFF%22%3E%3CSPAN%20class%3D%22csl-query-parameter%22%3Eisfuzzy%3C%2FSPAN%3E%3C%2FFONT%3E%3Dtrue%0A(%0A%3CSPAN%20class%3D%22csl-calculated-column%22%3EVMConnection%3C%2FSPAN%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CSPAN%20class%3D%22csl-calculated-column%22%3ETimeGenerated%3C%2FSPAN%3E%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Ebetween%3C%2FSPAN%3E%20%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Estartofday%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eago%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-let-variable%22%3Estarttime%3C%2FSPAN%3E))..%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Estartofday%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eago%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-let-variable%22%3Eendtime%3C%2FSPAN%3E)))%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eisnotempty%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-function%22%3EDestinationIp%3C%2FSPAN%3E)%20%3CSPAN%20class%3D%22csl-suboperator%22%3Eand%3C%2FSPAN%3E%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eisnotempty%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-function%22%3ESourceIp%3C%2FSPAN%3E)%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Eextend%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EDestinationIpType%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eiff%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-calculated-column%22%3EDestinationIp%3C%2FSPAN%3E%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-suboperator%22%3Ematches%20regex%3C%2FSPAN%3E%3C%2FFONT%3E%20%3CSPAN%20class%3D%22csl-let-variable%22%3EPrivateIPregex%3C%2FSPAN%3E%2C%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%22private%22%3C%2FSPAN%3E%3C%2FFONT%3E%20%2C%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%22public%22%3C%2FSPAN%3E%3C%2FFONT%3E%20)%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EDestinationIpType%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%3D%20%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%22public%22%3C%2FSPAN%3E%3C%2FFONT%3E%20%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Eextend%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EDeviceVendor%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%22VMConnection%22%3C%2FSPAN%3E%3C%2FFONT%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Eextend%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EDestinationIP%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CSPAN%20class%3D%22csl-calculated-column%22%3EDestinationIp%3C%2FSPAN%3E%2C%20%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3ESourceIP%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CSPAN%20class%3D%22csl-calculated-column%22%3ESourceIp%3C%2FSPAN%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Edistinct%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EDestinationIP%3C%2FSPAN%3E%3C%2FFONT%3E%0A)%2C%0A(%0A%3CSPAN%20class%3D%22csl-calculated-column%22%3ECommonSecurityLog%3C%2FSPAN%3E%20%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CSPAN%20class%3D%22csl-calculated-column%22%3ETimeGenerated%3C%2FSPAN%3E%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Ebetween%3C%2FSPAN%3E%20%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Estartofday%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eago%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-let-variable%22%3Estarttime%3C%2FSPAN%3E))..%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Estartofday%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eago%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-let-variable%22%3Eendtime%3C%2FSPAN%3E)))%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eisnotempty%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-function%22%3EDestinationIP%3C%2FSPAN%3E)%20%3CSPAN%20class%3D%22csl-suboperator%22%3Eand%3C%2FSPAN%3E%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eisnotempty%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-function%22%3ESourceIP%3C%2FSPAN%3E)%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Eextend%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EDestinationIpType%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eiff%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-calculated-column%22%3EDestinationIP%3C%2FSPAN%3E%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-suboperator%22%3Ematches%20regex%3C%2FSPAN%3E%3C%2FFONT%3E%20%3CSPAN%20class%3D%22csl-let-variable%22%3EPrivateIPregex%3C%2FSPAN%3E%2C%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%22private%22%3C%2FSPAN%3E%3C%2FFONT%3E%20%2C%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%22public%22%3C%2FSPAN%3E%3C%2FFONT%3E%20)%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EDestinationIpType%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%3D%20%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%22public%22%3C%2FSPAN%3E%3C%2FFONT%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Edistinct%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CSPAN%20class%3D%22csl-calculated-column%22%3EDestinationIP%3C%2FSPAN%3E%0A)%2C%0A(%0A%3CSPAN%20class%3D%22csl-calculated-column%22%3EWireData%3C%2FSPAN%3E%20%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CSPAN%20class%3D%22csl-calculated-column%22%3ETimeGenerated%3C%2FSPAN%3E%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Ebetween%3C%2FSPAN%3E%20%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Estartofday%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eago%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-let-variable%22%3Estarttime%3C%2FSPAN%3E))..%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Estartofday%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eago%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-let-variable%22%3Eendtime%3C%2FSPAN%3E)))%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eisnotempty%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-function%22%3ERemoteIP%3C%2FSPAN%3E)%20%3CSPAN%20class%3D%22csl-suboperator%22%3Eand%3C%2FSPAN%3E%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eisnotempty%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-function%22%3ELocalIP%3C%2FSPAN%3E)%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Eextend%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EDestinationIpType%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eiff%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-calculated-column%22%3ERemoteIP%3C%2FSPAN%3E%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-suboperator%22%3Ematches%20regex%3C%2FSPAN%3E%3C%2FFONT%3E%20%3CSPAN%20class%3D%22csl-let-variable%22%3EPrivateIPregex%3C%2FSPAN%3E%2C%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%22private%22%3C%2FSPAN%3E%3C%2FFONT%3E%20%2C%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%22public%22%3C%2FSPAN%3E%20%3C%2FFONT%3E)%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EDestinationIpType%3C%2FSPAN%3E%3C%2FFONT%3E%20%3D%3D%20%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%22public%22%3C%2FSPAN%3E%20%3C%2FFONT%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Eextend%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EDestinationIP%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CSPAN%20class%3D%22csl-calculated-column%22%3ERemoteIP%3C%2FSPAN%3E%20%2C%20%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3ESourceIP%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CSPAN%20class%3D%22csl-calculated-column%22%3ELocalIP%3C%2FSPAN%3E%20%7C%20%3CSPAN%20class%3D%22csl-operator%22%3Eextend%3C%2FSPAN%3E%20%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EDeviceVendor%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%22WireData%22%3C%2FSPAN%3E%3C%2FFONT%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Edistinct%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EDestinationIP%3C%2FSPAN%3E%3C%2FFONT%3E%0A)%0A)%3B%0A%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Elet%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CSPAN%20class%3D%22csl-let-variable%22%3EAzureSubnetMatchedIPs%3C%2FSPAN%3E%3D%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Ematerialize%3C%2FSPAN%3E%3C%2FFONT%3E(%0A%3CSPAN%20class%3D%22csl-let-variable%22%3EAllDestIPs%3C%2FSPAN%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Emv-apply%3C%2FSPAN%3E%3C%2FFONT%3E%20%3CSPAN%20class%3D%22csl-column%22%3El%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22csl-let-variable%22%3Elookup%3C%2FSPAN%3E%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Eto%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22csl-command%22%3Etypeof%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3Estring%3C%2FFONT%3E)%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Eon%3C%2FSPAN%3E%3C%2FFONT%3E%0A(%0A%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eipv4_is_match%3C%2FSPAN%3E%20%3C%2FFONT%3E(%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EDestinationIP%3C%2FSPAN%3E%3C%2FFONT%3E%2C%20%3CSPAN%20class%3D%22csl-column%22%3El%3C%2FSPAN%3E)%0A)%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Eproject-away%3C%2FSPAN%3E%3C%2FFONT%3E%20%3CSPAN%20class%3D%22csl-column%22%3El%3C%2FSPAN%3E%0A)%3B%0A%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Elet%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CSPAN%20class%3D%22csl-let-variable%22%3ETrafficLogsNonAzure%3C%2FSPAN%3E%20%3D%20(%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Eunion%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%2300CCFF%22%3E%3CSPAN%20class%3D%22csl-query-parameter%22%3Eisfuzzy%3C%2FSPAN%3E%3C%2FFONT%3E%3Dtrue%0A(%0A%3CSPAN%20class%3D%22csl-calculated-column%22%3EVMConnection%3C%2FSPAN%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CSPAN%20class%3D%22csl-calculated-column%22%3ETimeGenerated%3C%2FSPAN%3E%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Ebetween%3C%2FSPAN%3E%20%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Estartofday%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eago%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-let-variable%22%3Estarttime%3C%2FSPAN%3E))..%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Estartofday%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eago%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-let-variable%22%3Eendtime%3C%2FSPAN%3E)))%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eisnotempty%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-function%22%3EDestinationIp%3C%2FSPAN%3E)%20%3CSPAN%20class%3D%22csl-suboperator%22%3Eand%3C%2FSPAN%3E%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eisnotempty%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-function%22%3ESourceIp%3C%2FSPAN%3E)%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Eextend%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EDestinationIP%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CSPAN%20class%3D%22csl-calculated-column%22%3EDestinationIp%3C%2FSPAN%3E%2C%20%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3ESourceIP%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CSPAN%20class%3D%22csl-calculated-column%22%3ESourceIp%3C%2FSPAN%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EDestinationIP%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3E!in%3C%2FSPAN%3E%3C%2FFONT%3E%20((%3CSPAN%20class%3D%22csl-let-variable%22%3EAzureSubnetMatchedIPs%3C%2FSPAN%3E))%0A)%2C%0A(%0A%3CSPAN%20class%3D%22csl-calculated-column%22%3ECommonSecurityLog%3C%2FSPAN%3E%20%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CSPAN%20class%3D%22csl-calculated-column%22%3ETimeGenerated%3C%2FSPAN%3E%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Ebetween%3C%2FSPAN%3E%20%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Estartofday%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eago%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-let-variable%22%3Estarttime%3C%2FSPAN%3E))..%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Estartofday%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eago%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-let-variable%22%3Eendtime%3C%2FSPAN%3E)))%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eisnotempty%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-function%22%3EDestinationIP%3C%2FSPAN%3E)%20%3CSPAN%20class%3D%22csl-suboperator%22%3Eand%3C%2FSPAN%3E%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eisnotempty%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-function%22%3ESourceIP%3C%2FSPAN%3E)%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CSPAN%20class%3D%22csl-calculated-column%22%3EDestinationIP%3C%2FSPAN%3E%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3E!in%3C%2FSPAN%3E%3C%2FFONT%3E%20((%3CSPAN%20class%3D%22csl-let-variable%22%3EAzureSubnetMatchedIPs%3C%2FSPAN%3E))%0A)%2C%0A(%0A%3CSPAN%20class%3D%22csl-calculated-column%22%3EWireData%3C%2FSPAN%3E%20%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CSPAN%20class%3D%22csl-calculated-column%22%3ETimeGenerated%3C%2FSPAN%3E%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3Ebetween%3C%2FSPAN%3E%20%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Estartofday%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eago%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-let-variable%22%3Estarttime%3C%2FSPAN%3E))..%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Estartofday%3C%2FSPAN%3E%3C%2FFONT%3E(%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eago%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-let-variable%22%3Eendtime%3C%2FSPAN%3E)))%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eisnotempty%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-function%22%3ERemoteIP%3C%2FSPAN%3E)%20%3CSPAN%20class%3D%22csl-suboperator%22%3Eand%3C%2FSPAN%3E%20%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-function%22%3Eisnotempty%3C%2FSPAN%3E%3C%2FFONT%3E(%3CSPAN%20class%3D%22csl-function%22%3ELocalIP%3C%2FSPAN%3E)%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Eextend%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EDestinationIP%3C%2FSPAN%3E%3C%2FFONT%3E%20%3D%20%3CSPAN%20class%3D%22csl-calculated-column%22%3ERemoteIP%3C%2FSPAN%3E%20%2C%20%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3ESourceIP%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CSPAN%20class%3D%22csl-calculated-column%22%3ELocalIP%3C%2FSPAN%3E%20%7C%20%3CSPAN%20class%3D%22csl-operator%22%3Eextend%3C%2FSPAN%3E%20%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EDeviceVendor%3C%2FSPAN%3E%20%3C%2FFONT%3E%3D%20%3CFONT%20color%3D%22%23993300%22%3E%3CSPAN%20class%3D%22csl-string-literal%22%3E%22WireData%22%3C%2FSPAN%3E%3C%2FFONT%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Ewhere%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EDestinationIP%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSPAN%20class%3D%22csl-command%22%3E!in%3C%2FSPAN%3E%3C%2FFONT%3E%20((%3CSPAN%20class%3D%22csl-let-variable%22%3EAzureSubnetMatchedIPs%3C%2FSPAN%3E))%0A)%0A)%3B%0A%3CSPAN%20class%3D%22csl-let-variable%22%3ETrafficLogsNonAzure%3C%2FSPAN%3E%20%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Eproject-away%3C%2FSPAN%3E%20%3C%2FFONT%3E%3CSPAN%20class%3D%22csl-calculated-column%22%3EType%3C%2FSPAN%3E%2C%20%3CSPAN%20class%3D%22csl-calculated-column%22%3ERemoteIP%3C%2FSPAN%3E%2C%20%3CSPAN%20class%3D%22csl-calculated-column%22%3ELocalIP%3C%2FSPAN%3E%2C%20%3CSPAN%20class%3D%22csl-calculated-column%22%3EDestinationIp%3C%2FSPAN%3E%2C%20%3CSPAN%20class%3D%22csl-calculated-column%22%3ESourceIp%3C%2FSPAN%3E%0A%7C%20%3CFONT%20color%3D%22%23FF6600%22%3E%3CSPAN%20class%3D%22csl-operator%22%3Eproject-reorder%3C%2FSPAN%3E%3C%2FFONT%3E%20%3CSPAN%20class%3D%22csl-calculated-column%22%3ETimeGenerated%3C%2FSPAN%3E%2C%20%3CFONT%20color%3D%22%23800080%22%3E%3CSPAN%20class%3D%22csl-column%22%3EDeviceVendor%3C%2FSPAN%3E%2C%20%3CSPAN%20class%3D%22csl-column%22%3ESourceIP%3C%2FSPAN%3E%2C%20%3CSPAN%20class%3D%22csl-column%22%3EDestinationIP%3C%2FSPAN%3E%3C%2FFONT%3E%2C%20%3CSPAN%20class%3D%22csl-calculated-column%22%3E*%3C%2FSPAN%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ENote%3A%3C%2FSTRONG%3E%20The%20above%20query%20checks%20multiple%20high%20volume%20tables%20and%20lookup%20query%20will%20be%20CPU%20and%20memory%20intensive.%20It%20is%20recommended%20to%20run%20it%20in%20smaller%20intervals%20(hourly)%20or%20split%20it%20per%20datasource%20to%20review%20the%20results.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ESample%20results%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22lookuptable-multidatasource.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%2F198781iCA265F8B464D728D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22lookuptable-multidatasource.PNG%22%20alt%3D%22lookuptable-multidatasource.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHappy%20Hunting%20!!%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-133195220%22%20id%3D%22toc-hId-133195220%22%3EReferences%3A%3C%2FH2%3E%0A%3CUL%3E%0A%3CLI%3EApproximate%20Partial%20and%20combined%20lookups%20in%20Azure%20Sentinel%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E-ERR%3AREF-NOT-FOUND-%3CA%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%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-sentinel%2Fapproximate-partial-and-combined-lookups-in-azure-sentinel%2Fba-p%2F1393795%3C%2FA%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ECentralized%20Lookup%20Tables%20for%20enrichment%20in%20KQL%20with%20Azure%20Function%20to%20upload%20to%20blob%20storage%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2FAzure-Sentinel%2Fpull%2F720%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FAzure%2FAzure-Sentinel%2Fpull%2F720%3C%2FA%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3Elookup%20operator%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fdata-explorer%2Fkusto%2Fquery%2Flookupoperator%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fdata-explorer%2Fkusto%2Fquery%2Flookupoperator%3Fpivot%3Dazuremonitor%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EExternaldata%20Operator%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E-ERR%3AREF-NOT-FOUND-%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fdata-explorer%2Fkusto%2Fquery%2Fexternaldata-operator%3Fpivot%3Dazuremonitor%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fdata-explorer%2Fkusto%2Fquery%2Fexternaldata-operator%3Fpivot%3Dazuremonitor%3C%2FA%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3Ematerialize%20function%26nbsp%3B%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fdata-explorer%2Fkusto%2Fquery%2Fmaterializefunction%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fdata-explorer%2Fkusto%2Fquery%2Fmaterializefunction%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1450345%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20this%20blog%2C%20we%20will%20show%20a%20custom%20solution%20to%20create%20reference%20lookup%20tables%20of%20network%20data%20sources%20in%20blob%20storage%20and%20call%20within%20KQL%20queries%20using%20native%20operators.%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-center%22%20image-alt%3D%22function-architecture-01.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%2F198828i9B433923C214AFDB%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22function-architecture-01.png%22%20alt%3D%22function-architecture-01.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1450345%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Sentinel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EHunting%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

Network data sources are one of the highest volume data sources hence threat hunting on such data sources becomes often challenging if we do not enrich such datasets. One of the common first steps done is matching against Threat Intel feeds. Apart from that, public ip addresses are difficult to investigate at scale unless we populate additional context around it or correlate with other data sources.

One of the common use-case request we have received from customers is tagging Azure Data Center ip Addresses in network telemetry so they can filter it out and focus on other telemetry to find suspicious traffic.

In this blog, we will show a custom solution to create reference lookup tables of such data sources in blob storage and call within KQL queries using native operators. Ofer has done a blog-post on Approximate, partial and combined lookups which you can reference if you are new to lookup tables. Also, thanks to Dennis Pike from CyberSecurity Solutions Group who contributed with compiling Single data source KQL query.

 

Note:

Microsoft do not recommend filtering or using these ranges as Allowed List for detections. Any such filtering needs to be reviewed and implemented with care so it does not introduce any blind spots in your security monitoring. However, these datasets can be used to enrich existing data sources, provide more context and to segregate or categorize the large portion of the network traffic for analysts/threat hunters while hunting or investigating large data sets.

 

Identification of Reliable Data sources:

Microsoft and other vendors publish various network data sources which are updated regularly (sometimes weekly). These datasets can be used to enrich the existing network data sources. The datasets can be downloaded via public links and can be directly called via externaldata operator if download links are static. These can be extended to Threat Intel feeds such as COVID-19 indicators.

 

Download and ingest datasets:

The datasets may not be always available as static links depending upon how they are being published. Also for certain feeds, the download url has date appended which is dynamic and can not be called with scheduled queries unless normalized on external storage.

 

e.g. For AzureDataCenter IP Ranges – Cloud.

Download Page: https://www.microsoft.com/en-us/download/details.aspx?id=56519  which has download button linking to https://www.microsoft.com/en-us/download/confirmation.aspx?id=56519 When this link is visited from browser, it automatically redirects to the relevant URL with json behind the scenes and auto-downloads.

However, this direct download link is not static and may change its location or date depending on when its updated and available to download.

 https://download.microsoft.com/download/7/1/D/71D86715-5596-4529-9B13-DA13A5DE5B63/ServiceTags_Publi...

 

To find the actual download link programmatically, you can request HTML response for the download link and find href links ending with json.  Below is an example PowerShell console from windows Terminal to parse a HTML response of the original download links and retrieve direct download link to the json.

 

terminal.png

 

For working with static URLs, you can also directly use Azure playbooks which provides friendly UI and step by step process to ingest in AzureSentinel. You can check recent blogpost Using Azure Playbooks to import text-based threat indicators to Azure Sentinel for more details. For complex use-cases where download link is not static, we can automate this via a serverless Azure Function and PowerShell to store this data directly in Azure blob storage. Once these files are stored in blob storage, you can generate a read only shared access link in order to use within KQL queries. You can also ingest these directly in Sentinel as custom log table however dataset is very tiny so we will cover blob storage method in this article. For examples ingestion instructions, check the json ingestion tools dotnet_loganalytics_json_import  , Azure Log Analytics API Clients .

 

Architecture Diagram:

The below diagram explains the data workflow for our use-case. We will feed multiple URLs containing the datasets you want to use as reference tables. In the below example, we are using 4 such datasets. These will be processed via our Azure Function which will parse URLs to find direct download links if required and upload to blob storage.  Once these files are uploaded to blob storage, you can generate read only shared access links to access via native KQL operators such as externaldata. We will also see how to use these operators in queries later part of the article.

 

function-architecture-01.png

 

When to use the Architecture:

Below are certain scenarios when you can consider deploying this into your environment.

  • Centralized Lookup tables with normalized filenames to call in the scheduled KQL queries in Sentinel.
  • When direct URL to download the file is not available and need normalization to use within queries.
  • When you cannot use externaldata operator from KQL queries to access public sites directly but can reach to Azure storage domain. (blob.core.windows.net).
  • When you need to store and access current or archived versions reliably when original source is not available.

 

Deploy the function:

You can deploy the function via two ways either through VS Code or directly via ARM template.

Detailed instructions with both methods can be found on GitHub :

https://github.com/Azure/Azure-Sentinel/blob/master/Tools/UploadToBlobLookupTables/readme.md

 

Generating Shared Access Links from Azure Blob Storage:

In order to access blob storage links, you can generate pre-approved shared access links with read-only permissions.

You can follow the tutorial – Get SAS for a blob Container to generate links for each blob files.

Step -1 : Get Shared Access Signature for the respective File in blob storage.

 

Storageexplorer-SAS-01.png

Step-2: Set desired expiry period and Permissions as Read.

Storageexplorer-SAS-02.png

 

Step 3: Copy the link from the last screen.

Storageexplorer-SAS-03.png

 

 

KQL query with externaldata for Azure IP Ranges:

This query gives us around 5k subnet ranges.

KQL :

let AzureIPRangesPublicCloud = (externaldata(changeNumber:string,cloud:string, values: dynamic)
[@"https://uploadtobloblookuptables.blob.core.windows.net/lookuptables/ServiceTags_Public.json?sv=2019-02-02&st=2020-06-08T17%3A21%3A23Z&se=2020-06-09T17%3A21%3A23Z&sr=b&sp=r&sig=zTATanBOqaDbi2NAQirIMWRJmees2z0CQexk4XQiTb0%3D"]
with (format="multijson")); let AzureSubnetRangelist = AzureIPRangesPublicCloud | mvexpand values | extend platform = parse_json(parse_json(values).properties).platform, systemservice = parse_json(parse_json(values).properties).systemService, region = parse_json(parse_json(values).properties).region, addressPrefixes = parse_json(parse_json(values).properties).addressPrefixes | mvexpand addressPrefixes | project platform, systemservice, region, addressPrefixes;

 

Sample Output:

The above query result into around 5K subnets with contexts such as platform, region and systemservice associated with it. You can selectively pickup from this lookup table depending on how your azure infrastructure. For this blog, we are going to use this table as it is.

 

LookupTable.PNG

 

KQL Query for filtering using Lookup for single datasource:

KQL Query using  single data source to do subnet matching and filter on target/source IP ranges:

 

Datasource:

  • AzureNetworkAnalytics_CL
let AzureIPRangesPublicCloud = (externaldata(changeNumber:string,cloud:string, values: dynamic) 
[@"https://uploadtobloblookuptables.blob.core.windows.net/lookuptables/ServiceTags_Public.json?sv=2019-02-02&st=2020-06-08T17%3A21%3A23Z&se=2020-06-09T17%3A21%3A23Z&sr=b&sp=r&sig=zTATanBOqaDbi2NAQirIMWRJmees2z0CQexk4XQiTb0%3D"] with (format="multijson"));
let AzureSubnetRangelist = AzureIPRangesPublicCloud
| mvexpand values
| extend platform = parse_json(parse_json(values).properties).platform, systemservice = parse_json(parse_json(values).properties).systemService, region = parse_json(parse_json(values).properties).region, addressPrefixes = parse_json(parse_json(values).properties).addressPrefixes
| mvexpand addressPrefixes
| project platform, systemservice, region, addressPrefixes; let lookup = toscalar(AzureSubnetRangelist| summarize l=make_list(addressPrefixes)); let starttime = 1d; let endtime = 1h; let PrivateIPregex = @'^127\.|^10\.|^172\.1[6-9]\.|^172\.2[0-9]\.|^172\.3[0-1]\.|^192\.168\.'; let AllNSGTrafficLogs = AzureNetworkAnalytics_CL | where TimeGenerated between (startofday(ago(starttime))..startofday(ago(endtime))) | where SubType_s == "FlowLog" | distinct DestIP_s; let AzureSubnetMatchedIPs=materialize( AllNSGTrafficLogs | mv-apply l=lookup to typeof(string) on ( where ipv4_is_match (DestIP_s, l) ) | project-away l ); AzureNetworkAnalytics_CL | where TimeGenerated between (startofday(ago(starttime))..startofday(ago(endtime))) | where SubType_s == "FlowLog" | where isnotempty(DestIP_s) | extend DestinationIpType = iff(DestIP_s matches regex PrivateIPregex,"private" ,"public" ) | where DestinationIpType == "public" | where DestIP_s !in ((AzureSubnetMatchedIPs)) | project-reorder TimeGenerated, Type, SrcIP_s, DestIP_s, *

 

Sample Results :

Results showed below are from Traffic NSG logs(AzureNetworkAnalytics_CL) with filtering applied via the lookup table Azure IP ranges in destination IP field.

 

singledatasource.PNG

 

KQL Query for filtering using lookup for multiple datasources:

KQL query using multiple network data sources unioned to do subnet matching and allow listing on target ip ranges, the same can be done for source ip.

DataSources:

  • CommonSecurityLogs
  • VMConnection
  • WireData

 

KQL Query:

let AzureIPRangesPublicCloud = (externaldata(changeNumber:string, cloud:string, values: dynamic)
[@"https://uploadtobloblookuptables.blob.core.windows.net/lookuptables/ServiceTags_Public.json?sv=2019-02-02&st=2020-06-08T17%3A21%3A23Z&se=2020-06-09T17%3A21%3A23Z&sr=b&sp=r&sig=zTATanBOqaDbi2NAQirIMWRJmees2z0CQexk4XQiTb0%3D"]
with (format="multijson"));
let AzureSubnetRangelist = AzureIPRangesPublicCloud
| mvexpand values
| extend addressPrefixes = parse_json(parse_json(values).properties).addressPrefixes
| project addressPrefixes; 
let lookup = toscalar(AzureSubnetRangelist| summarize l=make_set(addressPrefixes));
let starttime = 2h;
let endtime = 1h;
let PrivateIPregex = @'^127\.|^10\.|^172\.1[6-9]\.|^172\.2[0-9]\.|^172\.3[0-1]\.|^192\.168\.';
let AllDestIPs = materialize(union isfuzzy=true
(
VMConnection
| where TimeGenerated between (startofday(ago(starttime))..startofday(ago(endtime)))
| where isnotempty(DestinationIp) and isnotempty(SourceIp)
| extend DestinationIpType = iff(DestinationIp matches regex PrivateIPregex,"private" ,"public" )
| where DestinationIpType == "public" | extend DeviceVendor = "VMConnection"
| extend DestinationIP = DestinationIp, SourceIP = SourceIp
| distinct DestinationIP
),
(
CommonSecurityLog 
| where TimeGenerated between (startofday(ago(starttime))..startofday(ago(endtime)))
| where isnotempty(DestinationIP) and isnotempty(SourceIP)
| extend DestinationIpType = iff(DestinationIP matches regex PrivateIPregex,"private" ,"public" )
| where DestinationIpType == "public"
| distinct DestinationIP
),
(
WireData 
| where TimeGenerated between (startofday(ago(starttime))..startofday(ago(endtime)))
| where isnotempty(RemoteIP) and isnotempty(LocalIP)
| extend DestinationIpType = iff(RemoteIP matches regex PrivateIPregex,"private" ,"public" )
| where DestinationIpType == "public" 
| extend DestinationIP = RemoteIP , SourceIP = LocalIP | extend DeviceVendor = "WireData"
| distinct DestinationIP
)
);
let AzureSubnetMatchedIPs=materialize(
AllDestIPs
| mv-apply l=lookup to typeof(string) on
(
 where ipv4_is_match (DestinationIP, l)
)
| project-away l
);
let TrafficLogsNonAzure = (union isfuzzy=true
(
VMConnection
| where TimeGenerated between (startofday(ago(starttime))..startofday(ago(endtime)))
| where isnotempty(DestinationIp) and isnotempty(SourceIp)
| extend DestinationIP = DestinationIp, SourceIP = SourceIp
| where DestinationIP !in ((AzureSubnetMatchedIPs))
),
(
CommonSecurityLog 
| where TimeGenerated between (startofday(ago(starttime))..startofday(ago(endtime)))
| where isnotempty(DestinationIP) and isnotempty(SourceIP)
| where DestinationIP !in ((AzureSubnetMatchedIPs))
),
(
WireData 
| where TimeGenerated between (startofday(ago(starttime))..startofday(ago(endtime)))
| where isnotempty(RemoteIP) and isnotempty(LocalIP)
| extend DestinationIP = RemoteIP , SourceIP = LocalIP | extend DeviceVendor = "WireData"
| where DestinationIP !in ((AzureSubnetMatchedIPs))
)
);
TrafficLogsNonAzure 
| project-away Type, RemoteIP, LocalIP, DestinationIp, SourceIp
| project-reorder TimeGenerated, DeviceVendor, SourceIP, DestinationIP, *

 

Note: The above query checks multiple high volume tables and lookup query will be CPU and memory intensive. It is recommended to run it in smaller intervals (hourly) or split it per datasource to review the results.

 

Sample results:

lookuptable-multidatasource.PNG

 

 

Happy Hunting !! 

 

References:

  • Approximate Partial and combined lookups in Azure Sentinel

https://techcommunity.microsoft.com/t5/azure-sentinel/approximate-partial-and-combined-lookups-in-az...

 

  • Centralized Lookup Tables for enrichment in KQL with Azure Function to upload to blob storage

https://github.com/Azure/Azure-Sentinel/pull/720

 

  • lookup operator

https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/lookupoperator?pivot=azuremonitor

 

  • Externaldata Operator

https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/externaldata-operator?pivot=azuremo...

 

  • materialize function 

https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/materializefunction