Skip to main content
Jorge Bernhardt Jorge Bernhardt
  1. Posts/

How to configure RDP properties for a Host Pool - AV redirection

·1239 words·6 mins· 100 views · 5 likes ·
Azure CLI Azure PowerShell Azure Virtual Desktop Connect-AzAccount

Today I want to show you how to configure Device redirections for your Azure Virtual Desktop environment using PowerShell and Azure CLI. Given that several properties and different configurations are possible, I divided the information into 2 articles. The first article will demonstrate how to configure the RDP properties for Audio and Video Redirection, and a second post will show you how to set up RDP properties for local devices and resource redirection. OK, let’s go.

Azure PowerShell Workaround>

Azure PowerShell Workaround #

First, you need to ensure the Az.DesktopVirtualization module is installed on your computer and imported into your Powershell session. To do that, you should use the following commands.

Install-Module Az.DesktopVirtualization
Import-Module Az.DesktopVirtualization

Once you’ve imported the module, you’re ready to go. The easiest way to get started is to log in interactively at the command line.

Connect-AzAccount

This cmdlet will bring up a dialog box prompting you for your email address and password associated with your Azure account. You can choose the default subscription if you have more than one associated with your mail account. To perform this task, we will use the following commands:

Get-AzSubscription
Select-AzSubscription -Subscription "My Subscription"

Once you set your default subscription, you’re ready to start.

Set the variables>

Set the variables #

Here, we define the characteristics of our environment and the resource’s properties.

$resourceGroupName="RG-DEMO-WE"
$hostPoolName="HP-DEMO-WE"
Define RDP properties for AV redirection>

Define RDP properties for AV redirection #

To set a custom RDP property, you should use the Update-AzWvdHostPool cmdlet.

Microphone redirection>

Microphone redirection #

This setting determines how sounds captured (recorded) on the local computer are handled when connected to the remote computer. These are the accepted values.

  • audiocapturemode:i:0 - Disable audio capture from the local device.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "audiocapturemode:i:0"
  • audiocapturemode:i:1 - Enable audio capture from the local device and redirection to an audio application in the remote session.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "audiocapturemode:i:1"
Redirect video encoding>

Redirect video encoding #

This setting enables or disables redirected video encoding. These are the accepted values.

  • encode redirected video capture:i:0 - Disable encoding of redirected video.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "encode redirected video capture:i:0"
  • encode redirected video capture:i:1 - Enable encoding of redirected video.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "encode redirected video capture:i:1"
Encoded video quality>

Encoded video quality #

This setting controls the quality of the encoded video. These are the accepted values.

  • quality:i:0 - High compression video.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "redirected video capture encoding quality:i:0"
  • quality:i:1 - Medium compression video.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "redirected video capture encoding quality:i:1"
  • quality:i:2 - Low compression video with high picture quality.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "redirected video capture encoding quality:i:2"
Audio output location>

Audio output location #

This setting determines how sounds captured (recorded) on the local computer are handled when you are connected to the remote computer. These are the accepted values.

  • audiomode:i:0 - Play sounds on the local computer
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "audiomode:i:2"
  • audiomode:i:1 -Play sounds on the remote computer.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "audiomode:i:1"
  • audiomode:i:2 -Do not play sounds.
Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "audiomode:i:0"
Define multiple custom RDP properties>

Define multiple custom RDP properties #

To set multiple custom RDP properties, you should use the Update-AzWvdHostPool cmdlet with the following syntax.

Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty "audiocapturemode:i:0;encode redirected video capture:i:0;redirected video capture encoding quality:i:0;audiomode:i:0"

And verify your changes with the Get-AzWvdHostPool cmdlet.

Get-AzWvdHostPool `
    -Name $hostPoolName \`
    -ResourceGroupName $resourceGroupName `
    | format-list Name, CustomRdpProperty

Get-AzWvdHostPool

Reset all custom RDP properties>

Reset all custom RDP properties #

If you want to reset all custom RDP properties, you should use the Update-AzWvdHostPool cmdlet with the following syntax.

Update-AzWvdHostPool `
    -Name $hostPoolName `
    -ResourceGroupName $resourceGroupName `
    -CustomRdpProperty ""
Azure CLI Workaround>

Azure CLI Workaround #

In this case, we will use Azure Cloud Shell, a browser-based shell built into Azure Portal. This allows us to use the Azure command-line tools (Azure CLI and Azure PowerShell) directly from a browser. If you want to know more about Azure Cloud Shell, check out this link. First, we define the characteristics of our environment and store the values in variables.

resourceGroupName="RG-DEMO-WE"
hostPoolName="HP-DEMO-WE"
Define RDP properties for AV redirection>

Define RDP properties for AV redirection #

To set a custom RDP property, you should use the following command.

Microphone redirection>

Microphone redirection #

This setting determines how sounds captured (recorded) on the local computer are handled when connected to the remote computer. These are the accepted values.

  • audiocapturemode:i:0 - Disable audio capture from the local device.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "audiocapturemode:i:0"
  • audiocapturemode:i:1 - Enable audio capture from the local device and redirection to an audio application in the remote session
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "audiocapturemode:i:1"
Redirect video encoding>

Redirect video encoding #

This setting enables or disables redirected video encoding. These are the accepted values.

  • encode redirected video capture:i:0 - Disable encoding of redirected video.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "encode redirected video capture:i:0"
  • encode redirected video capture:i:1 - Enable encoding of redirected video
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "encode redirected video capture:i:1"
Encoded video quality>

Encoded video quality #

This setting controls the quality of the encoded video. These are the accepted values.

  • quality:i:0 - High compression video.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "redirected video capture encoding quality:i:0"
  • quality:i:1 - Medium compression video.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "redirected video capture encoding quality:i:1"
  • quality:i:2 - Low compression video with high picture quality.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "redirected video capture encoding quality:i:2"
Audio output location>

Audio output location #

This setting determines how sounds captured (recorded) on the local computer are handled when you are connected to the remote computer. These are the accepted values.

  • audiomode:i:0 - Play sounds on the local computer.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "audiomode:i:0"
  • audiomode:i:1 -Play sounds on the remote computer.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "audiomode:i:1"
  • audiomode:i:2 -Do not play sounds.
az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "audiomode:i:2"
Define multiple custom RDP properties>

Define multiple custom RDP properties #

To set multiple custom RDP properties, you should use the following command.

az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property "audiocapturemode:i:0;encode redirected video capture:i:0;redirected video capture encoding quality:i:0;audiomode:i:0"

And verify your changes with the following command.

az desktopvirtualization hostpool show \
--name $hostPoolName \
--resource-group $resourceGroupName \
--query "[name, customRdpProperty]"

AV redirection

Reset all custom RDP properties>

Reset all custom RDP properties #

If you want to reset all custom RDP properties, you should use the following command.

az desktopvirtualization hostpool update \
--name $hostPoolName \
--resource-group $resourceGroupName \
--custom-rdp-property ""

Thanks for reading my post. I hope you find it helpful.

In the following article, I’ll explain how to configure RDP properties for a Host Pool - Device redirection.

Check out this link to learn more about Configuring Device redirections.