Repository navigation
Expand file tree
/
Copy pathUserMap.workbook
More file actions
2214 lines (2214 loc) · 98.9 KB
/
Copy pathUserMap.workbook
File metadata and controls
2214 lines (2214 loc) · 98.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"version": "Notebook/1.0",
"items": [
{
"type": 9,
"content": {
"version": "KqlParameterItem/1.0",
"parameters": [
{
"id": "1ca69445-60fc-4806-b43d-ac7e6aad630a",
"version": "KqlParameterItem/1.0",
"name": "Subscription",
"type": 6,
"isRequired": true,
"value": "/subscriptions/00000000-0000-0000-0000-000000000000",
"typeSettings": {
"additionalResourceOptions": [],
"includeAll": false
}
},
{
"id": "e94aafa3-c5d9-4523-89f0-4e87aa754511",
"version": "KqlParameterItem/1.0",
"name": "Workspace",
"type": 5,
"isRequired": true,
"query": "Resources \n| where type =~ \"microsoft.operationalinsights/workspaces\" \n| order by name \n| project id, name, selected=row_number()==1, group=resourceGroup",
"crossComponentResources": [
"{Subscription}"
],
"typeSettings": {
"resourceTypeFilter": {
"microsoft.operationalinsights/workspaces": true
},
"additionalResourceOptions": []
},
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources",
"value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/placeholder-rg/providers/Microsoft.OperationalInsights/workspaces/placeholder-workspace"
},
{
"id": "c4b69c01-2263-4ada-8d9c-43433b739ff3",
"version": "KqlParameterItem/1.0",
"name": "TimeRange",
"type": 4,
"isRequired": true,
"value": {
"durationMs": 5184000000
},
"typeSettings": {
"selectableValues": [
{
"durationMs": 300000
},
{
"durationMs": 900000
},
{
"durationMs": 1800000
},
{
"durationMs": 3600000
},
{
"durationMs": 14400000
},
{
"durationMs": 43200000
},
{
"durationMs": 86400000
},
{
"durationMs": 172800000
},
{
"durationMs": 259200000
},
{
"durationMs": 604800000
},
{
"durationMs": 1209600000
},
{
"durationMs": 2592000000
},
{
"durationMs": 5184000000
},
{
"durationMs": 7776000000
}
],
"allowCustom": true
}
},
{
"id": "6ed3bbc6-be3f-44ed-84b3-9908e7c92315",
"version": "KqlParameterItem/1.0",
"name": "Help",
"type": 10,
"isRequired": true,
"typeSettings": {
"additionalResourceOptions": []
},
"jsonData": "[\r\n { \"value\": \"Yes\", \"label\": \"Yes\"},\r\n {\"value\": \"No\", \"label\": \"No\", \"selected\":true },\r\n { \"value\": \"Change Log\", \"label\": \"Change Log\"}\r\n]"
}
],
"style": "above",
"queryType": 0,
"resourceType": "microsoft.resourcegraph/resources"
},
"customWidth": "70",
"name": "parameters - 1"
},
{
"type": 9,
"content": {
"version": "KqlParameterItem/1.0",
"parameters": [
{
"id": "e648443b-bf59-4ae6-8c04-a5edf7097da6",
"version": "KqlParameterItem/1.0",
"name": "Measurement",
"type": 10,
"isRequired": true,
"typeSettings": {
"additionalResourceOptions": []
},
"jsonData": "[\r\n{\"value\": \"KM\", \"label\": \"KM\"},\r\n{\"value\": \"Miles\", \"label\": \"Miles\", \"selected\":true}\r\n]"
},
{
"id": "ba4eb749-336e-4aa0-8a4b-2b7987507852",
"version": "KqlParameterItem/1.0",
"name": "Top",
"label": "Show Top locations",
"type": 2,
"description": "Only show this amount of locations om the map",
"isRequired": true,
"typeSettings": {
"additionalResourceOptions": [],
"showDefault": false
},
"jsonData": "[\r\n{ \"value\": \"5\", \"label\": \"5\"},\r\n{\"value\": \"10\", \"label\": \"10\", \"selected\":true },\r\n{\"value\": \"20\", \"label\": \"20\" },\r\n{\"value\": \"30\", \"label\": \"30\" },\r\n{\"value\": \"50\", \"label\": \"50\" }\r\n]"
}
],
"style": "above",
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces"
},
"customWidth": "30",
"name": "parameters - settings"
},
{
"type": 11,
"content": {
"version": "LinkItem/1.0",
"style": "tabs",
"links": [
{
"id": "8f36c3bf-807c-4478-bfc2-570584d36bb9",
"cellValue": "selectedTab",
"linkTarget": "parameter",
"linkLabel": "Malicious IP",
"subTarget": "MaliciousIP",
"style": "link"
},
{
"id": "0d78c03f-f8d7-40da-8761-3ef454b14ad8",
"cellValue": "selectedTab",
"linkTarget": "parameter",
"linkLabel": "User Data",
"subTarget": "UserData",
"style": "link"
},
{
"id": "d5ae52bd-03a5-452e-a395-98fbe02b6e20",
"cellValue": "selectedTab",
"linkTarget": "parameter",
"linkLabel": "Microsoft WAF",
"subTarget": "WAF",
"style": "link"
}
]
},
"name": "links - 5"
},
{
"type": 1,
"content": {
"json": "#### Tab One. Malicious IP \r\nThis report can get data from a number of sources (six are defined in this release) to show the distance from the Malicious IP addresses to a selected users default location. \r\nYou may see an error if one or more data sources are missing. There will be no entries if *all* sources are missing - there is a warning dialog box displayed if this happens.\r\nThis is a similar view to the one shown on the Summary page of Azure Sentinel, but this is showing distance data as well.\r\nThere are three options to aid filtering:\r\n1. Select a Location from a list (for that you will have to edit this workbook and amend the \"CityList\" parameter if you require changes to the capital cities I have provided). Please save the JSON of any co-ordinates you add, as you will need to add them back if you ever update the workbook to a newer version. This is useful if you have some office locations or important places that you wish to add.\r\n2. Select from Azure Active Directory (AAD), if the SigninLogs table exists, this will populate from the latest record, a entry per City /( Country ) with Longitude and Latitude data.\r\n3. Enter a Latitude and Longitude of your choice, and a label to describe the location. \r\nYou may also select to show the data in Kilometers (KM) or Miles. You can also set how many locations to show, 5, 10, 20 etc...\r\n\r\nDatasources: WireData, VMconnection, CommonSecurityLog, WindowsFirewall, W3CIISLog and DnsEvents \r\n\t\t\t Note: SigninLogs is required to build the AAD list, if you dont have this critical datasource, please use options #1 or #3.\r\n\r\n#### Tab two. Locations and distances (User Data)\r\nInformation using Azure Active Directory (AAD) Signinlogs data, this shows user Signin Locations and distance between as well as order visited (you select a User from dropdown options, ordered by their signin count). \r\n\r\nDatasources:SigninLogs\r\n\r\n#### Tab three. Microsoft WAF \r\nShow Azure Front door and Application Gateway Web Application Firewall \r\n\r\nDatasources: AzureDiagnostics\r\n",
"style": "info"
},
"conditionalVisibility": {
"parameterName": "Help",
"comparison": "isEqualTo",
"value": "Yes"
},
"name": "text - 8"
},
{
"type": 1,
"content": {
"json": "### Change Log\r\n|Version|Description|\r\n|---|---|\r\n|v1.0\t|Initial Version|\r\n|V1.1.0\t|Updated from 2019 version, combining new features and improving the look and feel. | \r\n|V1.1.1\t|Updated chart to display Location, Latitude, Longitude when a region is clicked| \r\n|V1.2\t|Added info when you select a region on the 'Map showing locations for User', fixed a time display message. Added dwell time (the time delay between the entries), in the \"looking for\" grid to augment the distance travelled.|\r\n|V1.3| Add support for a drop down warning, and UserMap user selection options (user by count, User by first Letter & free text search) |"
},
"conditionalVisibility": {
"parameterName": "Help",
"comparison": "isEqualTo",
"value": "Change Log"
},
"name": "text - 7"
},
{
"type": 12,
"content": {
"version": "NotebookGroup/1.0",
"groupType": "editable",
"title": "Group: Malicious IP",
"items": [
{
"type": 9,
"content": {
"version": "KqlParameterItem/1.0",
"parameters": [
{
"id": "b12b1e24-c504-4ccb-9f00-3dc445232897",
"version": "KqlParameterItem/1.0",
"name": "getLocation",
"label": "Location selector",
"type": 10,
"isRequired": true,
"typeSettings": {
"additionalResourceOptions": []
},
"jsonData": "[\r\n { \"value\": \"mylist\", \"label\": \"From a list\",\"selected\":true},\r\n {\"value\": \"aad\", \"label\": \"From AAD\"},\r\n { \"value\": \"manual\", \"label\": \"Add a manual entry\"}\r\n]",
"timeContext": {
"durationMs": 86400000
},
"value": "aad"
}
],
"style": "above",
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces"
},
"customWidth": "30",
"name": "parameters - 7"
},
{
"type": 9,
"content": {
"version": "KqlParameterItem/1.0",
"parameters": [
{
"id": "d14c2e32-c58e-4409-b2ea-14394a69e70e",
"version": "KqlParameterItem/1.0",
"name": "CityList",
"label": "Location - custom list",
"type": 2,
"description": "Edit this parameter to provide your own locations - please see Help",
"isRequired": true,
"value": "48.856613,2.352222",
"typeSettings": {
"additionalResourceOptions": [],
"showDefault": false
},
"jsonData": "[\r\n{ \"value\": \"51.507351,-0.127758\" ,\"label\": \"London\"},\r\n{ \"value\": \"48.856613,2.352222\" ,\"label\": \"Paris\"},\r\n{ \"value\": \"40.712776,-74.005974\",\"label\": \"New York\"},\r\n{ \"value\": \"47.608013,-122.335167\",\"label\": \"Seattle\"},\r\n{ \"value\": \"41.881832,-87.623177\",\"label\": \"Chicago\"},\r\n{ \"value\": \"-33.865143,151.209900\",\"label\": \"Sydney\"}\r\n]"
},
{
"id": "a1c6c49d-c452-4010-851a-55f5f950df23",
"version": "KqlParameterItem/1.0",
"name": "defaultCityList",
"type": 1,
"isHiddenWhenLocked": true,
"criteriaData": [
{
"criteriaContext": {
"leftOperand": "CityList",
"operator": "isNotNull",
"rightValType": "param",
"resultValType": "static",
"resultVal": "{CityList:label}"
}
},
{
"criteriaContext": {
"operator": "Default",
"rightValType": "param",
"resultValType": "param",
"resultVal": "CityList"
}
}
]
}
],
"style": "above",
"doNotRunWhenHidden": true,
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces"
},
"conditionalVisibility": {
"parameterName": "getLocation",
"comparison": "isEqualTo",
"value": "mylist"
},
"name": "parameters - mylist"
},
{
"type": 9,
"content": {
"version": "KqlParameterItem/1.0",
"parameters": [
{
"id": "d14c2e32-c58e-4409-b2ea-14394a69e70e",
"version": "KqlParameterItem/1.0",
"name": "CityListAAD",
"label": "Location - obtained from AAD ",
"type": 2,
"description": "Locations found in AAD",
"isRequired": true,
"query": "SigninLogs\r\n| where UserDisplayName !=\"On-Premises Directory Synchronization Service Account\"\r\n| extend city_ = tostring(LocationDetails.city) \r\n| extend latitude_ = tostring(parse_json(tostring(LocationDetails.geoCoordinates)).latitude) \r\n| extend longitude_ = tostring(parse_json(tostring(LocationDetails.geoCoordinates)).longitude) \r\n| summarize count(), arg_max(TimeGenerated,*) by city_\r\n| where isnotempty(city_)\r\n| distinct city_ , count_, latitude_, longitude_, Location\r\n| extend city_ = strcat(city_,\" (\", Location ,\")\")\r\n| project label = strcat(city_,\",\",latitude_,\",\",longitude_), value = city_\r\n| order by label asc\r\n",
"crossComponentResources": [
"{Workspace}"
],
"value": "Middletown (US),39.44351959228515,-84.37008666992188",
"typeSettings": {
"additionalResourceOptions": [],
"showDefault": false
},
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces"
},
{
"id": "56079538-c786-4a1f-8e20-c33232a46852",
"version": "KqlParameterItem/1.0",
"name": "defaultCityListAAD",
"type": 1,
"isRequired": true,
"isHiddenWhenLocked": true,
"criteriaData": [
{
"criteriaContext": {
"leftOperand": "CityListAAD",
"operator": "is Empty",
"rightValType": "param",
"resultValType": "static",
"resultVal": "\"no AAD\""
}
},
{
"criteriaContext": {
"operator": "Default",
"rightValType": "param",
"resultValType": "param",
"resultVal": "CityListAAD"
}
}
]
}
],
"style": "above",
"doNotRunWhenHidden": true,
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces"
},
"conditionalVisibility": {
"parameterName": "getLocation",
"comparison": "isEqualTo",
"value": "aad"
},
"name": "parameters - aad"
},
{
"type": 1,
"content": {
"json": "### Please select a Location, or confirm data source: SigninLogs exists\r\n\tif there are no values you may not have the [SigninLogs] table in this workspace.\r\nPlease use a Location Selection of:\r\n\r\n\tFrom a List\r\nor\r\n\r\n\tAdd a manual entry\r\n",
"style": "warning"
},
"conditionalVisibilities": [
{
"parameterName": "CityListAAD",
"comparison": "isEqualTo",
"value": ""
},
{
"parameterName": "getLocation",
"comparison": "isEqualTo",
"value": "aad"
}
],
"name": "text - 7"
},
{
"type": 9,
"content": {
"version": "KqlParameterItem/1.0",
"parameters": [
{
"id": "631833b1-6b7d-485c-ab7d-a101d8e1ef77",
"version": "KqlParameterItem/1.0",
"name": "Latitude",
"type": 1,
"description": "Add a Latitude value",
"criteriaData": [
{
"criteriaContext": {
"operator": "Default",
"rightValType": "param",
"resultValType": "static",
"resultVal": "51.461377"
}
}
]
},
{
"id": "e10c4b13-f3af-4faf-a5cd-605b7660c019",
"version": "KqlParameterItem/1.0",
"name": "Longitude",
"type": 1,
"description": "Add a Longitude value",
"criteriaData": [
{
"criteriaContext": {
"operator": "Default",
"rightValType": "param",
"resultValType": "static",
"resultVal": "-0.925915"
}
}
]
},
{
"version": "KqlParameterItem/1.0",
"name": "defaultLocationName",
"type": 1,
"description": "Add a name for your custom Latitude/Longitude",
"criteriaData": [
{
"criteriaContext": {
"operator": "Default",
"rightValType": "param",
"resultValType": "static",
"resultVal": "Microsoft Campus, Reading (UK)"
}
}
],
"id": "1306d02c-8e16-4001-8ef0-9ede4e5ab29e"
}
],
"style": "above",
"doNotRunWhenHidden": true,
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces"
},
"conditionalVisibility": {
"parameterName": "getLocation",
"comparison": "isEqualTo",
"value": "manual"
},
"name": "parameters -manual"
},
{
"type": 9,
"content": {
"version": "KqlParameterItem/1.0",
"crossComponentResources": [
"{Subscription}"
],
"parameters": [
{
"id": "b1bb0a06-ac1d-438a-931b-a255d0eb5611",
"version": "KqlParameterItem/1.0",
"name": "locationName",
"type": 1,
"query": " // create a common location for chart titles\r\n extend locationName = case( \r\n '{getLocation}' == 'mylist', '{defaultCityList}',\r\n '{getLocation}' == 'aad' , '{defaultCityListAAD}',\r\n '{getLocation}' == 'manual', '{defaultLocationName}',\r\n //else\r\n \"fail\"\r\n )\r\n|project locationName | limit 1",
"crossComponentResources": [
"{Subscription}"
],
"isHiddenWhenLocked": true,
"timeContext": {
"durationMs": 86400000
},
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources"
}
],
"style": "above",
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources"
},
"name": "parameters - common Location Name"
},
{
"type": 3,
"content": {
"version": "KqlItem/1.0",
"query": "// Look back at data and see if any from six named tables have Malicious IP info \r\n// This query is based on the Sentinel home page \"Potential malicious events\" view \r\n// We'll also enrich the data with distance data (in KM or miles) of each entry to defined home location \r\n//\r\n// Please enter how many days worth of data to look at?\r\n// Microsoft Campus UK is used as a base parameter - adjust as required with your own Location Longitude / Latitude \r\n// isFuzzy will allow us to continue on errors or if a table is empty etc...\r\nunion isfuzzy=true \r\n(W3CIISLog\r\n| extend TrafficDirection = \"InboundOrUnknown\", Country=RemoteIPCountry, Latitude=RemoteIPLatitude, Longitude=RemoteIPLongitude), \r\n(DnsEvents\r\n| extend TrafficDirection = \"InboundOrUnknown\", Country= RemoteIPCountry, Latitude = RemoteIPLatitude, Longitude = RemoteIPLongitude),\r\n(WireData\r\n| extend TrafficDirection = iff(Direction != \"Outbound\",\"InboundOrUnknown\", \"Outbound\"), Country=RemoteIPCountry, Latitude=RemoteIPLatitude, Longitude=RemoteIPLongitude), \r\n(WindowsFirewall\r\n| extend TrafficDirection = iff(CommunicationDirection != \"SEND\",\"InboundOrUnknown\", \"Outbound\"), Country=MaliciousIPCountry, Latitude=MaliciousIPLatitude, Longitude=MaliciousIPLongitude), \r\n(CommonSecurityLog\r\n| extend TrafficDirection = iff(CommunicationDirection != \"Outbound\",\"InboundOrUnknown\", \"Outbound\"), Country=MaliciousIPCountry, Latitude=MaliciousIPLatitude, Longitude=MaliciousIPLongitude, Confidence=ThreatDescription, Description=ThreatDescription), \r\n(VMConnection\r\n| where Type == \"VMConnection\"\r\n| extend TrafficDirection = iff(Direction != \"outbound\",\"InboundOrUnknown\", \"Outbound\"), Country=RemoteCountry, Latitude=RemoteLatitude, Longitude=RemoteLongitude)\r\n// Start of main logic\r\n// Supply a default location (long/lat) from selected parameter \r\n| extend myLatitude = case( \r\n '{getLocation}' == 'mylist', todouble(split('{CityList:value}',\",\").[0]),\r\n '{getLocation}' == 'aad' , todouble(split('{defaultCityListAAD:value}',\",\").[1]),\r\n '{getLocation}' == 'manual', todouble({Latitude}),\r\n //else\r\n todouble(0)\r\n )\r\n| extend myLongitude = case( \r\n '{getLocation}' == 'mylist', todouble(split('{CityList:value}',\",\").[1]),\r\n '{getLocation}' == 'aad' , todouble(split('{defaultCityListAAD:value}',\",\").[2]),\r\n '{getLocation}' == 'manual', todouble({Longitude}),\r\n //else\r\n todouble(0)\r\n )\r\n| where isnotempty(MaliciousIP) and isnotempty(Country) and isnotempty(Latitude) and isnotempty(Longitude)\r\n// measure the distance between the base/city and maliciousIP location in km or miles\r\n| extend distance_in = iif('{Measurement}' == \"KM\", geo_distance_2points(Longitude, Latitude, myLongitude, myLatitude)/1000.00, geo_distance_2points(Longitude, Latitude, myLongitude, myLatitude)/1609.344 )\r\n| summarize count(), arg_max(TimeGenerated,TimeGenerated) by Country, distance_in, Latitude , Longitude, '{getLocation}', myLatitude, myLongitude\r\n| top {Top} by count_\r\n\r\n",
"size": 0,
"title": "Top: '{Top}' Malicious IP distances from {locationName} in ('{Measurement}') ",
"timeContext": {
"durationMs": 5184000000
},
"timeContextFromParameter": "TimeRange",
"exportParameterName": "Selected",
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces",
"crossComponentResources": [
"{Workspace}"
],
"visualization": "map",
"gridSettings": {
"sortBy": [
{
"itemKey": "distance_in",
"sortOrder": 2
}
]
},
"sortBy": [
{
"itemKey": "distance_in",
"sortOrder": 2
}
],
"graphSettings": {
"type": 0,
"topContent": {
"columnMatch": "Country",
"formatter": 1
},
"centerContent": {
"columnMatch": "distance_in",
"formatter": 1,
"numberFormat": {
"unit": 17,
"options": {
"maximumSignificantDigits": 3,
"maximumFractionDigits": 2
}
}
}
},
"mapSettings": {
"locInfo": "LatLong",
"latitude": "Latitude",
"longitude": "Longitude",
"sizeSettings": "count_",
"sizeAggregation": "Sum",
"labelSettings": "Country",
"legendMetric": "distance_in",
"legendAggregation": "Sum",
"itemColorSettings": {
"nodeColorField": "count_",
"colorAggregation": "Sum",
"type": "heatmap",
"heatmapPalette": "orange"
}
}
},
"customWidth": "50",
"name": "query - 8"
},
{
"type": 3,
"content": {
"version": "KqlItem/1.0",
"query": "// Look back at data and see if any from six named tables have Malicious IP info \r\n// This query is based on the Sentinel home page \"Potential malicious events\" view \r\n// We'll also enrich the data with distance data (in KM or miles) of each entry to defined home location \r\n//\r\n// Please enter how many days worth of data to look at?\r\n// Microsoft Campus UK is used as a base parameter - adjust as required with your own Location Longitude / Latitude \r\n// isFuzzy will allow us to continue on errors or if a table is empty etc...\r\nunion isfuzzy=true \r\n(W3CIISLog\r\n| extend TrafficDirection = \"InboundOrUnknown\", Country=RemoteIPCountry, Latitude=RemoteIPLatitude, Longitude=RemoteIPLongitude), \r\n(DnsEvents\r\n| extend TrafficDirection = \"InboundOrUnknown\", Country= RemoteIPCountry, Latitude = RemoteIPLatitude, Longitude = RemoteIPLongitude),\r\n(WireData\r\n| extend TrafficDirection = iff(Direction != \"Outbound\",\"InboundOrUnknown\", \"Outbound\"), Country=RemoteIPCountry, Latitude=RemoteIPLatitude, Longitude=RemoteIPLongitude), \r\n(WindowsFirewall\r\n| extend TrafficDirection = iff(CommunicationDirection != \"SEND\",\"InboundOrUnknown\", \"Outbound\"), Country=MaliciousIPCountry, Latitude=MaliciousIPLatitude, Longitude=MaliciousIPLongitude), \r\n(CommonSecurityLog\r\n| extend TrafficDirection = iff(CommunicationDirection != \"Outbound\",\"InboundOrUnknown\", \"Outbound\"), Country=MaliciousIPCountry, Latitude=MaliciousIPLatitude, Longitude=MaliciousIPLongitude, Confidence=ThreatDescription, Description=ThreatDescription), \r\n(\r\nAzureDiagnostics\r\n| where ResourceType == \"FRONTDOORS\" and Category == \"FrontdoorWebApplicationFirewallLog\"\r\n| extend TrafficDirection = iff(isReceivedFromClient_b != false,\"InboundOrUnknown\", \"Outbound\")\r\n),\r\n(VMConnection\r\n| where Type == \"VMConnection\"\r\n| extend TrafficDirection = iff(Direction != \"outbound\",\"InboundOrUnknown\", \"Outbound\"), Country=RemoteCountry, Latitude=RemoteLatitude, Longitude=RemoteLongitude)\r\n// Start of main logic\r\n// Supply a default location (long/lat) from selected parameter \r\n| extend myLatitude = case( \r\n '{getLocation}' == 'mylist', todouble(split('{CityList:value}',\",\").[0]),\r\n '{getLocation}' == 'aad' , todouble(split('{defaultCityListAAD:value}',\",\").[1]),\r\n '{getLocation}' == 'manual', todouble({Latitude}),\r\n //else\r\n todouble(0)\r\n )\r\n| extend myLongitude = case( \r\n '{getLocation}' == 'mylist', todouble(split('{CityList:value}',\",\").[1]),\r\n '{getLocation}' == 'aad' , todouble(split('{defaultCityListAAD:value}',\",\").[2]),\r\n '{getLocation}' == 'manual', todouble({Longitude}),\r\n //else\r\n todouble(0)\r\n )\r\n| where isnotempty(MaliciousIP) and isnotempty(Country) and isnotempty(Latitude) and isnotempty(Longitude)\r\n// measure the distance between the base/city and maliciousIP location in km or miles\r\n| extend distance_in = iif('{Measurement}' == \"KM\", geo_distance_2points(Longitude, Latitude, myLongitude, myLatitude)/1000.00, geo_distance_2points(Longitude, Latitude, myLongitude, myLatitude)/1609.344 )\r\n| summarize count(), arg_max(TimeGenerated,TimeGenerated) by Country, distance_in, Latitude , Longitude, '{getLocation}', myLatitude, myLongitude\r\n| top {Top} by count_\r\n\r\n",
"size": 0,
"title": "Top: '{Top}' Malicious IP distances from {locationName} in ('{Measurement}') ",
"timeContext": {
"durationMs": 5184000000
},
"timeContextFromParameter": "TimeRange",
"exportParameterName": "Selected",
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces",
"crossComponentResources": [
"{Workspace}"
],
"visualization": "table",
"gridSettings": {
"sortBy": [
{
"itemKey": "distance_in",
"sortOrder": 2
}
]
},
"sortBy": [
{
"itemKey": "distance_in",
"sortOrder": 2
}
],
"graphSettings": {
"type": 0,
"topContent": {
"columnMatch": "Country",
"formatter": 1
},
"centerContent": {
"columnMatch": "distance_in",
"formatter": 1,
"numberFormat": {
"unit": 17,
"options": {
"maximumSignificantDigits": 3,
"maximumFractionDigits": 2
}
}
}
},
"mapSettings": {
"locInfo": "LatLong",
"latitude": "Latitude",
"longitude": "Longitude",
"sizeSettings": "count_",
"sizeAggregation": "Sum",
"labelSettings": "Country",
"legendMetric": "distance_in",
"legendAggregation": "Sum",
"itemColorSettings": {
"nodeColorField": "count_",
"colorAggregation": "Sum",
"type": "heatmap",
"heatmapPalette": "orange"
}
}
},
"customWidth": "50",
"name": "query - 8 - Copy"
},
{
"type": 3,
"content": {
"version": "KqlItem/1.0",
"query": "extend a = parse_json('{Selected}')\r\n| project ['region']=a.regionName, ['latitude']=a.latitude, ['longitude']=a.longitude\r\n| limit 1",
"size": 4,
"title": "Please select a map region for more details",
"noDataMessage": "Please click on a map region ",
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources",
"crossComponentResources": [
"{Subscription}"
]
},
"customWidth": "50",
"name": "query - 8"
},
{
"type": 3,
"content": {
"version": "KqlItem/1.0",
"query": "// Show a summary of the map data \r\nunion isfuzzy=true \r\n(W3CIISLog\r\n| extend TrafficDirection = \"InboundOrUnknown\", Country=RemoteIPCountry, Latitude=RemoteIPLatitude, Longitude=RemoteIPLongitude), \r\n(DnsEvents\r\n| extend TrafficDirection = \"InboundOrUnknown\", Country= RemoteIPCountry, Latitude = RemoteIPLatitude, Longitude = RemoteIPLongitude),\r\n(WireData\r\n| extend TrafficDirection = iff(Direction != \"Outbound\",\"InboundOrUnknown\", \"Outbound\"), Country=RemoteIPCountry, Latitude=RemoteIPLatitude, Longitude=RemoteIPLongitude), \r\n(WindowsFirewall\r\n| extend TrafficDirection = iff(CommunicationDirection != \"SEND\",\"InboundOrUnknown\", \"Outbound\"), Country=MaliciousIPCountry, Latitude=MaliciousIPLatitude, Longitude=MaliciousIPLongitude), \r\n(CommonSecurityLog\r\n| extend TrafficDirection = iff(CommunicationDirection != \"Outbound\",\"InboundOrUnknown\", \"Outbound\"), Country=MaliciousIPCountry, Latitude=MaliciousIPLatitude, Longitude=MaliciousIPLongitude, Confidence=ThreatDescription, Description=ThreatDescription), \r\n(VMConnection\r\n| where Type == \"VMConnection\"\r\n| extend TrafficDirection = iff(Direction != \"outbound\",\"InboundOrUnknown\", \"Outbound\"), Country=RemoteCountry, Latitude=RemoteLatitude, Longitude=RemoteLongitude)\r\n// Start of main logic\r\n// Supply a default location (long/lat)\r\n| extend myLatitude = case( \r\n '{getLocation}' == 'mylist', todouble(split('{CityList:value}',\",\").[0]),\r\n '{getLocation}' == 'aad' , todouble(split('{defaultCityListAAD:value}',\",\").[1]),\r\n '{getLocation}' == 'manual', todouble({Latitude}),\r\n //else\r\n todouble(0)\r\n )\r\n| extend myLongitude = case( \r\n '{getLocation}' == 'mylist', todouble(split('{CityList:value}',\",\").[1]),\r\n '{getLocation}' == 'aad' , todouble(split('{defaultCityListAAD:value}',\",\").[2]),\r\n '{getLocation}' == 'manual', todouble({Longitude}),\r\n //else\r\n todouble(0)\r\n ) \r\n| where isnotempty(MaliciousIP) and isnotempty(Country) and isnotempty(Latitude) and isnotempty(Longitude)\r\n// measure the distance between the base/city and maliciousIP location in km or miles\r\n| extend distance_in = iif('{Measurement}' == \"KM\", geo_distance_2points(Longitude, Latitude, myLongitude, myLatitude)/1000.00, geo_distance_2points(Longitude, Latitude, myLongitude, myLatitude)/1609.344 )\r\n| summarize count(), arg_max(TimeGenerated,TimeGenerated) by Country, \r\n distance_in,Latitude, Longitude, toggle='{getLocation}', myLatitude, myLongitude\r\n| top {Top} by count_\r\n| order by distance_in desc\r\n\r\n",
"size": 1,
"showAnalytics": true,
"title": "Top: '{Top}' Malicious IP distances from {locationName} in ('{Measurement}') ",
"timeContext": {
"durationMs": 5184000000
},
"timeContextFromParameter": "TimeRange",
"showExportToExcel": true,
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces",
"crossComponentResources": [
"{Workspace}"
],
"visualization": "table",
"gridSettings": {
"formatters": [
{
"columnMatch": "distance_in",
"formatter": 4,
"formatOptions": {
"palette": "greenRed"
}
},
{
"columnMatch": "toggle",
"formatter": 5
},
{
"columnMatch": "count_",
"formatter": 8,
"formatOptions": {
"palette": "coldHot"
}
},
{
"columnMatch": "TimeGenerated1",
"formatter": 5
}
],
"filter": true,
"sortBy": [
{
"itemKey": "$gen_bar_distance_in_1",
"sortOrder": 2
}
],
"labelSettings": [
{
"columnId": "distance_in",
"label": "Distance"
},
{
"columnId": "Latitude",
"label": "Destination Latitude"
},
{
"columnId": "Longitude",
"label": "Destination Longitude"
},
{
"columnId": "myLatitude",
"label": "Source Latitude"
},
{
"columnId": "myLongitude",
"label": "Source Longitude"
}
]
},
"sortBy": [
{
"itemKey": "$gen_bar_distance_in_1",
"sortOrder": 2
}
],
"graphSettings": {
"type": 0,
"topContent": {
"columnMatch": "Country",
"formatter": 1
},
"centerContent": {
"columnMatch": "distance_in",
"formatter": 1,
"numberFormat": {
"unit": 17,
"options": {
"maximumSignificantDigits": 3,
"maximumFractionDigits": 2
}
}
}
},
"mapSettings": {
"locInfo": "LatLong",
"latitude": "Latitude",
"longitude": "Longitude",
"sizeSettings": "count_",
"sizeAggregation": "Sum",
"labelSettings": "Country",
"legendMetric": "distance_in",
"legendAggregation": "Sum",
"itemColorSettings": {
"nodeColorField": "count_",
"colorAggregation": "Sum",
"type": "heatmap",
"heatmapPalette": "orange"
}
}
},
"name": "query - 8 - Copy"
}
]
},
"conditionalVisibility": {
"parameterName": "selectedTab",
"comparison": "isEqualTo",
"value": "MaliciousIP"
},
"name": "group - Malicious"
},
{
"type": 12,
"content": {
"version": "NotebookGroup/1.0",
"groupType": "editable",
"title": "Group: UserMap",
"items": [
{
"type": 9,
"content": {
"version": "KqlParameterItem/1.0",
"parameters": [
{
"id": "268ebde4-5b20-4106-9e91-8e7d36b26d4f",
"version": "KqlParameterItem/1.0",
"name": "Select",
"label": "Select Users method",
"type": 10,
"isRequired": true,
"typeSettings": {
"additionalResourceOptions": [],
"showDefault": false
},
"jsonData": "[\r\n {\"value\": \"name\", \"label\": \"Select User by Name\", \"selected\":true },\r\n {\"value\": \"letter\", \"label\": \"Select User by letter\"},\r\n {\"value\": \"free\", \"label\": \"Select User using free text search\"}\r\n]",
"timeContext": {
"durationMs": 86400000
}
}
],
"style": "above",
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces"
},
"name": "parameters - 10"
},
{
"type": 9,
"content": {
"version": "KqlParameterItem/1.0",
"crossComponentResources": [
"{Workspace}"
],
"parameters": [
{
"id": "4fd13b3f-9856-4e1d-93f5-c4681a6b4c16",
"version": "KqlParameterItem/1.0",
"name": "SelectUserName",
"type": 2,
"isRequired": true,
"query": "SigninLogs\r\n| where TimeGenerated {TimeRange:query}\r\n| where isnotempty(UserDisplayName) and UserDisplayName !=\"On-Premises Directory Synchronization Service Account\"\r\n| summarize Count = count() by UserDisplayName\r\n| order by Count desc, UserDisplayName asc\r\n| project Value = UserDisplayName, Label = strcat(UserDisplayName, ' - ', Count, ' sign-ins'), Selected = false\r\n",
"crossComponentResources": [
"{Workspace}"
],
"value": "Adminleemajors",
"typeSettings": {
"additionalResourceOptions": []
},
"timeContext": {
"durationMs": 5184000000
},
"timeContextFromParameter": "TimeRange",
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces"
},
{
"id": "8aa43840-1b93-449a-861e-450856dc1297",
"version": "KqlParameterItem/1.0",
"name": "userCount",
"label": "How many unique Users?",
"type": 10,
"description": "1000 users max are shown",
"isRequired": true,
"query": "SigninLogs\r\n| where isnotempty(UserDisplayName) and UserDisplayName !=\"On-Premises Directory Synchronization Service Account\"\r\n| distinct UserDisplayName\r\n| summarize Count = strcat(count(),\" of 1000\")",
"crossComponentResources": [
"{Workspace}"
],
"typeSettings": {
"additionalResourceOptions": [],
"showDefault": false
},
"timeContext": {
"durationMs": 7776000000
},
"timeContextFromParameter": "TimeRange",
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces",
"value": "6 of 1000"
}
],
"style": "above",
"doNotRunWhenHidden": true,
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces"
},
"conditionalVisibility": {
"parameterName": "Select",
"comparison": "isEqualTo",
"value": "name"
},
"name": "parameters - 7"
},
{
"type": 9,
"content": {
"version": "KqlParameterItem/1.0",
"crossComponentResources": [
"{Workspace}"
],
"parameters": [
{
"id": "adb47350-f652-4bd3-b2c7-dcfc3e380a23",
"version": "KqlParameterItem/1.0",
"name": "UserFilter",
"type": 2,
"isRequired": true,
"query": "SigninLogs\r\n| distinct UserDisplayName\r\n| project Alpha = toupper(substring(UserDisplayName,0,1))\r\n| summarize Count = count() by Alpha\r\n| order by Alpha asc\r\n| project Value=Alpha, Label=Alpha, selected = false",
"crossComponentResources": [
"{Workspace}"
],
"value": "A",
"typeSettings": {
"additionalResourceOptions": [],
"showDefault": false
},
"timeContext": {
"durationMs": 7776000000
},
"timeContextFromParameter": "TimeRange",
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces"
},
{
"id": "ad7f576a-5df8-49c1-99c2-f8fdbca5557b",
"version": "KqlParameterItem/1.0",
"name": "SelectUserLetter",
"label": " Select User Letter",
"type": 2,
"isRequired": true,
"query": "SigninLogs\r\n| where UserDisplayName startswith '{UserFilter:label}'\r\n| summarize by UserDisplayName\r\n| order by UserDisplayName asc",
"crossComponentResources": [
"{Workspace}"
],
"value": "Alex Humphrey",
"typeSettings": {
"additionalResourceOptions": [],
"showDefault": false
},
"timeContext": {
"durationMs": 0
},
"timeContextFromParameter": "TimeRange",
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces"
},
{
"id": "96d46227-91be-4519-a83d-449e38b5f32c",
"version": "KqlParameterItem/1.0",
"name": "selectedUserCount",
"label": "How many unique Users?",
"type": 10,
"description": "1000 users max are shown",
"isRequired": true,
"query": "SigninLogs\r\n| where UserDisplayName startswith '{UserFilter:label}'\r\n| distinct UserDisplayName\r\n| summarize Count = strcat(count(),\" of 1000\")",
"crossComponentResources": [
"{Workspace}"
],
"typeSettings": {
"additionalResourceOptions": [],
"showDefault": false
},
"timeContext": {
"durationMs": 7776000000
},
"timeContextFromParameter": "TimeRange",
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces"
}
],
"style": "above",
"doNotRunWhenHidden": true,
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces"
},
"conditionalVisibility": {
"parameterName": "Select",
"comparison": "isEqualTo",
"value": "letter"
},
"name": "parameters - 9"
},
{
"type": 9,
"content": {
"version": "KqlParameterItem/1.0",
"crossComponentResources": [
"{Workspace}"
],
"parameters": [
{
"id": "c2577785-56e7-415e-b95d-4af62446fb49",
"version": "KqlParameterItem/1.0",
"name": "SelectUserFree",
"label": "Search for a User here",
"type": 1,
"description": "Enter a free text search for a User Name ",
"value": "",
"timeContext": {
"durationMs": 86400000
},
"timeContextFromParameter": "TimeRange"
},
{
"id": "38ee7b13-de6b-48da-a98f-0ae75ae0517e",
"version": "KqlParameterItem/1.0",
"name": "SelectUserwithin",
"label": "Matched User(s)",
"type": 2,
"query": "SigninLogs\r\n| where UserDisplayName contains '{SelectUserFree}'\r\n| distinct UserDisplayName\r\n| project UserDisplayName \r\n| order by UserDisplayName asc",
"crossComponentResources": [
"{Workspace}"
],
"value": null,
"typeSettings": {
"additionalResourceOptions": [],