Automate Windows Virtual Desktop (WVD) User Utilization Reporting for Chargeback Model using Azure Logic Apps

Since the announcement of Windows Virtual Desktop (WVD) in September 2018, I have seen many different scenarios and adoption by a wide range of customers.

Chargeback Model Scenario

One of the scenarios is developing a chargeback model for IT to bill their end user’s usage back to their business unit. The most common approach is a “SaaS based” per user per month (pupm), depending on the user profile type (i.e. light, medium, heavy use).

Windows Virtual Desktop Logs

Overview

Windows Virtual Desktop uses Azure Monitor for monitoring and alerts like many other Azure services. This allows admin or users with the necessary RBAC to identify issues through a single interface. The activities logs are collected in Log Analytics and there are the following categories:

  • Feed
  • Connections
  • Host Registration
  • Errors
  • Checkpoints
Sample KQL for Windows Virtual Desktop in Log Analytics

Definition of Session Duration in WVD

Log Analytics only reports in these intermediate states for connection activities:

  • Connected: when the user successfully connects to the VM where the app or desktop is hosted.
  • Completed: when the user or server disconnects the session the activity took place in.
Illustration of Session Duration Time — Session Desktop
Illustration of Session Duration Time — Remote App

Query

In the sample query, there is a Session Duration query and you can load the query in the query editor. To get session duration activities, the data is found in WVDConnections table. You can refer to the table reference in this link. Below is the sample generated query:

Query result for Session Duration by user
Adding more data points to the query
  • On top of the above information, IT would like to know more information about the user such as Department and Employee ID so that they can easily massage the generated data and bill respective departments.

Automation using Azure Logic Apps for Chargeback model reporting

Azure Logic Apps is a cloud service that helps you schedule, automate, and orchestrate tasks, business processes, and workflows when you need to integrate apps, data, systems, and services across enterprises or organizations.

High Level Workflow Design for this scenario
Sample Logic App for Chargeback model reporting

Recurrence Trigger

Monthly recurrence trigger

Run query and list result

Create CSV table

Send an email

Running the Logic App

Summary

We are able to automate this customized reporting using Azure Logic Apps — exploring the use of different connectors available today. As always, I enjoyed the process to think through the problem statement and find the most practical approach to meet the requirements.

Closet geek, on the cloud journey with @Azure. Love Baseball. Git + LinkedIn: jenzushsu

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store