Home
%3CLINGO-SUB%20id%3D%22lingo-sub-971818%22%20slang%3D%22en-US%22%3EHow%20to%20use%20Azure%20Monitor%20Workbooks%20to%20map%20Sentinel%20data%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-971818%22%20slang%3D%22en-US%22%3E%3CP%3EFor%20this%20post%20I'm%20going%20to%20start%20with%20the%20query%20on%20the%20Sentinel%20Home%20Page%20that%20shows%20%3CSTRONG%3EPotential%20MaliciousIP%20events%3C%2FSTRONG%3E.%26nbsp%3B%20Here%20is%20the%20example%20from%20my%20portal%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F152710i51C63B35512AE353%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_0.png%22%20title%3D%22clipboard_image_0.png%22%20%2F%3E%3C%2FSPAN%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENote%3A%20There%20are%20indicators%20for%20%3CEM%3EInbound%3C%2FEM%3E%20and%20%3CEM%3EOutbound%3C%2FEM%3E%20MaliciousIP%20on%20this%20map.%26nbsp%3B%20I%20often%20get%20asked%20how%20we%20get%20this%20info%2C%20please%20read%20on.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1851488297%22%20id%3D%22toc-hId-1851488297%22%20id%3D%22toc-hId-1851488297%22%3EPrepare%20your%20query%26nbsp%3B%3C%2FH2%3E%0A%3CP%3E%3CBR%20%2F%3EThis%20is%20the%20basic%20Kusto%20Query%20Language%20(KQL)%20I%20have%20used%20to%20look%20at%20the%20Log%20Analytics%20data.%26nbsp%3B%20I%20have%20changed%20the%20format%20slightly%20to%20left%20align%20it%2C%20and%20removed%20the%20detected%20regions%20for%20now%20-%20i.e.%20kept%20it%20simple.%26nbsp%3B%20You%20can%20use%20%3CSTRONG%3Eany%3C%2FSTRONG%3E%20data%20source%20with%20Longitude%20or%20Latitude%20data.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Eunion%20isfuzzy%3Dtrue%20%0A(W3CIISLog%0A%7C%20extend%20TrafficDirection%20%3D%20%22InboundOrUnknown%22%2C%20Country%3DRemoteIPCountry%2C%20Latitude%3DRemoteIPLatitude%2C%20Longitude%3DRemoteIPLongitude)%2C%20%0A(DnsEvents%0A%7C%20extend%20TrafficDirection%20%3D%20%22InboundOrUnknown%22%2C%20Country%3D%20RemoteIPCountry%2C%20Latitude%20%3D%20RemoteIPLatitude%2C%20Longitude%20%3D%20RemoteIPLongitude)%2C%0A(WireData%0A%7C%20extend%20TrafficDirection%20%3D%20iff(Direction%20!%3D%20%22Outbound%22%2C%22InboundOrUnknown%22%2C%20%22Outbound%22)%2C%20Country%3DRemoteIPCountry%2C%20Latitude%3DRemoteIPLatitude%2C%20Longitude%3DRemoteIPLongitude)%2C%20%0A(WindowsFirewall%0A%7C%20extend%20TrafficDirection%20%3D%20iff(CommunicationDirection%20!%3D%20%22SEND%22%2C%22InboundOrUnknown%22%2C%20%22Outbound%22)%2C%20Country%3DMaliciousIPCountry%2C%20Latitude%3DMaliciousIPLatitude%2C%20Longitude%3DMaliciousIPLongitude)%2C%20%0A(CommonSecurityLog%0A%7C%20extend%20TrafficDirection%20%3D%20iff(CommunicationDirection%20!%3D%20%22Outbound%22%2C%22InboundOrUnknown%22%2C%20%22Outbound%22)%2C%20Country%3DMaliciousIPCountry%2C%20Latitude%3DMaliciousIPLatitude%2C%20Longitude%3DMaliciousIPLongitude%2C%20Confidence%3DThreatDescription%2C%20Description%3DThreatDescription)%2C%20%0A(VMConnection%0A%7C%20where%20Type%20%3D%3D%20%22VMConnection%22%0A%7C%20extend%20TrafficDirection%20%3D%20iff(Direction%20!%3D%20%22outbound%22%2C%22InboundOrUnknown%22%2C%20%22Outbound%22)%2C%20Country%3DRemoteCountry%2C%20Latitude%3DRemoteLatitude%2C%20Longitude%3DRemoteLongitude)%0A%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--897182169%22%20id%3D%22toc-hId--897182169%22%20id%3D%22toc-hId--897182169%22%3ESummary%20of%20the%20query%3A%3C%2FH3%3E%0A%3CP%3EThe%20query%20looks%20in%201-6%20Tables%20and%20if%20there%20are%20Inbound%20or%20Outbound%20MaliciousIP%20addresses%20it%20notes%20them%2C%20the%20data%20feed%20provides%20lots%20of%20good%20columns%20of%20data%2C%20in%20this%20article%20its%20the%20%3CSTRONG%3ELongitude%3C%2FSTRONG%3E%20and%20%3CSTRONG%3ELatitude%3C%2FSTRONG%3E%20I'm%20mainly%20focusing%20on.%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3ENow%20we%20have%20the%20basics%2C%20we%20can%20add%20some%20extra%20filtering%2C%20in%20the%20below%20I've%20added%20some%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2Fletstatement%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3ELet%3C%2FA%3E%20statements%20at%20the%20beginning%20and%20some%20Time%20filtering%20at%20the%20end%20-%20to%20get%207%20days%20of%20data%20in%20this%20example%20case.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Elet%20daystoSearch%20%3D%207d%3B%20%2F%2F%20Please%20enter%20how%20many%20days%20worth%20of%20data%20to%20look%20at%3F%0Alet%20myLongitude%20%20%3D%20-0.925915%3B%20%20%2F%2F%20Microsoft%20Campus%20UK%0Alet%20myLatitude%20%20%20%3D%2051.461377%3B%0Aunion%20isfuzzy%3Dtrue%20%20%20%0A(W3CIISLog%0A%7C%20extend%20TrafficDirection%20%3D%20%22InboundOrUnknown%22%2C%20Country%3DRemoteIPCountry%2C%20Latitude%3DRemoteIPLatitude%2C%20Longitude%3DRemoteIPLongitude)%2C%20%0A(DnsEvents%0A%7C%20extend%20TrafficDirection%20%3D%20%22InboundOrUnknown%22%2C%20Country%3D%20RemoteIPCountry%2C%20Latitude%20%3D%20RemoteIPLatitude%2C%20Longitude%20%3D%20RemoteIPLongitude)%2C%0A(WireData%0A%7C%20extend%20TrafficDirection%20%3D%20iff(Direction%20!%3D%20%22Outbound%22%2C%22InboundOrUnknown%22%2C%20%22Outbound%22)%2C%20Country%3DRemoteIPCountry%2C%20Latitude%3DRemoteIPLatitude%2C%20Longitude%3DRemoteIPLongitude)%2C%20%20%20%20%20%0A(WindowsFirewall%0A%7C%20extend%20TrafficDirection%20%3D%20iff(CommunicationDirection%20!%3D%20%22SEND%22%2C%22InboundOrUnknown%22%2C%20%22Outbound%22)%2C%20Country%3DMaliciousIPCountry%2C%20Latitude%3DMaliciousIPLatitude%2C%20Longitude%3DMaliciousIPLongitude)%2C%20%20%20%20%20%0A(CommonSecurityLog%0A%7C%20extend%20TrafficDirection%20%3D%20iff(CommunicationDirection%20!%3D%20%22Outbound%22%2C%22InboundOrUnknown%22%2C%20%22Outbound%22)%2C%20Country%3DMaliciousIPCountry%2C%20Latitude%3DMaliciousIPLatitude%2C%20Longitude%3DMaliciousIPLongitude%2C%20Confidence%3DThreatDescription%2C%20Description%3DThreatDescription)%2C%20%20%20%20%0A(VMConnection%0A%20%20%20%20%7C%20where%20Type%20%3D%3D%20%22VMConnection%22%0A%20%20%20%20%7C%20extend%20TrafficDirection%20%3D%20iff(Direction%20!%3D%20%22outbound%22%2C%22InboundOrUnknown%22%2C%20%22Outbound%22)%2C%20Country%3DRemoteCountry%2C%20Latitude%3DRemoteLatitude%2C%20Longitude%3DRemoteLongitude)%0A%2F%2F%20start%20of%20main%20logic%20%0A%7C%20where%20TimeGenerated%20%26gt%3B%20startofday(ago(daystoSearch))%20and%20TimeGenerated%20%26lt%3B%20startofday(now())%20%20%20%0A%7C%20where%20isnotempty(MaliciousIP)%20and%20isnotempty(Country)%20and%20isnotempty(Latitude)%20and%20isnotempty(Longitude)%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHere%20is%20a%20simplified%20view%20of%20those%20returned%20results%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%3E%0A%3CTABLE%20cellspacing%3D%221%22%20cellpadding%3D%225%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTH%3ETimeGenerated%3C%2FTH%3E%0A%3CTH%3ETrafficDirection%3C%2FTH%3E%0A%3CTH%3ECountry%3C%2FTH%3E%0A%3CTH%3ELongitude%3C%2FTH%3E%0A%3CTH%3ELatitude%3C%2FTH%3E%0A%3CTH%3EMaliciousIP%3C%2FTH%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E2019-10-30T22%3A47%3A29Z%3C%2FTD%3E%0A%3CTD%3EInboundOrUnknown%3C%2FTD%3E%0A%3CTD%3EUnited%20States%3C%2FTD%3E%0A%3CTD%3E-84.39%3C%2FTD%3E%0A%3CTD%3E33.8%3C%2FTD%3E%0A%3CTD%3E1.1.1.1%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CBR%20%2F%3ENow%20I%20want%20to%20enrich%20this%20data%2C%20in%20this%20case%20not%20only%20do%20I%20want%20to%20know%20which%20%3CSTRONG%3ECountry%3C%2FSTRONG%3E%20the%20inbound%20attack%20is%20happening%20from%2C%20I%20also%20want%20to%20know%20the%20distance%20from%20me%20and%20the%20attacker.%26nbsp%3B%20You%20could%20use%20this%20same%20technique%20for%20%3CEM%3EImpossible%20Travel%3C%2FEM%3E%20scenarios%20as%20well%2C%20if%20you%20have%20%3CSTRONG%3ELongitude%3C%2FSTRONG%3E%20and%20%3CSTRONG%3ELatitude%3C%2FSTRONG%3E%20information.%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-845628166%22%20id%3D%22toc-hId-845628166%22%20id%3D%22toc-hId-845628166%22%3EIntroduction%20to%20a%20geospatial%20query%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EKQL%20has%20some%20great%20%3CSPAN%3Egeospatial%26nbsp%3B%3C%2FSPAN%3Efunctions%20(4%20at%20the%20time%20of%20writing)%3B%20in%20this%20example%20I'm%20using%20this%20one%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2Fgeo-distance-2points-function%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2Fgeo-distance-2points-function%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20query%20returns%20the%20Longitude%2FLatitude%20and%20all%20I%20need%20to%20add%20is%20a%20default%20location%20for%20this%20function%20to%20use%2C%20I%20used%20the%20Microsoft%20Campus%20in%20the%20UK.%20I%20will%20then%20use%20this%20to%20measure%20the%20distance%20between%20two%20points.%3C%2FP%3E%0A%3CDIV%3E%0A%3CDIV%3ESimply%20go%20to%20a%20online%20map%20like%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fwww.bing.com%2Fmaps%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EBing%20Maps%3C%2FA%3E%2C%20click%20%26amp%3B%20copy%20on%20a%20area%20to%20get%20your%20own%20coordinates.%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%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%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F152711iCB61E9E93B857F11%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_1.png%22%20title%3D%22clipboard_image_1.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20then%20have%20these%20lines%20of%20KQL%20to%20add.%26nbsp%3B%20Lines%20%231%20and%20%232%20here%20are%20used%20to%20get%20the%20distances%20(in%20both%20KM%20and%20Miles)%20-%20you%20may%20only%20need%20one%20of%20these%3F%26nbsp%3B%20I%20then%20summarize%20the%20returned%20data%20to%20get%20a%20much%20smaller%20set%20of%20rows%20(which%20is%20efficient).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%7C%20extend%20distance_in_kilometers%20%3D%20geo_distance_2points(Longitude%2C%20Latitude%2C%20myLongitude%2C%20myLatitude)%2F1000.00%20%0A%7C%20extend%20distance_in_miles%20%3D%20geo_distance_2points(Longitude%2C%20Latitude%2C%20myLongitude%2C%20myLatitude)%2F1609.344%20%0A%7C%20summarize%20count()%20by%20bin(TimeGenerated%2C1d)%2C%0ACountry%2C%20%0ADistanceKMandMiles%20%3D%20strcat(round(distance_in_kilometers%2C1)%2C%22%20%2F%20%22%2Cround(distance_in_miles%2C1)%20)%2C%0AType%2C%0ATrafficDirection%2C%0AIndicatorThreatType%2C%0ADeviceVendor%0A%7C%20sort%20by%20TimeGenerated%20asc%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EReturned%20result%20of%20our%20now%20optimized%20and%20enriched%20query%20-%20this%20Country%20is%20~%3CSTRONG%3E8182%3C%2FSTRONG%3E%20KMs%20away%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%3E%0A%3CTABLE%20cellspacing%3D%221%22%20cellpadding%3D%225%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTH%3ETimeGenerated%3C%2FTH%3E%0A%3CTH%3ECountry%3C%2FTH%3E%0A%3CTH%3EDistanceKMandMiles%3C%2FTH%3E%0A%3CTH%3EType%3C%2FTH%3E%0A%3CTH%3ETrafficDirection%3C%2FTH%3E%0A%3CTH%3EIndicatorThreatType%3C%2FTH%3E%0A%3CTH%3EDeviceVendor%3C%2FTH%3E%0A%3CTH%3Ecount_%3C%2FTH%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E2019-10-25T00%3A00%3A00Z%3C%2FTD%3E%0A%3CTD%3EPeople's%20Republic%20of%20China%3C%2FTD%3E%0A%3CTD%3E%3CSTRONG%3E%3CFONT%20color%3D%22%23000000%22%3E8182.2%20%3C%2FFONT%3E%3C%2FSTRONG%3E%2F%205084.2%3C%2FTD%3E%0A%3CTD%3EWireData%3C%2FTD%3E%0A%3CTD%3EInboundOrUnknown%3C%2FTD%3E%0A%3CTD%3EBotnet%3C%2FTD%3E%0A%3CTD%3E%26nbsp%3B%3C%2FTD%3E%0A%3CTD%3E40%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1706528795%22%20id%3D%22toc-hId--1706528795%22%20id%3D%22toc-hId--1706528795%22%3EThe%20finished%20query%20(almost)%3A%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%2F%2F%0A%2F%2F%20Look%20back%20at%20data%20and%20see%20if%20any%20from%20six%20named%20tables%20have%20Malicious%20IP%20info%20%0A%2F%2F%20This%20query%20is%20based%20on%20the%20Sentinel%20home%20page%20%22Potential%20malicious%20events%22%20view%20%0A%2F%2F%20We'll%20also%20enrich%20the%20data%20with%20KiloMeter%20distance%20of%20each%20entry%20to%20our%20home%20location%20%0A%2F%2F%0A%2F%2F%20Please%20enter%20how%20many%20days%20worth%20of%20data%20to%20look%20at%3F%0Alet%20daystoSearch%20%3D%207d%3B%20%0A%2F%2F%20Microsoft%20Campus%20UK%20-%20adjust%20as%20required%20with%20your%20own%20Location%20Longitude%20%2F%20Latitude%20%0Alet%20myLongitude%3D%20-0.925915%3B%20%0Alet%20myLatitude%20%3D%2051.461377%3B%0A%2F%2F%20isFuzzy%20will%20allow%20us%20to%20continue%20on%20errors%20or%20if%20a%20table%20is%20empty%20etc...%0Aunion%20isfuzzy%3Dtrue%20%0A(W3CIISLog%0A%7C%20extend%20TrafficDirection%20%3D%20%22InboundOrUnknown%22%2C%20Country%3DRemoteIPCountry%2C%20Latitude%3DRemoteIPLatitude%2C%20Longitude%3DRemoteIPLongitude)%2C%20%0A(DnsEvents%0A%7C%20extend%20TrafficDirection%20%3D%20%22InboundOrUnknown%22%2C%20Country%3D%20RemoteIPCountry%2C%20Latitude%20%3D%20RemoteIPLatitude%2C%20Longitude%20%3D%20RemoteIPLongitude)%2C%0A(WireData%0A%7C%20extend%20TrafficDirection%20%3D%20iff(Direction%20!%3D%20%22Outbound%22%2C%22InboundOrUnknown%22%2C%20%22Outbound%22)%2C%20Country%3DRemoteIPCountry%2C%20Latitude%3DRemoteIPLatitude%2C%20Longitude%3DRemoteIPLongitude)%2C%20%0A(WindowsFirewall%0A%7C%20extend%20TrafficDirection%20%3D%20iff(CommunicationDirection%20!%3D%20%22SEND%22%2C%22InboundOrUnknown%22%2C%20%22Outbound%22)%2C%20Country%3DMaliciousIPCountry%2C%20Latitude%3DMaliciousIPLatitude%2C%20Longitude%3DMaliciousIPLongitude)%2C%20%0A(CommonSecurityLog%0A%7C%20extend%20TrafficDirection%20%3D%20iff(CommunicationDirection%20!%3D%20%22Outbound%22%2C%22InboundOrUnknown%22%2C%20%22Outbound%22)%2C%20Country%3DMaliciousIPCountry%2C%20Latitude%3DMaliciousIPLatitude%2C%20Longitude%3DMaliciousIPLongitude%2C%20Confidence%3DThreatDescription%2C%20Description%3DThreatDescription)%2C%20%0A(VMConnection%0A%7C%20where%20Type%20%3D%3D%20%22VMConnection%22%0A%7C%20extend%20TrafficDirection%20%3D%20iff(Direction%20!%3D%20%22outbound%22%2C%22InboundOrUnknown%22%2C%20%22Outbound%22)%2C%20Country%3DRemoteCountry%2C%20Latitude%3DRemoteLatitude%2C%20Longitude%3DRemoteLongitude)%0A%2F%2F%20Start%20of%20main%20logic%20%0A%7C%20where%20TimeGenerated%20%26gt%3B%20startofday(ago(daystoSearch))%20and%20TimeGenerated%20%26lt%3B%20startofday(now())%20%0A%7C%20where%20isnotempty(MaliciousIP)%20and%20isnotempty(Country)%20and%20isnotempty(Latitude)%20and%20isnotempty(Longitude)%0A%7C%20extend%20distance_in_kilometers%20%3D%20geo_distance_2points(Longitude%2C%20Latitude%2C%20myLongitude%2C%20myLatitude)%2F1000.00%20%0A%7C%20extend%20distance_in_miles%20%3D%20geo_distance_2points(Longitude%2C%20Latitude%2C%20myLongitude%2C%20myLatitude)%2F1609.344%20%0A%7C%20summarize%20count()%20by%20bin(TimeGenerated%2C1d)%2C%0ACountry%2C%20%0ADistanceKMandMiles%20%3D%20strcat(round(distance_in_kilometers%2C1)%2C%22%20%2F%20%22%2Cround(distance_in_miles%2C1)%20)%2C%0AType%2C%0ATrafficDirection%2C%0AIndicatorThreatType%2C%0ADeviceVendor%0A%7C%20sort%20by%20TimeGenerated%20asc%0A%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-36281540%22%20id%3D%22toc-hId-36281540%22%20id%3D%22toc-hId-36281540%22%3EMake%20your%20own%20World%20Map%20in%20Azure%20Monitor%20Workbooks%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20let%20take%20that%20information%20and%20make%20our%20own%20Map%20from%20it%2C%20we%20will%20use%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-monitor%2Finsights%2Fvminsights-workbooks%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Monitor%20workbooks%3C%2FA%3E%20for%20that.%20Now%20rather%20than%20using%20an%20'Empty%20Workbook'%2C%20I'm%20starting%20with%20the%20%3CSTRONG%3EWorkspace%20Usage%3C%2FSTRONG%3E%20one%20(as%20its%20has%20a%20drop%20down%20for%20%3CSTRONG%3ESubscription%3C%2FSTRONG%3E%2C%20%3CSTRONG%3EWorkspace%3C%2FSTRONG%3E%20and%20%3CSTRONG%3ETime%3C%2FSTRONG%3E%20already%20configured)%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F152715i8F366B1FC5A04188%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_2.png%22%20title%3D%22clipboard_image_2.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3ENow%20Press%20%3CSTRONG%3EEdit%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F152716iCC8EDE11405A5E90%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_3.png%22%20title%3D%22clipboard_image_3.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CDIV%3ENow%20do%20a%20%22SAVE%20AS%22%20and%20Name%20your%20new%20workbook%2C%20mine%20for%20example%20is%20called%20%22MyNewMap%22%20and%20complete%20any%20other%20requested%20fields.%3C%2FDIV%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F152717iE40428011AC7B6B9%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_4.png%22%20title%3D%22clipboard_image_4.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CDIV%3EOptionally%20you%20can%20delete%20the%20other%20charts%20and%20tables%20in%20this%20workbook%20to%20tidy%20it%20up.%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20press%2C%20the%20second%20button%20called%26nbsp%3B%3CSTRONG%3EEdit%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F152718i9C284C1C33188415%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_5.png%22%20title%3D%22clipboard_image_5.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EFollowed%20by%20%3CSTRONG%3EAdd%20Query%3C%2FSTRONG%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F152719i6E13FFB56801F3F2%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_6.png%22%20title%3D%22clipboard_image_6.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20paste%20in%20the%20completed%20KQL%20query%2C%20then%20select%20the%20Workspace%20drop%20down%20and%20select%20the%20%22workspace%22%20check%20box.%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20you%20can%20swap%20between%20workspaces%20(and%20Subscriptions)%20using%20the%20drop%20down%20-%20especially%20handy%20if%20you%20are%20suing%20Azure%20Lighthouse%20or%20have%20multiple%20subscriptions%2Fworkspaces.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%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%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F152721i22FAAF768AD4CD38%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_7.png%22%20title%3D%22clipboard_image_7.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EWe%20can%20also%20use%20the%20TimeRange%20picker%20now%2C%20but%20before%20you%20do%20we%20need%20to%20adjust%20the%20KQL%20again%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1779091875%22%20id%3D%22toc-hId-1779091875%22%20id%3D%22toc-hId-1779091875%22%3EAdjust%20the%20KQL%20to%20make%20it%20Workbook%20friendly%26nbsp%3B%3C%2FH3%3E%0A%3CDIV%3EShortcut%20Tip%3A%20you%20can%20get%20the%20completed%20workbook%20ready%20query%20from%20%3CA%20href%3D%22https%3A%2F%2Fms.portal.azure.com%23%4072f988bf-86f1-41af-91ab-2d7cd011db47%2Fblade%2FMicrosoft_Azure_Monitoring_Logs%2FDemoLogsBlade%2FresourceId%2F%252FDemo%2Fsource%2FLogsBlade.AnalyticsShareLinkToQuery%2Fq%2FH4sIAAAAAAAAA7WV308bSQzH35H4H3x5aSJt86NAEUXRPZC2igpX1NDjEU12vVkfu%25252BN0ZpZ0ubv%25252FJX9L%25252FrLzTEh2EXCoqH2ItGNP7M%25252FXtsa93u5OrwenzNcwVfE1KAeJcgqUTsAiAqXyWUFquABL30GrAhNwapqjhUzdIJypnGLi0sL4HEinDCHkRUYWvpVoKpCPqbLyN9bgMoQJakcac8i4QJirGULrnJ23qhyKbTy8EZNtwQ3hYh30El%25252FlOajcMqA2FGchXgBekMvgE%25252BV8hg4NJGSd0jECp4BKLkooQXEMXJp14pxj5UiYfOgQ%25252FjxH4fRX0d9ZCItoT1RlYcFG4kuwkEzC5L5kyv3u%25252F5ijC7ccT1AZSTaEw%25252BR4jXxGsWHLqYMTVcxF1ddP8BpU8ldpHSgLBr%25252BVZKQ4QUDl6XihpSN3cKesZ%25252BTKBEHaJKbwubvjUxbV1jmE1%25252F3u0ZuDo8HBce3dXB%25252FCwaC7%25252F3awd3h4HKDIfihvbyvJGcqZi1QhE1Ux%25252B9aU6FuFxrCxwCYMwbrnvpdYzF0F6OJut7u7U2pPSTb1AYfOlJ6ufbl3Mh5PTnm2u%25252FMP4HfpbQIXRqUpxSNRGwdpQ2iN9ZRLnXw2X%25252FW1Ft2tCE7EIK0afsFCZmJ8fneOtuq3no0hqotU%25252BzaWTuR5Rtq%25252BD9P0ch54Eghq3yNITW8N5WskiUcyTf%25252BPRGnars%25252B%25252FCePn0gXIVvQYbu3u%25252FKJaXpJOeGE%25252FCNRCZud5%25252FBMuChmT9UDf1zJ5%25252F8foB3Rs35rHpDScj6lpuu8L8nysJxiXhlz17NA%25252BI%25252BkF7fnZsnxknVKC8gAOLzKDyo3QxobmnjKCxuGhe12TP88khF7L8uVYZGgQLqq5zLOIbLpbPzrA%25252FNIBfmp8nx7eutPh3Zs4ZZx%25252FxQtFWp7wGcXQUEcFfkSNRjl5j%25252BFvf%25252F6i9AzfhT32b32TrJbg%25252Fh1sN%25252BrfCVuz4bvjfWDf8D50NHC3Nd2ssivSV9ey4Aq%25252F4KxUdoZ8tXW%25252BmTPJ%25252B9ZuDEFdlsamiBqLodMb9Pv9br8PT6QryK%25252F5n5Ppbf%25252Bou7e%25252F71OtlrYsCmXoFlfL2Bep3Vktp5X8SLfvtSEaZJ1otdx0frV8gCe2nPVqOVwt69RiU25tuyPwCh3PYdCHaQUh6dV%25252F%25252FkcpAf4IAAA%25253D%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E%3C%2FDIV%3E%0A%3CP%3EIf%20you%20want%20to%20make%20the%20changes%20yourself%20and%20ignore%20the%20'tip'%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E1.%20remove%20or%20comment%20out%20the%20let%20command%20as%20shown%20in%20the%20next%20screen%20shot.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3E2.%20Set%20%3CSTRONG%3ETimeRange%3C%2FSTRONG%3E%20to%20the%20%3CSTRONG%3ETimeRange%3C%2FSTRONG%3E%20check%20box%20-%20this%20will%20tell%20the%20KQL%20to%20get%20that%20info%20from%20the%20drop%20down.%26nbsp%3B%26nbsp%3BAlso%20shown%20in%20the%20next%20screen%20shot.%3C%2FP%3E%0A%3CP%3E3.%20We%20need%20a%203rd%20and%204th%20change%20(to%20get%20the%20TimeRange%20Picker%20to%20work)%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EReplace%20the%20line%3A%3C%2FP%3E%0A%3CDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CDIV%3E%0A%3CDIV%3E%0A%3CDIV%3E%7C%20where%20TimeGenerated%20%26gt%3B%20startofday(ago(daystoSearch))%20and%20TimeGenerated%20%26lt%3B%20startofday(now())%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3Ewith%3C%2FP%3E%0A%3CP%3E%7C%26nbsp%3Bwhere%26nbsp%3BTimeGenerated%26nbsp%3B%7BTimeRange%3Aquery%7D%3C%2FP%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3EAnd%20also%20change%20this%20line.%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%0A%3CDIV%3E%7C%26nbsp%3Bsummarize%26nbsp%3Bcount()%26nbsp%3Bby%26nbsp%3Bbin(TimeGenerated%2C1d)%3C%2FDIV%3E%0A%3CDIV%3Ewith%3C%2FDIV%3E%0A%3CDIV%3E%7C%26nbsp%3Bsummarize%26nbsp%3Bcount()%26nbsp%3Bby%26nbsp%3Bbin(TimeGenerated%2C1h)%2C%26nbsp%3BCountry%2C%26nbsp%3Bdistance_in_miles%2C%26nbsp%3Blon%26nbsp%3B%3D%26nbsp%3BLongitude%2C%26nbsp%3Blat%26nbsp%3B%3D%26nbsp%3BLatitude%3C%2FDIV%3E%0A%3CDIV%3E%0A%3CDIV%3E%0A%3CDIV%3E%7C%26nbsp%3Btop%26nbsp%3B10%26nbsp%3Bby%26nbsp%3Bcount_%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CDIV%3E%0A%3CDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%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%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F152722iD58D3032907D5AEA%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_8.png%22%20title%3D%22clipboard_image_8.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ENow%20when%20you%20click%20on%20TimeRange%20(the%20top%20one)%3B%20you%20can%20now%20select%20the%20Time%20Range%20required.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F152724i9B34EF08138A6860%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_9.png%22%20title%3D%22clipboard_image_9.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EDo%20you%20see%20data%20displayed%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--773065086%22%20id%3D%22toc-hId--773065086%22%20id%3D%22toc-hId--773065086%22%3ENow%20for%20the%20final%20flourish%20-%3C%2FH3%3E%0A%3CP%3ECreating%20our%20Map%2C%20by%20swapping%20the%20Visualization%20to%20%22Map%22%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%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F152725iC45B000F2BA79AB7%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_10.png%22%20title%3D%22clipboard_image_10.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20then%20used%20these%20settings%2C%20when%20you%20are%20happy%20with%20mine%20or%20use%20yours%2C%20press%20%3CSTRONG%3EApply%3C%2FSTRONG%3E%2C%20then%20%3CSTRONG%3ESave%20%26amp%3B%20Close%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F152727i45AB5594CDDAAABC%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_12.png%22%20title%3D%22clipboard_image_12.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EYou%20should%20now%20have%20a%20%3CEM%3EHeatmap%3C%2FEM%3E%20with%20the%20Distance%20in%20Miles%20(or%20KM)%20displayed.%26nbsp%3B%20Now%20just%20press%20%3CSTRONG%3EDone%20Editing%3C%2FSTRONG%3E%20and%20%3CSTRONG%3ESave%3C%2FSTRONG%3E%20your%20workbook!%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F152729i71036E4109088E65%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_13.png%22%20title%3D%22clipboard_image_13.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-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-971818%22%20slang%3D%22en-US%22%3E%3CH2%20id%3D%22toc-hId-1166258754%22%20id%3D%22toc-hId-1166258754%22%3ESummary%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20this%20post%20I'm%20going%20to%20describe%20how%20to%20use%20Sentinel%20data%20to%20provide%20insights%20and%20show%20those%20on%20a%20world%20map.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-971818%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Sentinel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-989894%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20use%20Azure%20Monitor%20Workbooks%20to%20map%20Sentinel%20data%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-989894%22%20slang%3D%22en-US%22%3E%3CP%3Ethanks%20for%20the%20blog%20post%20I've%20been%20looking%20how%20to%20do%20this%20exact%20thing%20for%20a%20few%20weeks%20now.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft

