Hi kavya madda,
Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.
To get the list of users who have not logged into Azure Virtual Desktop (AVD) under a host pool for 20 or more days, you can follow these steps:
Prerequisites:
- Ensure that Log Analytics Workspace is set up and connected to AVD.
- You need Desktop Virtualization Reader role on the host pool and Reader or Contributor role on Log Analytics Workspace.
- Enable audit logs for user sessions in AVD by setting up Diagnostic Settings.
Steps to Achieve This:
- Enable Log Analytics for AVD by configuring diagnostic settings to forward AVD session host logs to your Log Analytics workspace. You can refer to this guide for setup: Azure Monitor diagnostics settings.
- Query Log Analytics with this Kusto query to find users who haven't logged in for the last 20 days:
WVDConnections
| where TimeGenerated > ago(30d)
| summarize lastLogin=max(TimeGenerated) by UserName
| where lastLogin < ago(20d)
For more information, please refer to this guide: Enable Insights to monitor Azure Virtual Desktop.
If you have any further queries, do let us know. If the comment is helpful, please click "Upvote".