Skip to content

Commit 4e53c49

Browse files
committed
AVD drain mode
1 parent 266a27b commit 4e53c49

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

articles/virtual-desktop/drain-mode.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,19 @@ author: Heidilohr
66

77
ms.service: virtual-desktop
88
ms.topic: how-to
9-
ms.date: 04/14/2021
9+
ms.date: 02/09/2024
1010
ms.author: helohr
1111
---
1212

1313
# Use drain mode to isolate session hosts and apply patches
1414

1515
Drain mode isolates a session host when you want to apply patches and do maintenance without disrupting user sessions. When isolated, the session host won't accept new user sessions. Any new connections will be redirected to the next available session host. Existing connections in the session host will keep working until the user signs out or the administrator ends the session. When the session host is in drain mode, admins can also remotely connect to the server without going through the Azure Virtual Desktop service. You can apply this setting to both pooled and personal desktops.
1616

17-
## Set drain mode using the Azure portal
17+
## Enable drain mode
18+
19+
Here's how to enable drain mode using the Azure portal and PowerShell.
20+
21+
### [Portal](#tab/portal)
1822

1923
To turn on drain mode in the Azure portal:
2024

@@ -26,25 +30,41 @@ To turn on drain mode in the Azure portal:
2630

2731
4. To turn off drain mode, select the host pools that have drain mode turned on, then select **Turn drain mode off**.
2832

29-
## Set drain mode using PowerShell
33+
### [PowerShell](#tab/powershell)
3034

3135
You can set drain mode in PowerShell with the *AllowNewSessions* parameter, which is part of the [Update-AzWvdSessionhost](/powershell/module/az.desktopvirtualization/update-azwvdsessionhost) command.
3236

3337
Run this cmdlet to enable drain mode:
3438

3539
```powershell
36-
Update-AzWvdSessionHost -ResourceGroupName <resourceGroupName> -HostPoolName <hostpoolname> -Name <hostname> -AllowNewSession:$False
40+
$params = @{
41+
ResourceGroupName = "<resourceGroupName>"
42+
HostPoolName = "<hostpoolname>"
43+
Name = "<hostname>"
44+
AllowNewSession = $False
45+
}
46+
47+
Update-AzWvdSessionHost @params
3748
```
3849

3950
Run this cmdlet to disable drain mode:
4051

4152
```powershell
42-
Update-AzWvdSessionHost -ResourceGroupName <resourceGroupName> -HostPoolName <hostpoolname> -Name <hostname> -AllowNewSession:$True
53+
$params = @{
54+
ResourceGroupName = "<resourceGroupName>"
55+
HostPoolName = "<hostpoolname>"
56+
Name = "<hostname>"
57+
AllowNewSession = $True
58+
}
59+
60+
Update-AzWvdSessionHost @params
4361
```
4462

4563
>[!IMPORTANT]
4664
>You'll need to run this command for every session host you're applying the setting to.
4765
66+
---
67+
4868
## Next steps
4969

5070
If you want to learn more about the Azure portal for Azure Virtual Desktop, check out [our tutorials](create-host-pools-azure-marketplace.md). If you're already familiar with the basics, check out some of the other features you can use with the Azure portal, such as [MSIX app attach](app-attach-azure-portal.md) and [Azure Advisor](../advisor/advisor-overview.md).

0 commit comments

Comments
 (0)