For this post I'm going to start with the query on the Sentinel Home Page that shows Potential MaliciousIP events.  Here is the example from my portal:

clipboard_image_0.png 

Note: There are indicators for Inbound and Outbound MaliciousIP on this map.  I often get asked how we get this info, please read on.

 

Prepare your query 


This is the basic Kusto Query Language (KQL) I have used to look at the Log Analytics data.  I have changed the format slightly to left align it, and removed the detected regions for now - i.e. kept it simple.  You can use any data source with Longitude or Latitude data.

 

 

 

 

union isfuzzy=true 
(W3CIISLog
| extend TrafficDirection = "InboundOrUnknown", Country=RemoteIPCountry, Latitude=RemoteIPLatitude, Longitude=RemoteIPLongitude), 
(DnsEvents
| extend TrafficDirection = "InboundOrUnknown", Country= RemoteIPCountry, Latitude = RemoteIPLatitude, Longitude = RemoteIPLongitude),
(WireData
| extend TrafficDirection = iff(Direction != "Outbound","InboundOrUnknown", "Outbound"), Country=RemoteIPCountry, Latitude=RemoteIPLatitude, Longitude=RemoteIPLongitude), 
(WindowsFirewall
| extend TrafficDirection = iff(CommunicationDirection != "SEND","InboundOrUnknown", "Outbound"), Country=MaliciousIPCountry, Latitude=MaliciousIPLatitude, Longitude=MaliciousIPLongitude), 
(CommonSecurityLog
| extend TrafficDirection = iff(CommunicationDirection != "Outbound","InboundOrUnknown", "Outbound"), Country=MaliciousIPCountry, Latitude=MaliciousIPLatitude, Longitude=MaliciousIPLongitude, Confidence=ThreatDescription, Description=ThreatDescription), 
(VMConnection
| where Type == "VMConnection"
| extend TrafficDirection = iff(Direction != "outbound","InboundOrUnknown", "Outbound"), Country=RemoteCountry, Latitude=RemoteLatitude, Longitude=RemoteLongitude)

 

 

 

 

