0

I 'm looking for a KQL (Kusto) query that gives me the total number of users per application or per application group for an Azure Virtual Desktop hostpool from the Log Analytics Workspace. This query gives the total number of users per hostpool, but I would to distinct that further:

WVDConnections
| where TimeGenerated > ago(7d) 
| where State == "Connected" 
| project _ResourceId, UserName
| project-rename Hostpool = _ResourceId 
| summarize DistinctUsers= dcount(UserName) by Hostpool
| extend HostPool=toupper(strcat(split(Hostpool, "/")[4], ".", split(Hostpool, "/")[8]))
| project HostPool, DistinctUsers

Thanks!

It is not giving enough information.

7
  • 1
    What information is missing and what is your actual question?
    – decius
    Commented Jul 3 at 6:26
  • Also have a look at this answer. It sounds very similar to your question.
    – decius
    Commented Jul 3 at 7:13
  • This is the question: I 'm looking for a KQL (Kusto) query that gives me the total number of users per application or per application group for an Azure Virtual Desktop hostpool from the Log Analytics Workspace.
    – Jaap2024
    Commented Jul 5 at 6:31
  • Your query looks good. Which information is missing?
    – decius
    Commented Jul 5 at 6:34
  • Yes, this query is working, but I also want to export the users per application group (desktops & remoteapps).
    – Jaap2024
    Commented Jul 8 at 5:00

1 Answer 1

0

Have you already tried this (the datatable is only for testing purposes):

let WVDConnections = datatable(TimeGenerated: datetime, UserName: string, ApplicationGroupName: string)
[
    datetime(2024-07-01 08:00:00), "[email protected]", "DesktopGroup1",
    datetime(2024-07-02 09:00:00), "[email protected]", "DesktopGroup1",
    datetime(2024-07-03 10:00:00), "[email protected]", "RemoteAppGroup1",
    datetime(2024-07-04 11:00:00), "[email protected]", "RemoteAppGroup1",
    datetime(2024-07-05 12:00:00), "[email protected]", "DesktopGroup2",
    datetime(2024-07-07 13:00:00), "[email protected]", "RemoteAppGroup2",
    datetime(2024-07-07 14:00:00), "[email protected]", "RemoteAppGroup2",
    datetime(2024-07-08 15:00:00), "[email protected]", "DesktopGroup1",
    datetime(2024-07-09 16:00:00), "[email protected]", "DesktopGroup2",
    datetime(2024-07-10 17:00:00), "[email protected]", "RemoteAppGroup2"
];
WVDConnections
| where TimeGenerated >= ago(10d) 
| summarize Users = make_set(UserName) by ApplicationGroupName
| project ApplicationGroupName, Users

Sample code here.

3
  • WVDConnections | where TimeGenerated > ago(7d) | where State == "Connected" | project _ResourceId, ResourceAlias, UserName | project-rename Hostpool = _ResourceId | project-rename Application = ResourceAlias | extend HostPool=toupper(strcat(split(Hostpool, "/")[4], ".", split(Hostpool, "/")[8])) | summarize DistinctUsers= dcount(UserName) by Application, Hostpool
    – Jaap2024
    Commented Jul 12 at 13:20
  • And what is missing?
    – decius
    Commented Jul 12 at 13:24
  • No, I think it's good now.
    – Jaap2024
    Commented Jul 15 at 4:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.