A Microsoft desktop and app virtualization service that runs on Azure. Previously known as Windows Virtual Desktop.
Hello Hans van Deursen,
Your dynamic host pool (using the preview dynamic autoscaling feature) relies on the scaling plan’s ramp-down settings, capacity threshold, and minimum host percentage to deallocate or delete hosts. The most common reasons hosts are not removed are missing RBAC permissions on the Azure Virtual Desktop service principal or the presence of (disconnected) sessions that prevent consolidation below the capacity threshold. The “stuck” total sessions count in the Session Hosts blade is a known portal synchronization behavior—overview refreshes in near real-time on session changes, but the detailed Session Hosts view may lag until a status-changing action (like enabling drain mode) triggers a refresh.
1.Verify and assign the required RBAC permissions (most frequent cause of scaling not working) The Azure Virtual Desktop service principal must have the Desktop Virtualization Power On Off Contributor role at the subscription level (not resource group or host pool).
- In the Azure portal, go to your subscription → Access control (IAM) → Add → Add role assignment.
- Select Desktop Virtualization Power On Off Contributor.
- Under Members, choose User, group, or service principal and search for Microsoft Azure Virtual Desktop (or the app ID Microsoft.VirtualDesktop).
- Assign and wait 5–10 minutes for propagation.
- This permission is required for the scaling plan to start, stop, deallocate, or delete session hosts.
2.Review and adjust your scaling plan configuration
- Go to Azure Virtual Desktop → Scaling plans → select your plan → Properties and Schedules.
- In the Ramp-down phase, confirm:
- Capacity threshold (%) is set appropriately (e.g., 20–30 % for aggressive scale-down).
- Minimum percentage of active hosts (%) is low enough (e.g., 0 % or 10 % for testing).
- Force logoff of users is enabled (with notification and wait time) if you want hosts removed even when sessions are present.
- Maximum host pool size matches or exceeds your current hosts.
- Save changes and allow the next evaluation cycle (triggered by session change events or periodic checks).
- Tip for testing: Temporarily set Minimum percentage of active hosts to 0 % and enable force logoff to confirm scale-down works.
https://learn.microsoft.com/en-us/azure/virtual-desktop/autoscale-faq
3.Address the stuck total sessions counter in Session Hosts view
- As you observed, enabling drain mode on the affected host forces the broker to refresh and update the session count (this is the expected way the portal reconciles the view).
- Quick workaround:
- In Manage > Session Hosts, select the host → Drain mode → Enable.
- Wait for the session count to update.
- Disable drain mode once verified.
For a permanent view, use PowerShell to check real-time status:
Get-AzWvdSessionHost -HostPoolName <YourHostPool> -ResourceGroupName <RG> | Select Name, Status, Sessions
- Refresh the portal browser or wait a few minutes after logoff events—overview updates are faster than the detailed blade.
https://learn.microsoft.com/en-us/azure/virtual-desktop/drain-mode?tabs=portal
4.Enable diagnostics for visibility
- On your scaling plan → Diagnostic settings → Add diagnostic setting.
- Send ScalingPlanOperations and ScalingPlanEvaluation categories to a Log Analytics workspace.
- This will log every scaling evaluation and help us (or you) see exactly why a host was or wasn’t deallocated. https://learn.microsoft.com/en-us/azure/virtual-desktop/autoscale-diagnostics
After applying the RBAC fix and reviewing the ramp-down settings, test a full logon/logoff cycle during ramp-down and let us know the results.
Thanks.