Summary of the query:

The query looks in 1-6 Tables and if there are Inbound or Outbound MaliciousIP addresses it notes them, the data feed provides lots of good columns of data, in this article its the Longitude and Latitude I'm mainly focusing on. 

Now we have the basics, we can add some extra filtering, in the below I've added some Let statements at the beginning and some Time filtering at the end - to get 7 days of data in this example case.

 

 

 

 

 

let daystoSearch = 7d; // Please enter how many days worth of data to look at?
let myLongitude  = -0.925915;  // Microsoft Campus UK
let myLatitude   = 51.461377;
union isfuzzy=true   
(W3CIISLog
| extend TrafficDirection = "InboundOrUnknown", Country=RemoteIPCountry, Latitude=RemoteIPLatitude, Longitude=RemoteIPLongitude), 
(DnsEvents
| extend TrafficDirection = "InboundOrUnknown", Country= RemoteIPCountry, Latitude = RemoteIPLatitude, Longitude = RemoteIPLongitude),
(WireData
| extend TrafficDirection = iff(Direction != "Outbound","InboundOrUnknown", "Outbound"), Country=RemoteIPCountry, Latitude=RemoteIPLatitude, Longitude=RemoteIPLongitude),     
(WindowsFirewall
| extend TrafficDirection = iff(CommunicationDirection != "SEND","InboundOrUnknown", "Outbound"), Country=MaliciousIPCountry, Latitude=MaliciousIPLatitude, Longitude=MaliciousIPLongitude),     
(CommonSecurityLog
| extend TrafficDirection = iff(CommunicationDirection != "Outbound","InboundOrUnknown", "Outbound"), Country=MaliciousIPCountry, Latitude=MaliciousIPLatitude, Longitude=MaliciousIPLongitude, Confidence=ThreatDescription, Description=ThreatDescription),    
(VMConnection
    | where Type == "VMConnection"
    | extend TrafficDirection = iff(Direction != "outbound","InboundOrUnknown", "Outbound"), Country=RemoteCountry, Latitude=RemoteLatitude, Longitude=RemoteLongitude)
