1. Key Findings:
1. Dynamic autoscaling for pooled host pools with session host configuration is currently in PREVIEW.
2. Dynamic autoscaling cannot turn session hosts on/off and delete/create them at the same time; it can only perform one action at a time. If you want to fully utilize the power of dynamic autoscaling, you should choose the latter option, as turning session hosts on/off is also handled by power management autoscaling.
3. Autoscaling works for 12-hour shifts. If the customer has a 24-hour shift, where users log in and log off at any time within the 24-hour period, the start time should be in the AM and the end time in the PM. The reverse setup will not work.
4.Make sure to have enough quota based on the maximum host pool size specified in the schedule.
2. Prerequisites:
1. Dynamic autoscaling can only be used with pooled host pools that have a session host configuration, as session host configurations only support pooled host pools. Please check my previous blog on how to configure Session host configuration host pool Session host update for Azure Virtual Desktop - A T L

2. Assign the 'Desktop Virtualization Power On Off Contributor' and 'Desktop Virtualization Virtual Machine Contributor' RBAC roles to the Azure Virtual Desktop service principal with your Azure subscription as the assignable scope.
3. A working host pool with the maximum session limit configured. In this scenario, we have a host pool with 3 session hosts, and the maximum session limit is set to 3.
4. Configure the following GPOs for the scaling plan to work as expected:
4.1 Computer Configuration-Policies-Administrative Templates-Windows Components-Remote Desktop Services-Remote Desktop Session Hosts-Device and Resource Redirection-Allow Time Zone Redirection-Enabled.
4.2 Computer Configuration-Policies-Administrative Templates-Windows Components-Remote Desktop Services-Remote Desktop Session Hosts-Session Time Limits
Enable 2 policies: Set time limit for active but idle Remote Desktop Services sessions
Set the time limit for disconnected sessions.
3. Create a scaling plan:
1. In the search bar, type scaling plan and select the matching service entry. Select Create.
2. Select the appropriate Subscription and the Resource Group.
3. Give a meaningful scaling plan.
4. Select the region. The host pool configuration region and the scaling plan region must be the same. Scroll down slightly.
5. Both are optional; provide a friendly name and, if needed, a description.
6. Select the appropriate time zone.
7. Select Pooled for Host pool type. Scroll down slightly.
8. Under the Scaling method select Dynamic autoscaling.
9. Click Next: Schedules.
10. Click +Add schedule.
12. For the 'Repeat on' tab, select either the complete 7 days, just the weekdays, or the weekends, depending on your requirement.
13. For the Minimum percentage of active hosts (%), this setting defines the minimum number of session host VMs that must always be running, based on the ‘Minimum host pool size’. For example, if the ‘Minimum percentage of active hosts’ is set to 100% and the ‘Minimum host pool size’ is set to 2, Autoscale will make sure that at least 2 session host is always available to handle user connections (100% * 2 = 2)
NOTE: If you want the scaling service to create or delete session hosts, you should have 100% of the minimum host pool size active. Any value other than 100 will not create or delete the session hosts; it will only turn them on or off.
14. For the Minimum host pool size: This is the number of session host VMs that should always be part of the host pool, whether they are running or stopped. Since the total capacity of the host pool is 3 session hosts and I don’t want all 3 to be available during off-business hours, I’ve set the minimum host pool size to 2, ensuring that the ultimate goal of using dynamic autoscaling is achieved.
15. For the Maximum host pool size: This is the maximum number of running session host VMs that can be available. It should be greater than or equal to the 'Minimum host pool size'. I’ve set the number to 4, meaning that in my host pool, there can be a maximum of 4 session hosts running, but no more than that.
16. Click Next.

17. In the Ramp-up tab, the 'Repeats on' and 'Time zone' fields are auto-populated.
18. For the Start time select a time from the drop-down menu to start preparing VMs for peak business hours.
19. For Load balancing algorithm recommended setting is breadth-first algorithm. Breadth-first load balancing will distribute users across existing VMs to keep access times fast.
20. For Capacity threshold enter the percentage of available host pool capacity that will trigger a scaling action to take place. For example, if capacity threshold is specified as 30% and your total host pool capacity is 9 sessions, auto scale will create additional session hosts once the host pool exceeds a load of 2 sessions.
21.The numbers specified for Minimum percentage of active hosts (%), Minimum host pool size, and Maximum host pool size are the same as those in the General tab because I've noticed that these values should match across all tabs. For example, if you set the Minimum host pool size to 2 in the General tab and 3 here, the number 2 will change to 3, which might be a bug, but it changes.
22. Click Next.
23. In the Peak hours tab, the 'Repeats on' and 'Time zone' fields are auto-populated.
24. For the Start time, enter the time when the user's shift begins.
25. For Load balancing algorithm I have selected the default option, which is depth-first load balancing.
26. The rest of the tabs are greyed out, as they are carried forward from the Ramp-up tab.
27. Click Next.
28. In the Ramp-down tab, the 'Repeats on' and 'Time zone' fields are auto-populated.
29. Enter a Start time for the scaling plan to reduce the number of virtual machines prior to the off-peak or non-business hours. This is also the end time for peak hours.
30. For Load balancing algorithm I have selected the default option, which is depth-first load balancing.
31.For the Capacity threshold, enter the percentage of available host pool capacity that will trigger the scaling action to delete session hosts. For example, if the capacity threshold is set to 50% and your total host pool capacity is 9 sessions, auto scale will start deleting session hosts once the host pool utilization reaches around 5 sessions.
32. Select No to Force sign out users.
33. Stop VMs when VMs have no active or disconnected sessions. Scroll down slightly.
34. The Virtual machine limit numbers are the same as that of the General tab.
35. Click Next.

36. In the Off-Peak Hours tab, the 'Repeats on' and 'Time zone' fields are auto-populated.
37. Select the start time that corresponds to the end of the user's shift.
38. For Load balancing algorithm I have selected Breadth-first load balancing.
39. The rest of the tabs are greyed out, as they are carried forward from the Ramp-down tab.
40. Click Add.
41. Click Next: Host pool assignments.
42. Select the host pool.
43.The box for 'Enable autoscale' is already checked.
44. Click Next: Tags.
45. Provide the appropriate tags. Click Next: Review +Create.
46. Click Create.
47.The deployment is completed.
4. Testing:
1. This was the scenario before auto-scaling was set up, where all 3 session hosts were up and running.
2. When the Ramp-up started at 6.45PM IST, the session host count was reduced to 2 because of the Minimum percentage of active hosts (%) calculation. ‘Minimum percentage of active hosts’ is set to 100% and the ‘Minimum host pool size’ is set to 2 (100% * 2 = 2 Session hosts)
3. During the peak hour at 7:00 PM IST, additional session hosts were created as users began logging in. Initially, there were 2 VMs, which increased to 3 and then to a maximum of 4 VMs.4. During the ramp-down at 7:15 PM IST, the VM count was reduced from 4 to 3 and then to 2 (the minimum count) as users started logging off.
5. During off-peak hours from 7:30 PM IST, there were no users, and the session host count remained at 2 due to the Minimum percentage of active hosts (%) setting.
Comments
Post a Comment