When leveraging Azure Virtual Desktop Insights with the default Azure Monitor Workbook, you’ll gain a built-in overview of both monthly and daily user activity for all host pools or specific host pools. This makes it easy to monitor usage patterns and optimize performance
Unfortunately, Azure Virtual Desktop Insights doesn’t offer a detailed drill-down of individual connected users. If you need precise information on which users have been connected for reporting purposes, you can use the following custom query in the Log Analytics Workspace.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
let period = 1d; WVDConnections | where TimeGenerated > ago(period) | where _ResourceId == "/subscriptions/<SUBSCRIPTION-ID>/resourcegroups/<RESOURCE-GROUP-NAME>/providers/microsoft.desktopvirtualization/hostpools/<HOSTPOOL-NAME>" | where State == "Connected" | project CorrelationId , UserName, ConnectionType , StartTime=TimeGenerated | join kind=inner ( WVDConnections | where State == "Completed" | project EndTime=TimeGenerated, CorrelationId ) on CorrelationId | extend SessionDuration = EndTime - StartTime | summarize TotalConnectionTime = sum(SessionDuration) by UserName, ConnectionType |
You can easily adjust the time range by modifying the period
value in the let
statement. This will generate the following output.
If you want to retrieve user information for all host pools, simply remove the where
operator that filters by _ResourceID
.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
let period = 1d; WVDConnections | where TimeGenerated > ago(period) | where State == "Connected" | project CorrelationId , UserName, ConnectionType , StartTime=TimeGenerated | join kind=inner ( WVDConnections | where State == "Completed" | project EndTime=TimeGenerated, CorrelationId ) on CorrelationId | extend SessionDuration = EndTime - StartTime | summarize TotalConnectionTime = sum(SessionDuration) by UserName, ConnectionType |
You can easily extend the query with the top
parameter to analyze which users are the most active in the specified host pool.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
let period = 1d; WVDConnections | where TimeGenerated > ago(period) | where _ResourceId == "/subscriptions/<SUBSCRIPTION-ID>/resourcegroups/<RESOURCE-GROUP-NAME>/providers/microsoft.desktopvirtualization/hostpools/<HOSTPOOL-NAME>" | where State == "Connected" | project CorrelationId , UserName, ConnectionType , StartTime=TimeGenerated | join kind=inner ( WVDConnections | where State == "Completed" | project EndTime=TimeGenerated, CorrelationId ) on CorrelationId | extend SessionDuration = EndTime - StartTime | summarize TotalConnectionTime = sum(SessionDuration) by UserName, ConnectionType | top 5 by TotalConnectionTime desc |
Hope this helps until a new feature is added to the Workbook, allowing you to retrieve user reports by simply clicking on a specific day.