// start of main logic 
| where TimeGenerated > startofday(ago(daystoSearch)) and TimeGenerated < startofday(now())   
| where isnotempty(MaliciousIP) and isnotempty(Country) and isnotempty(Latitude) and isnotempty(Longitude)

 

 

 

 

 

Here is a simplified view of those returned results:

 

TimeGenerated TrafficDirection Country Longitude Latitude MaliciousIP
2019-10-30T22:47:29Z InboundOrUnknown United States -84.39 33.8 1.1.1.1


Now I want to enrich this data, in this case not only do I want to know which Country the inbound attack is happening from, I also want to know the distance from me and the attacker.  You could use this same technique for Impossible Travel scenarios as well, if you have Longitude and Latitude information.

Introduction to a geospatial query

 

KQL has some great geospatial functions (4 at the time of writing); in this example I'm using this one https://docs.microsoft.com/en-us/azure/kusto/query/geo-distance-2points-function 

 

The query returns the Longitude/Latitude and all I need to add is a default location for this function to use, I used the Microsoft Campus in the UK. I will then use this to measure the distance between two points.

Simply go to a online map like Bing Maps, click & copy on a area to get your own coordinates.
 

 

 

clipboard_image_1.png

 

I then have these lines of KQL to add.  Lines #1 and #2 here are used to get the distances (in both KM and Miles) - you may only need one of these?  I then summarize the returned data to get a much smaller set of rows (which is efficient).

 

 

 

 

