Repository navigation
Expand file tree
/
Copy pathUser Report.workbook
More file actions
1579 lines (1579 loc) · 87.2 KB
/
Copy pathUser Report.workbook
File metadata and controls
1579 lines (1579 loc) · 87.2 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",
"crossComponentResources": [
"{Subscriptions}"
],
"parameters": [
{
"id": "b859a03f-2283-43dd-8536-42714bbfced6",
"version": "KqlParameterItem/1.0",
"name": "Subscriptions",
"type": 6,
"isRequired": true,
"multiSelect": true,
"quote": "'",
"delimiter": ",",
"query": "summarize Count = count() by subscriptionId\r\n| project value = strcat('/subscriptions/', subscriptionId), label = subscriptionId, Selected = Count >= 0",
"crossComponentResources": [
"value::selected"
],
"typeSettings": {
"additionalResourceOptions": [],
"showDefault": false
},
"queryType": 1
},
{
"id": "2e3dfd9b-2d0f-4feb-94e8-107f220c4e28",
"version": "KqlParameterItem/1.0",
"name": "ResourceGroups",
"type": 5,
"isRequired": true,
"multiSelect": true,
"quote": "'",
"delimiter": ",",
"query": "resources\r\n| where type contains \"desktopvirtualization\"\r\n| summarize Count = count() by resourceGroup\r\n| project Label = resourceGroup, Id = resourceGroup, Selected = Count >= 0",
"crossComponentResources": [
"{Subscriptions}"
],
"typeSettings": {
"additionalResourceOptions": [],
"showDefault": false
},
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources"
},
{
"id": "951b5870-e216-45c6-b159-34150868a46e",
"version": "KqlParameterItem/1.0",
"name": "HostPools",
"type": 5,
"isRequired": true,
"multiSelect": true,
"quote": "'",
"delimiter": ",",
"query": "resources\r\n| where type == \"microsoft.desktopvirtualization/hostpools\" and resourceGroup in ({ResourceGroups})\r\n",
"crossComponentResources": [
"{Subscriptions}"
],
"typeSettings": {
"additionalResourceOptions": [],
"showDefault": false
},
"timeContext": {
"durationMs": 0
},
"timeContextFromParameter": "TimeRange",
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources"
},
{
"id": "04a8ead2-1fb2-4666-a7b0-6d92e3c29b46",
"version": "KqlParameterItem/1.0",
"name": "TimeRange",
"type": 4,
"typeSettings": {
"selectableValues": [
{
"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
},
"value": {
"durationMs": 172800000
},
"label": "Time range"
},
{
"id": "ff8c2838-aaf0-40f6-a604-d4bfe72fc92f",
"version": "KqlParameterItem/1.0",
"name": "poolla",
"type": 5,
"query": "{\"version\":\"ARMEndpoint/1.0\",\"data\":null,\"headers\":[],\"method\":\"GET\",\"path\":\"/{HostPool}/providers/microsoft.insights/diagnosticSettings?api-version=2021-05-01-preview\",\"urlParams\":[],\"batchDisabled\":false,\"transformers\":[{\"type\":\"jsonpath\",\"settings\":{\"tablePath\":\"$.value\",\"columns\":[{\"path\":\"$.properties.workspaceId\",\"columnid\":\"id\"},{\"path\":\"$.id\",\"columnid\":\"selected\"}]}}]}",
"isHiddenWhenLocked": true,
"typeSettings": {
"additionalResourceOptions": [],
"showDefault": false
},
"timeContextFromParameter": "TimeRange",
"queryType": 12
},
{
"id": "08f46c2a-f080-40c5-b36f-acd0e80c6259",
"version": "KqlParameterItem/1.0",
"name": "WorkspaceId",
"type": 1,
"query": "resources\r\n| where resourceGroup =~ \"WVDSelfhost\"\r\n| where type =~ \"Microsoft.Compute/virtualMachines/extensions\"and properties.type == \"MicrosoftMonitoringAgent\"\r\n| project Value = parse_json(properties.settings).workspaceId, selected=true\r\n| limit 1",
"crossComponentResources": [
"value::selected"
],
"isHiddenWhenLocked": true,
"timeContext": {
"durationMs": 0
},
"timeContextFromParameter": "TimeRange",
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources"
},
{
"id": "29c8282b-4c11-409c-b4e9-1049edbaf67a",
"version": "KqlParameterItem/1.0",
"name": "Workspace",
"type": 5,
"query": "resources\r\n| where type == \"microsoft.operationalinsights/workspaces\"\r\n| where properties.customerId == \"{WorkspaceId}\"",
"crossComponentResources": [
"value::selected"
],
"isHiddenWhenLocked": true,
"typeSettings": {
"additionalResourceOptions": []
},
"timeContext": {
"durationMs": 0
},
"timeContextFromParameter": "TimeRange",
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources"
},
{
"id": "c6d8e696-51fd-4306-95b7-e7be2e6acec0",
"version": "KqlParameterItem/1.0",
"name": "wvdworkspaces",
"type": 5,
"multiSelect": true,
"quote": "'",
"delimiter": ",",
"query": "resources\r\n| where type == \"microsoft.desktopvirtualization/applicationgroups\"\r\n| project id, workspace= properties.workspaceArmPath, hp=properties.hostPoolArmPath\r\n| where isnotnull(workspace)\r\n| where hp in~ ({HostPools})\r\n| project workspace, label=workspace,selected=1",
"crossComponentResources": [
"{Subscriptions}"
],
"isHiddenWhenLocked": true,
"typeSettings": {
"additionalResourceOptions": [],
"showDefault": false
},
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources"
}
],
"style": "pills",
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources"
},
"name": "parameters_general"
},
{
"type": 12,
"content": {
"version": "NotebookGroup/1.0",
"groupType": "editable",
"items": [
{
"type": 9,
"content": {
"version": "KqlParameterItem/1.0",
"crossComponentResources": [
"{HostPools}"
],
"parameters": [
{
"id": "8d92d80e-75b9-429c-acd9-182fcc3a6eb0",
"version": "KqlParameterItem/1.0",
"name": "UserNameSearchString",
"label": "UPN to search for",
"type": 1,
"description": "Enter a full or partial user principal name to filter the list of user names",
"timeContext": {
"durationMs": 2592000000
},
"timeContextFromParameter": "TimeRange"
},
{
"id": "e1e164a5-c5e8-4219-997a-fc580dc3f593",
"version": "KqlParameterItem/1.0",
"name": "UserName",
"label": "Matching users",
"type": 2,
"description": "List of matching users with some activity in the selected time period",
"isRequired": true,
"query": "WVDConnections\r\n| where isnotempty(\"{UserNameSearchString}\")\r\n| project UserName\r\n| where UserName has \"@\" and tolower(UserName) contains \"{UserNameSearchString}\"\r\n| distinct UserName\r\n| extend Lowercased=tolower(UserName)\r\n| sort by Lowercased asc\r\n| project Label=UserName, Value=UserName, Selected=(row_number()==1)",
"crossComponentResources": [
"{HostPools}"
],
"typeSettings": {
"additionalResourceOptions": [],
"showDefault": false
},
"timeContext": {
"durationMs": 0
},
"timeContextFromParameter": "TimeRange",
"queryType": 0,
"resourceType": "microsoft.desktopvirtualization/hostpools"
}
],
"style": "above",
"queryType": 0,
"resourceType": "microsoft.desktopvirtualization/hostpools"
},
"customWidth": "50",
"name": "parameters - 1",
"styleSettings": {
"maxWidth": "500px"
}
},
{
"type": 9,
"content": {
"version": "KqlParameterItem/1.0",
"crossComponentResources": [
"{HostPools}"
],
"parameters": [
{
"id": "ffe3e22b-a2b9-4a6c-90e7-92ce3419c150",
"version": "KqlParameterItem/1.0",
"name": "UserStatus",
"type": 2,
"isRequired": true,
"query": "let GetHumanTimestamp = (Duration:timespan) {\r\n let Weeks = Duration/7d;\r\n let Days = Duration/1d;\r\n let Hours = Duration/1h;\r\n let Minutes = Duration/1m;\r\n case(\r\n Weeks > 1, strcat( round(Weeks, 1), \" weeks\"),\r\n Days > 1, strcat( round(Days, 1), \" days\"),\r\n Hours > 1, strcat( round(Hours, 1), \" hours\"),\r\n Minutes > 1, strcat(toint(round(Minutes, 0)), \" minutes\"),\r\n \"less than 1 minute\"\r\n ) \r\n};\r\nWVDConnections\r\n| where UserName == \"{UserName}\"\r\n| summarize arg_max(TimeGenerated, ClientType, ClientVersion, SessionHostName, ResourceAlias) by State\r\n| extend HumanTimestamp = GetHumanTimestamp(now()-TimeGenerated), Host=trim_end(@\"\\..*\", SessionHostName), ClientType = replace(\"com.microsoft.rdc.\", \"\", ClientType)\r\n| as SourceData\r\n| where State == \"Started\"\r\n| project State, TimeGenerated, Message=strcat(\"Is currently **attempting to connect** to **\", Host, \"** (for about **\", HumanTimestamp, \"**), using **\", ClientType, \"** version **\", ClientVersion, \"** and the **\", ResourceAlias, \"** resource.\")\r\n| union\r\n(\r\n SourceData\r\n | where State == \"Completed\"\r\n | project State, TimeGenerated, Message=strcat(\"Last seen after **disconnecting** from **\", Host, \"** about **\", HumanTimestamp, \"** ago, having used **\", ClientType, \"** version **\", ClientVersion, \"** to launch **\", ResourceAlias, \"**\")\r\n)\r\n| union\r\n(\r\n SourceData\r\n | where State == \"Connected\"\r\n | project State, TimeGenerated, Message=strcat(\"**Currently connected** to **\", Host, \"** for about **\", HumanTimestamp, \"** using **\", ClientType, \"** version **\", ClientVersion, \"** via the **\", ResourceAlias, \"** resource.\")\r\n)\r\n| summarize arg_max(TimeGenerated, State, Message) by Selected=true\r\n| project Value=State, Label=Message, Selected\r\n// TODO: If a connection was established to pool A before a connection to pool B is terminated (overlapping connections), the former should be reported, as it's an ongoing activity",
"crossComponentResources": [
"{HostPools}"
],
"isHiddenWhenLocked": true,
"typeSettings": {
"additionalResourceOptions": [],
"showDefault": false
},
"timeContext": {
"durationMs": 2592000000
},
"queryType": 0,
"resourceType": "microsoft.desktopvirtualization/hostpools"
}
],
"style": "pills",
"queryType": 0,
"resourceType": "microsoft.desktopvirtualization/hostpools"
},
"customWidth": "50",
"conditionalVisibility": {
"parameterName": "false",
"comparison": "isEqualTo",
"value": "true"
},
"name": "parameters - 15"
},
{
"type": 1,
"content": {
"json": "Enter a full or partial user name above and select a match from the dropdown to see a report of user activity.",
"style": "info"
},
"conditionalVisibility": {
"parameterName": "UserName",
"comparison": "isEqualTo",
"value": ""
},
"name": "text16",
"styleSettings": {
"showBorder": true
}
},
{
"type": 12,
"content": {
"version": "NotebookGroup/1.0",
"groupType": "editable",
"items": [
{
"type": 1,
"content": {
"json": "{UserStatus:label}",
"style": "success"
},
"conditionalVisibility": {
"parameterName": "UserStatus",
"comparison": "isEqualTo",
"value": "Connected"
},
"name": "text17",
"styleSettings": {
"showBorder": true
}
},
{
"type": 1,
"content": {
"json": "{UserStatus:label}",
"style": "info"
},
"conditionalVisibility": {
"parameterName": "UserStatus",
"comparison": "isEqualTo",
"value": "Completed"
},
"name": "text18",
"styleSettings": {
"showBorder": true
}
},
{
"type": 1,
"content": {
"json": "{UserStatus:label}",
"style": "upsell"
},
"conditionalVisibility": {
"parameterName": "UserStatus",
"comparison": "isEqualTo",
"value": "Started"
},
"name": "text19",
"styleSettings": {
"showBorder": true
}
},
{
"type": 1,
"content": {
"json": "**No connections** found for **{UserName}** in the last **30 days**.",
"style": "warning"
},
"conditionalVisibility": {
"parameterName": "UserStatus",
"comparison": "isEqualTo",
"value": ""
},
"name": "text20",
"styleSettings": {
"showBorder": true
}
},
{
"type": 3,
"content": {
"version": "KqlItem/1.0",
"query": "let GetDaysInTimeRange = (Period:timespan) {\r\n max_of(toint(round(Period/1d, 0)), 1)\r\n};\r\nlet GetConnectionTime = (Time:timespan) {\r\n // Total hours is the number of days*24, plus the hours\r\n let TotalHours = toint(format_timespan(Time, \"d\")) * 24 + toint(format_timespan(Time, \"HH\"));\r\n // Total minutes is the number of minutes\r\n let TotalMinutes = toint(format_timespan(Time, \"mm\"));\r\n strcat(\"~ \", TotalHours, \":\", TotalMinutes, \" h\");\r\n};\r\nlet GetTimespanAverage = (Time:timespan, Period:timespan) {\r\n let Days = GetDaysInTimeRange(Period);\r\n let AvgPerDay = Time / Days;\r\n strcat(\"~ \", format_timespan(AvgPerDay, \"h:m\"), \" h\")\r\n};\r\nlet ProbeRange = range ProbeDay from {TimeRange:start} to {TimeRange:end} step 1d | extend JoinKey=1;\r\n\r\n// --- Step 1: Build UserUsage with Duration ---\r\nlet UserUsage = \r\n WVDConnections\r\n | where TimeGenerated {TimeRange} and UserName == \"{UserName}\"\r\n | extend PredecessorConnectionId=replace(\"<>\", \"\", trim(@\"{|}\", PredecessorConnectionId))\r\n | where State==\"Started\"\r\n | summarize arg_min(TimeGenerated, UserName, ClientType, ResourceAlias, State) by CorrelationId\r\n | extend StartTime = TimeGenerated\r\n | join kind=leftouter\r\n (\r\n WVDConnections\r\n | summarize (EndTime, State, UserName)=arg_max(TimeGenerated, State, UserName) by CorrelationId\r\n ) on CorrelationId\r\n | extend State=coalesce(State1, State)\r\n | extend StartTime = min_of(coalesce(StartTime, {TimeRange:start}), EndTime),\r\n UserName=coalesce(UserName,UserName1)\r\n | where StartTime between ({TimeRange:start} .. {TimeRange:end}) \r\n or EndTime between ({TimeRange:start} .. {TimeRange:end}) \r\n or (StartTime <= {TimeRange:start} and EndTime >= {TimeRange:end})\r\n | extend EndTime = min_of(EndTime, {TimeRange:end}) - 1s,\r\n StartTime = max_of(StartTime, {TimeRange:start}) + 1s\r\n | extend Duration = bin(EndTime - StartTime, 1s)\r\n | project CorrelationId, UserName, Duration, ClientType, ResourceAlias, StartTime, EndTime;\r\n\r\n// --- Step 2: Aggregate BEFORE join with WVDCheckpoints and UserUsage table---\r\nlet ConnectionSummary = \r\n UserUsage\r\n | summarize \r\n AppsToStartConnection=dcount(ResourceAlias),\r\n Connections=dcount(CorrelationId),\r\n Time=sum(Duration),\r\n ClientCount=dcount(ClientType)\r\n by UserName;\r\n\r\n// --- Step 3: Join to WVDCheckpoints ---\r\nlet CheckpointsSummary =\r\n WVDCheckpoints\r\n | where (Name == \"LaunchExecutable\" and Parameters.connectionStage == \"RdpShellAppExecuted\") \r\n or Name==\"RdpShellAppExecuted\"\r\n | project CorrelationId, Parameters=tostring(Parameters.filename)\r\n | join kind=inner UserUsage on CorrelationId\r\n | summarize AppsUsed=dcount(Parameters) by UserName;\r\n\r\n// --- Step 4: Join to UserUsage ---\r\nlet UsageSummary =\r\n UserUsage\r\n | extend JoinKey = 1\r\n | join kind=fullouter ProbeRange on JoinKey\r\n | make-series ConnectedToday=dcountif(CorrelationId, \r\n bin(ProbeDay, 1d) == bin(StartTime, 1d) or \r\n bin(ProbeDay, 1d) == bin(EndTime, 1d) or \r\n bin(ProbeDay, 1d) between (bin(StartTime, 1d)..bin(EndTime, 1d)))\r\n on ProbeDay from {TimeRange:start} to {TimeRange:end} step 1d by UserName\r\n | mv-expand ProbeDay to typeof(datetime), ConnectedToday to typeof(int)\r\n | summarize Days=countif(ConnectedToday > 0) by UserName;\r\n\r\n// --- Step 5: Combine ---\r\nConnectionSummary\r\n| join kind=leftouter CheckpointsSummary on UserName\r\n| join kind=leftouter UsageSummary on UserName\r\n| project\r\n ['Days in time range'] = GetDaysInTimeRange({TimeRange:end} - {TimeRange:start}),\r\n ['Days with usage'] = coalesce(Days, 0),\r\n ['Apps to start connection'] = coalesce(AppsToStartConnection, 0),\r\n ['Apps used'] = coalesce(AppsUsed, 0),\r\n ['Connection count'] = coalesce(Connections, 0),\r\n ['Connection time'] = GetConnectionTime(Time),\r\n ['Average daily time'] = GetTimespanAverage(Time, {TimeRange:end} - {TimeRange:start}),\r\n ['Client count'] = coalesce(ClientCount, 0)\r\n| evaluate narrow()\r\n| project Metric=replace(@\"\\[|'|\\]\", \"\", Column), Value\r\n",
"size": 1,
"title": "Key usage numbers",
"queryType": 0,
"resourceType": "microsoft.desktopvirtualization/hostpools",
"crossComponentResources": [
"{HostPools}"
],
"visualization": "tiles",
"gridSettings": {
"formatters": [
{
"columnMatch": "Days",
"formatter": 0,
"numberFormat": {
"unit": 27,
"options": {
"style": "decimal",
"useGrouping": false
}
}
},
{
"columnMatch": "ConnectionTime",
"formatter": 0,
"numberFormat": {
"unit": 24,
"options": {
"style": "decimal",
"useGrouping": false,
"maximumSignificantDigits": 2
}
}
}
]
},
"tileSettings": {
"titleContent": {
"columnMatch": "Metric",
"formatter": 1
},
"leftContent": {
"columnMatch": "Value",
"formatter": 12,
"formatOptions": {
"palette": "auto"
},
"numberFormat": {
"unit": 17,
"options": {
"style": "decimal",
"maximumFractionDigits": 2,
"maximumSignificantDigits": 3
}
}
},
"showBorder": false
},
"chartSettings": {
"ySettings": {
"numberFormatSettings": {
"unit": 26,
"options": {
"style": "decimal",
"useGrouping": true,
"maximumFractionDigits": 1
}
}
}
}
},
"name": "KeyUsageNumbersTiles"
},
{
"type": 12,
"content": {
"version": "NotebookGroup/1.0",
"groupType": "editable",
"items": [
{
"type": 3,
"content": {
"version": "KqlItem/1.0",
"query": "let GetPrettyError=(ErrorName:string, ErrorCode:string)\r\n{\r\n iif(ErrorName !in ('', '<>'), strcat(ErrorName, ' (', ErrorCode, ')'), ErrorCode)\r\n};\r\nWVDConnections\r\n| where TimeGenerated {TimeRange} and UserName == \"{UserName}\"\r\n| extend Client=strcat(replace(\"com.microsoft.rdc.\", \"\", ClientType), \" \", ClientVersion)\r\n| extend PredecessorConnectionId=replace(\"<>\", \"\", trim(@\"{|}\", PredecessorConnectionId))\r\n| as Connections\r\n| where State==\"Started\"\r\n| summarize arg_min(TimeGenerated, UserName, ClientType, ClientVersion, State, SessionHostName, _ResourceId) by CorrelationId\r\n| extend StartTime = TimeGenerated\r\n| join kind=leftouter\r\n(\r\n Connections\r\n | summarize (EndTime, State)=arg_max(TimeGenerated, State) by CorrelationId\r\n) on CorrelationId\r\n| extend State=coalesce(State1, State)\r\n| join kind=leftouter\r\n(\r\n WVDErrors\r\n | project CorrelationId, ServiceError, Source, Error = GetPrettyError(CodeSymbolic, Code)\r\n | distinct *\r\n | summarize Errors=count() by CorrelationId\r\n) on CorrelationId\r\n| project CorrelationId, SessionId=strcat(substring(CorrelationId, 0, strlen(CorrelationId) - 4), \"*\"), UserName, SessionHostName, Errors=coalesce(Errors, 0), StartTime, EndTime, Duration=bin(EndTime-StartTime, 1s), ClientType, ClientVersion, _ResourceId\r\n| summarize InitialConnection=min(StartTime), EndTime=max(EndTime), Duration=sum(Duration)/1s, Attempts=dcount(CorrelationId), Errors=sum(Errors), CorrelationId=makeset(CorrelationId)\r\n by _ResourceId,SessionHostName, SessionId, Client=strcat(replace(\"com.microsoft.rdc.\", \"\", ClientType), \" v\", ClientVersion)\r\n| project HostName=trim_end(@\"\\..*\", SessionHostName), SessionId, Attempts, Errors, Client, Duration, InitialConnection, CorrelationId, _ResourceId\r\n| order by _ResourceId\r\n",
"size": 0,
"title": "Connection activity browser for {TimeRange:label}",
"noDataMessage": "No Connected Sessions detected in the selected time period",
"exportedParameters": [
{
"fieldName": "SessionId",
"parameterName": "GroupedCorrelationId"
},
{
"fieldName": "HostName",
"parameterName": "CorrelationHost",
"parameterType": 1
}
],
"showExportToExcel": true,
"queryType": 0,
"resourceType": "microsoft.desktopvirtualization/hostpools",
"crossComponentResources": [
"{HostPools}"
],
"visualization": "table",
"showExpandCollapseGrid": true,
"gridSettings": {
"formatters": [
{
"columnMatch": "$gen_group",
"formatter": 0,
"formatOptions": {
"customColumnWidthSetting": "43ch"
}
},
{
"columnMatch": "HostName",
"formatter": 5
},
{
"columnMatch": "SessionId",
"formatter": 5
},
{
"columnMatch": "Attempts",
"formatter": 4,
"formatOptions": {
"min": 0,
"palette": "blue",
"aggregation": "Sum"
}
},
{
"columnMatch": "Errors",
"formatter": 4,
"formatOptions": {
"min": 0,
"palette": "redBright",
"aggregation": "Sum"
}
},
{
"columnMatch": "Client",
"formatter": 5,
"formatOptions": {
"aggregation": "Unique"
}
},
{
"columnMatch": "Duration",
"formatter": 1,
"formatOptions": {
"aggregation": "Sum"
},
"numberFormat": {
"unit": 24,
"options": {
"style": "decimal",
"useGrouping": false,
"maximumSignificantDigits": 2
}
}
},
{
"columnMatch": "InitialConnection",
"formatter": 6,
"formatOptions": {
"aggregation": "Min",
"customColumnWidthSetting": "24ch"
}
},
{
"columnMatch": "CorrelationId",
"formatter": 5
},
{
"columnMatch": "_ResourceId",
"formatter": 0,
"formatOptions": {
"customColumnWidthSetting": "19ch"
}
},
{
"columnMatch": "$gen_group",
"formatter": 0,
"formatOptions": {
"customColumnWidthSetting": "43ch"
}
}
],
"filter": true,
"hierarchySettings": {
"treeType": 1,
"groupBy": [
"Client",
"HostName"
],
"expandTopLevel": true,
"finalBy": "SessionId"
},
"sortBy": [
{
"itemKey": "InitialConnection",
"sortOrder": 1
}
],
"labelSettings": [
{
"columnId": "Client",
"label": "Connections by client and host"
},
{
"columnId": "InitialConnection",
"label": "Initial connection"
},
{
"columnId": "_ResourceId",
"label": "Host pool"
}
]
},
"sortBy": [
{
"itemKey": "InitialConnection",
"sortOrder": 1
}
]
},
"customWidth": "50",
"name": "wvdconnectedsessionsdetails",
"styleSettings": {
"padding": "10px"
}
},
{
"type": 12,
"content": {
"version": "NotebookGroup/1.0",
"groupType": "editable",
"items": [
{
"type": 3,
"content": {
"version": "KqlItem/1.0",
"query": "let GetPrettyError=(ErrorName:string, ErrorCode:string)\r\n{\r\n iif(ErrorName !in ('', '<>'), strcat(ErrorName, ' (', ErrorCode, ')'), ErrorCode)\r\n};\r\nlet IsSelectedCorrelation = (Selected:string, Current:string)\r\n{\r\n let GuidStart = substring(Selected, 0, strlen(Selected)-1);\r\n (Selected contains \"*\" and Current startswith GuidStart) or Current == Selected\r\n};\r\nWVDCheckpoints\r\n| where TimeGenerated {TimeRange} and IsSelectedCorrelation(\"{GroupedCorrelationId}\", CorrelationId)\r\n| project CorrelationId, TimeGenerated, Kind=\"Checkpoint\", Source, Information=Name, Parameters\r\n| as ResultSet\r\n| union\r\n(\r\n WVDErrors\r\n | where IsSelectedCorrelation(\"{GroupedCorrelationId}\", CorrelationId)\r\n | project CorrelationId,TimeGenerated, Kind=iif(ServiceError, \"Service\", \"Deployment\"), Source, Information = GetPrettyError(CodeSymbolic, Code)\r\n | distinct *\r\n)\r\n| join kind = leftouter\r\n(\r\n ResultSet\r\n | where Source == \"RDStack\" and Information == \"RdpStackConnectionEstablished\"\r\n | project CorrelationId, Connected=true\r\n | summarize Success=dcountif(CorrelationId, Connected)>0 by CorrelationId\r\n) on CorrelationId\r\n| extend CorrelationId=strcat(iif(Success, \"🟢\", \"🔴\"), \" \", CorrelationId)\r\n| project-away Success\r\n| sort by CorrelationId asc, TimeGenerated asc\r\n",
"size": 2,
"title": "Connecting to {CorrelationHost}",
"noDataMessage": "No errors were found for the selected session.",
"timeContextFromParameter": "TimeRange",
"showExportToExcel": true,
"queryType": 0,
"resourceType": "microsoft.desktopvirtualization/hostpools",
"crossComponentResources": [
"{HostPools}"
],
"visualization": "table",
"showExpandCollapseGrid": true,
"gridSettings": {
"formatters": [
{
"columnMatch": "CorrelationId",
"formatter": 5
},
{
"columnMatch": "TimeGenerated",
"formatter": 5,
"numberFormat": {
"unit": 0,
"options": {
"style": "decimal",
"useGrouping": false
}
}
},
{
"columnMatch": "Kind",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "==",
"thresholdValue": "Checkpoint",
"representation": "Normal",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "Deployment",
"representation": "3",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "Service",
"representation": "Important",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"representation": "Blank",
"text": "{0}{1}"
}
]
}
}
],
"filter": true,
"hierarchySettings": {
"treeType": 1,
"groupBy": [
"CorrelationId"
],
"expandTopLevel": true,
"finalBy": "TimeGenerated"
},
"labelSettings": [
{
"columnId": "CorrelationId",
"label": "Attempt and timestamp"
}
]
},
"sortBy": []
},
"conditionalVisibility": {
"parameterName": "GroupedCorrelationId",
"comparison": "isNotEqualTo"
},
"name": "ConnectingByHost",
"styleSettings": {
"padding": "10px"
}
},
{
"type": 1,
"content": {
"json": "Use the search box or browse for a connection ID and select it to display details here. ",
"style": "info"
},
"conditionalVisibility": {
"parameterName": "GroupedCorrelationId",
"comparison": "isEqualTo"
},
"name": "text - 1",
"styleSettings": {
"margin": "10px",
"padding": "10px"
}
}
]
},
"customWidth": "50",
"name": "group - 2"
}
]
},
"name": "Activity browser",
"styleSettings": {
"showBorder": true
}
},
{
"type": 12,
"content": {
"version": "NotebookGroup/1.0",
"groupType": "editable",
"items": [
{
"type": 9,
"content": {
"version": "KqlParameterItem/1.0",
"crossComponentResources": [
"{wvdworkspaces}"
],
"parameters": [
{
"id": "08a487e8-e336-4b9b-9253-dfb8b8cec442",
"version": "KqlParameterItem/1.0",
"name": "ConnectionErrors",
"type": 2,
"isRequired": true,
"query": "WVDErrors\r\n| where UserName == \"{UserName}\"\r\n| summarize total=dcount(CorrelationId)\r\n| project total, disp=total, selected=1",
"crossComponentResources": [
"{HostPools}"
],
"isHiddenWhenLocked": true,
"typeSettings": {
"additionalResourceOptions": [],
"showDefault": false
},
"timeContext": {
"durationMs": 0
},
"timeContextFromParameter": "TimeRange",
"queryType": 0,
"resourceType": "microsoft.desktopvirtualization/hostpools"
},
{
"id": "daada493-ee60-48b3-b348-73ee6a6ee630",
"version": "KqlParameterItem/1.0",
"name": "FeedErrors",
"type": 2,
"isRequired": true,
"query": "WVDErrors\r\n| where UserName == \"{UserName}\"\r\n| summarize total=dcount(CorrelationId)\r\n| project total, disp=total, selected=1",
"crossComponentResources": [
"{wvdworkspaces}"
],
"isHiddenWhenLocked": true,
"typeSettings": {
"additionalResourceOptions": [],
"showDefault": false
},
"timeContext": {
"durationMs": 0
},
"timeContextFromParameter": "TimeRange",
"queryType": 0,
"resourceType": "microsoft.desktopvirtualization/workspaces"
},
{
"id": "8809818d-1aa3-4a27-ac0b-b1808000be06",
"version": "KqlParameterItem/1.0",
"name": "wvdActivityType",
"label": "Activity Type",
"type": 10,
"description": "Scope top errors by activity type",
"isRequired": true,
"typeSettings": {
"additionalResourceOptions": [],
"showDefault": false
},
"jsonData": "[ \r\n {\r\n \"label\": \"Connections\",\r\n \"value\": \"Connections\",\r\n \"selected\": \"{ConnectionErrors}\"\r\n },\r\n {\r\n \"label\": \"Feeds\",\r\n \"value\": \"Feeds\",\r\n \"selected\": \"{FeedErrors}\"\r\n }\r\n]",
"timeContext": {
"durationMs": 0
},
"timeContextFromParameter": "TimeRange"
},
{
"id": "2660c262-528a-4897-8631-94acd157c3c0",
"version": "KqlParameterItem/1.0",
"name": "TopNErrors",
"label": "Display top N errors",
"type": 2,
"description": "The number of errors (by count of activities impacted) returned",
"isRequired": true,
"typeSettings": {
"additionalResourceOptions": []
},
"jsonData": "[ \r\n {\r\n \"label\": \"10\",\r\n \"value\": \"10\",\r\n \"selected\": true\r\n },\r\n {\r\n \"label\": \"25\",\r\n \"value\": \"25\"\r\n },\r\n {\r\n \"label\": \"All\",\r\n \"value\": \"99999\"\r\n }\r\n]",
"timeContext": {
"durationMs": 2592000000
},
"timeContextFromParameter": "TimeRange"
}
],
"style": "pills",
"queryType": 0,
"resourceType": "microsoft.desktopvirtualization/workspaces"
},
"name": "parameters - 12"
},
{
"type": 3,
"content": {
"version": "KqlItem/1.0",
"query": "let GetPrettyError=(ErrorName:string, ErrorCode:string)\r\n{\r\n iif(ErrorName !in ('', '<>'), strcat(ErrorName, ' (', ErrorCode, ')'), ErrorCode)\r\n};\r\nWVDConnections\r\n| where UserName == \"{UserName}\"\r\n| join kind=leftouter\r\n(\r\n WVDErrors\r\n | where TimeGenerated {TimeRange}\r\n | extend Error=GetPrettyError(CodeSymbolic, Code)\r\n) on CorrelationId\r\n| where isnotempty(Error)\r\n| as ErrorList\r\n| make-series ActivitiesImpactedOverTime=dcount(CorrelationId) default=0,\r\n HostsImpactedOverTime=dcountif(SessionHostName, strlen(SessionHostName) > 2) default=0\r\n on TimeGenerated from {TimeRange:start} to {TimeRange:end} step {TimeRange:grain} by ActivityType, ServiceError, Source, Error\r\n| join kind=inner\r\n(\r\n ErrorList\r\n | summarize MessageSample=any(Message), TotalActivitiesImpacted=dcount(CorrelationId), TotalUsersImpacted=dcountif(UserName, strlen(UserName) > 2), TotalHostsImpacted=dcountif(SessionHostName, strlen(SessionHostName) > 2)\r\n by ActivityType, ServiceError, Source, Error\r\n) on ActivityType, ServiceError, Source, Error\r\n| project Kind=iif(ServiceError, \"Service\", \"Deployment\"), Source, Error, MessageSample, TotalActivitiesImpacted, ActivitiesImpactedOverTime, TotalHostsImpacted, HostsImpactedOverTime\r\n// Hosts count not applicable for Feed activities, so blank out the columns\r\n| extend TotalHostsImpacted=iif(\"{wvdActivityType}\" != \"Feed\", TotalHostsImpacted, int(null)), HostsImpactedOverTime=iif(\"{wvdActivityType}\" != \"Feed\", HostsImpactedOverTime, series_divide(HostsImpactedOverTime, todouble(0/0)))\r\n| sort by TotalActivitiesImpacted, TotalHostsImpacted\r\n| top {TopNErrors} by TotalActivitiesImpacted",
"size": 0,
"aggregation": 3,
"title": "Ranking of errors impacting connection activities for {UserName} in {TimeRange:label}",
"noDataMessage": "No errors reported in the selected time period",
"timeContextFromParameter": "TimeRange",
"exportFieldName": "label",
"exportParameterName": "wvderror",
"showExportToExcel": true,
"queryType": 0,
"resourceType": "microsoft.desktopvirtualization/hostpools",
"crossComponentResources": [
"{HostPools}"
],
"visualization": "table",
"gridSettings": {
"formatters": [
{
"columnMatch": "Kind",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "==",
"thresholdValue": "Service",
"representation": "Important",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "Deployment",
"representation": "3",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"representation": "Blank",
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "TotalActivitiesImpacted",
"formatter": 4,
"formatOptions": {
"min": 0,
"palette": "blue"
}
},
{
"columnMatch": "ActivitiesImpactedOverTime",
"formatter": 21,
"formatOptions": {
"palette": "blue",
"customColumnWidthSetting": "210px"
}
},
{
"columnMatch": "TotalHostsImpacted",
"formatter": 4,
"formatOptions": {
"min": 0,
"palette": "magenta"
}
},
{
"columnMatch": "HostsImpactedOverTime",
"formatter": 21,
"formatOptions": {
"palette": "magenta",
"customColumnWidthSetting": "210px"
}
},
{
"columnMatch": "TotalUsersImpacted",
"formatter": 4,
"formatOptions": {
"palette": "turquoise"
}
},
{
"columnMatch": "UsersImpactedOverTime",
"formatter": 21,
"formatOptions": {
"palette": "turquoise"
}
}
],
"labelSettings": [
{
"columnId": "MessageSample",
"label": "Message sample"
},
{
"columnId": "TotalActivitiesImpacted",
"label": "Activities"
},
{
"columnId": "ActivitiesImpactedOverTime",
"label": "Over time"
},
{
"columnId": "TotalHostsImpacted",
"label": "Hosts"
},
{
"columnId": "HostsImpactedOverTime",
"label": "Over time"
}
]
},
"sortBy": [],
"tileSettings": {
"showBorder": false,
"titleContent": {
"columnMatch": "CodeSymbolic",
"formatter": 1
},
"leftContent": {
"columnMatch": "ErrorRate",
"formatter": 12,
"formatOptions": {
"palette": "auto"
},
"numberFormat": {
"unit": 17,
"options": {
"maximumSignificantDigits": 3,
"maximumFractionDigits": 2
}
}
}
},
"graphSettings": {
"type": 0,