Drain session hosts for maintenance in Azure Virtual Desktop

Drain mode enables you to isolate a session host when you want to perform maintenance without disruption to service. When a session host is set to drain, it won't accept new user sessions. Any new connections will be redirected to the next available session host. Existing connections to the session host will remain active until the user signs out or an administrator ends the session. Once there aren't any sessions remaining on the session host, you can perform the maintenance you need. Administrators can still remotely connect to the server directly without going through the Azure Virtual Desktop service.

This article shows you how to drain session hosts using the Azure portal or Azure PowerShell.

Prerequisites

To drain session hosts, you need:

Enable and disable drain mode for a session host

Here's how to enable and disable drain mode for a session host using the Azure portal and PowerShell.

To enable drain mode for a session host and block new sessions in the Azure portal:

  1. Sign in to the Azure portal.

  2. In the search bar, type Azure Virtual Desktop and select the matching service entry.

  3. From the Azure Virtual Desktop overview page, select Host pools.

  4. Select the host pool that contains the session host you want to drain, then select Session hosts.

  5. Check the box next to the session host you want to enable drain mode, then select Turn drain mode on.

  6. When you're ready to allow new connections to the session host, check the box next to the session host you want to disable drain mode, then select Turn drain mode off.