| extend distance_in_kilometers = geo_distance_2points(Longitude, Latitude, myLongitude, myLatitude)/1000.00 
| extend distance_in_miles = geo_distance_2points(Longitude, Latitude, myLongitude, myLatitude)/1609.344 
| summarize count() by bin(TimeGenerated,1d),
Country, 
DistanceKMandMiles = strcat(round(distance_in_kilometers,1)," / ",round(distance_in_miles,1) ),
Type,
TrafficDirection,
IndicatorThreatType,
DeviceVendor
| sort by TimeGenerated asc

 

 

 

 

Returned result of our now optimized and enriched query - this Country is ~8182 KMs away:

 

TimeGenerated Country DistanceKMandMiles Type TrafficDirection IndicatorThreatType DeviceVendor count_
2019-10-25T00:00:00Z People's Republic of China 8182.2 / 5084.2 WireData InboundOrUnknown Botnet   40

 

The finished query (almost):

 

 

 

 

//
// Look back at data and see if any from six named tables have Malicious IP info 
// This query is based on the Sentinel home page "Potential malicious events" view 
// We'll also enrich the data with KiloMeter distance of each entry to our home location 
//
// Please enter how many days worth of data to look at?
let daystoSearch = 7d; 
// Microsoft Campus UK - adjust as required with your own Location Longitude / Latitude 
let myLongitude= -0.925915; 
let myLatitude = 51.461377;
// isFuzzy will allow us to continue on errors or if a table is empty etc...
union isfuzzy=true 
(W3CIISLog
| extend TrafficDirection = "InboundOrUnknown", Country=RemoteIPCountry, Latitude=RemoteIPLatitude, Longitude=RemoteIPLongitude), 
(DnsEvents
| extend TrafficDirection = "InboundOrUnknown", Country= RemoteIPCountry, Latitude = RemoteIPLatitude, Longitude = RemoteIPLongitude),
(WireData
| extend TrafficDirection = iff(Direction != "Outbound","InboundOrUnknown", "Outbound"), Country=RemoteIPCountry, Latitude=RemoteIPLatitude, Longitude=RemoteIPLongitude), 
(WindowsFirewall
| extend TrafficDirection = iff(CommunicationDirection != "SEND","InboundOrUnknown", "Outbound"), Country=MaliciousIPCountry, Latitude=MaliciousIPLatitude, Longitude=MaliciousIPLongitude), 
(CommonSecurityLog
| extend TrafficDirection = iff(CommunicationDirection != "Outbound","InboundOrUnknown", "Outbound"), Country=MaliciousIPCountry, Latitude=MaliciousIPLatitude, Longitude=MaliciousIPLongitude, Confidence=ThreatDescription, Description=ThreatDescription), 
(VMConnection
| where Type == "VMConnection"
| extend TrafficDirection = iff(Direction != "outbound","InboundOrUnknown", "Outbound"), Country=RemoteCountry, Latitude=RemoteLatitude, Longitude=RemoteLongitude)
// Start of main logic 
| where TimeGenerated > startofday(ago(daystoSearch)) and TimeGenerated < startofday(now()) 
| where isnotempty(MaliciousIP) and isnotempty(Country) and isnotempty(Latitude) and isnotempty(Longitude)
| extend distance_in_kilometers = geo_distance_2points(Longitude, Latitude, myLongitude, myLatitude)/1000.00 
| extend distance_in_miles = geo_distance_2points(Longitude, Latitude, myLongitude, myLatitude)/1609.344 
| summarize count() by bin(TimeGenerated,1d),
Country, 
DistanceKMandMiles = strcat(round(distance_in_kilometers,1)," / ",round(distance_in_miles,1) ),
Type,
TrafficDirection,
IndicatorThreatType,
DeviceVendor
| sort by TimeGenerated asc

 

 

 

 

 

 

