Enable Azure Virtual Desktop Insights automated

  • last updated: Sun, 29 Jan 2023 12:50:32

Azure Virtual Desktop (AVD) Insights is a way to get sight into your AVD environment. In short (from Microsoft), Azure Virtual Desktop Insights is a dashboard built on Azure Monitor Workbooks that helps IT professionals understand their Azure Virtual Desktop environments.

In this blog post, I show how to configure AVD Insights in an automated way using the Az.Avd PowerShell module.
The commands used in the blog post are available in the v2.5.0-beta.32 and above.

AVD and Insights

The Insights part is based on a Log Analytics workspace. To make sure all AVD parts store logs into Log Analytics, we need to store all needed information in a workspace. It is not necessary to store all logs in the same workspace. But it is recommended to store session host information in a separate workspace. But there is more, we also need insight information from the AVD session hosts. Insight information like Windows Events and Performance Counters.

In the end, AVD Insights shows log information from different AVD components combined in a workbook.

To make AVD Insights work, diagnostics settings must be set with mandatory logs. The Az.Avd module provides commands that help configure AVD Insights with all mandatory settings.

The commands have an insights part in them. To check all the commands. use the command below.

Get-Command -module Az.Avd *insights*

insights-commands

In the commands below, I refer to @avdParams parameter.

$avdParams = @{
    hostpoolName      = "Rozemuller-AAD"
    resourceGroupName = 'rg-roz-avd-01'
}

Hostpool

The AVD toplevel component is a hostpool. This is the first component where to configure diagnostics settings in. AVD Insights at host pool level.

Assuming there is a Log Analytics Workspace already, I use the command below.

Enable-AvdInsightsHostpool @avdParams -LAWorkspace 'log-analytics-avd-89608' -LaResourceGroupName 'rg-roz-avd-mon' -DiagnosticsName 'avdInsights' -Verbose

If you don’t have a Log Analytics workspace yet, use the -autocreate flag and provide also the LaLocation and RetentionInDays parameters. The default SKU is standard. If you like to change it, then also provide the LaSku parameter.

avd-insights-hostpool

Application Group

The next level is the application group. Other categories apply to this setting. The command configures every application group in a host pool. Just provide the host pool details.

Enable-AvdInsightsApplicationGroup @avdParams -LAWorkspace 'log-analytics-avd-89608' -LaResourceGroupName 'rg-roz-avd-mon' -DiagnosticsName 'avdInsights' -Verbose

If you just want a specific application group enabled, then provide the ApplicationGroupName and ApplicationResourceGroup instead of the host pool details.

avd-insights-appgroup

Workspace

The last main AVD component is the workspace. To configure workspace insights use the code below. Also, this command is based on a host pool.

Enable-AvdInsightsWorkspace @avdParams -LAWorkspace 'log-analytics-avd-89608' -LaResourceGroupName 'rg-roz-avd-mon' -DiagnosticsName 'AVDInsights' -Verbose

If you want to enable Insights for a specific workspace, replace the host pool values with WorkspaceName and WorkspaceResourceGroup.

avd-insights-workspace

Session hosts

AVD session hosts are Windows Clients. To get all the needed information from these clients we need to configure the session hosts to send logs to a Log Analytics workspace.
To send logs, the OMSExtenstion extension is needed. The command below installs the extension.

Add-AvdInsightsSessionHost -id $id -WorkSpaceId $workspaceResourceId

The $id is the session host’s resource ID. You can get the ID using the Get-AvdSessionHost or Get-AvdSessionHostResources.

If hosts are missing you will see a screen like below.

avd-host-missing

Performance Counters and Events

In the last step, we configure the needed Windows Performance Counters and Events as sources in the Log Analytics workspace to capture.

Enable-AvdInsightsCounters -Id $resourceId -Verbose

avd-insights-counters

Verify

When all is configured correctly, you don’t see errors like the error below in the main Insights blade. avd-insights-errors

When looking into Insights (under Configuration Workbook) you will notice all checkmarks are green.

avd-hostpool-insights-ok

avd-workspace-insights-ok

Under the session host tab, no session hosts are listed. In the screen below, I ‘forgot’ one.

avd-hosts-insights-ok

Also, no counters and events are missing.

no-missing-counters no-missing-events

Data captured

At last, after some time, also there is data captured. I shot some of the graphs to show.

billed-data

event-data

For more information about AVD Insights, check the documentation at Microsoft Docs: https://learn.microsoft.com/en-us/azure/virtual-desktop/insights

Thank you for reading my blog enable azure virtual desktop insights automated.
I hope you got a bit inspired. Enjoy your day and happy automating 👋

comments powered by Disqus

Related Posts

Win32LOB intunewin file upload process explained for automation

Table Of Contents Create Win32LOB App portal process Create Win32LOB App in Intune Request intunewin file version Upload and commit intunewin file to Azure Storage Blob Create Win32LOB App in automation Create Win32LOB App in Intune automated Request intunewin file version Create place holder for intunewin file version automated Upload file to Win32 LOB App automated Summary A few days ago a question reached me about creating Win32Lob applications including the intunewin file upload using the REST API.

Read more

Add Microsoft Store (WinGet) app with icon into Intune automated

In the week of November 28, 2022, Microsoft released the new Microsoft Store which is implemented in Intune using the Windows Packager Manager. This is because the Microsoft Store for Business will be deprecated in the first quarter of 2023.

Read more

Route own Intune data to Log Analytics using custom logs

I often write blogs about getting data with the Graph API and using it for monitoring. A while ago I was thinking about how to get my own data into Log Analytics.

Read more