Make your own World Map in Azure Monitor Workbooks

 

Now let take that information and make our own Map from it, we will use Azure Monitor workbooks for that. Now rather than using an 'Empty Workbook', I'm starting with the Workspace Usage one (as its has a drop down for Subscription, Workspace and Time already configured)

clipboard_image_2.png



Now Press Edit

clipboard_image_3.png

Now do a "SAVE AS" and Name your new workbook, mine for example is called "MyNewMap" and complete any other requested fields.

clipboard_image_4.png

Optionally you can delete the other charts and tables in this workbook to tidy it up.

 

Now press, the second button called Edit

clipboard_image_5.png

Followed by Add Query 

clipboard_image_6.png

 

Now paste in the completed KQL query, then select the Workspace drop down and select the "workspace" check box. 

Now you can swap between workspaces (and Subscriptions) using the drop down - especially handy if you are suing Azure Lighthouse or have multiple subscriptions/workspaces.

 

 

clipboard_image_7.png

We can also use the TimeRange picker now, but before you do we need to adjust the KQL again

 

Adjust the KQL to make it Workbook friendly 

Shortcut Tip: you can get the completed workbook ready query from here

If you want to make the changes yourself and ignore the 'tip':

 

1. remove or comment out the let command as shown in the next screen shot.  

2. Set TimeRange to the TimeRange check box - this will tell the KQL to get that info from the drop down.  Also shown in the next screen shot.

3. We need a 3rd and 4th change (to get the TimeRange Picker to work) 

 

Replace the line:

 
| where TimeGenerated > startofday(ago(daystoSearch)) and TimeGenerated < startofday(now())

with

| where TimeGenerated {TimeRange:query}

 

And also change this line.  

 
| summarize count() by bin(TimeGenerated,1d)
with
| summarize count() by bin(TimeGenerated,1h), Country, distance_in_miles, lon = Longitude, lat = Latitude
| top 10 by count_ 
 

 

clipboard_image_8.png

Now when you click on TimeRange (the top one); you can now select the Time Range required.

clipboard_image_9.png

Do you see data displayed?

 

Now for the final flourish -

Creating our Map, by swapping the Visualization to "Map"

 

clipboard_image_10.png

 

I then used these settings, when you are happy with mine or use yours, press Apply, then Save & Close

clipboard_image_12.png

You should now have a Heatmap with the Distance in Miles (or KM) displayed.  Now just press Done Editing and Save your workbook!

clipboard_image_13.png

 

 

1 Comment
Regular Visitor

thanks for the blog post I've been looking how to do this exact thing for a few weeks now.