Oct 19 2021 04:48 AM - edited Oct 24 2021 06:31 AM
Just notice that I have a new tab under my AVD Portal for Scaling Plan.
Before I just explore it, I checked Microsoft DOCs to understand the new feature and see how I can enable it, but I didn't find any relevant info even when I google it I end up with the same result... did I stop here.. Absolutely not, created a temp host pool and followed the wizard to enable and configure the new feature and here is my test result
Autoscaling is a demanded feature and has been waiting for so long, we used to automatically scale host sessions using PowerShell scripts and Azure Automation, but it was long and complicated procedures involving a lot of components, Now with AVD Scaling plans you can define ramp-up hours, peak hours, ramp-down hours, and off-peak hours for weekdays and specify autoscaling triggers. but you can only add one schedule per day and a Scaling plan must include an associated schedule for at least one day of the week.
Requirements
Click on JSON Tab
Click on Edit Tab
Past the following JSON template
{
"properties": {
"roleName": "Autoscale",
"description": "Friendly description.",
"assignableScopes": [
"/subscriptions/<SubscriptionID>"
],
"permissions": [
{
"actions": [
"Microsoft.Insights/eventtypes/values/read",
"Microsoft.Compute/virtualMachines/deallocate/action",
"Microsoft.Compute/virtualMachines/restart/action",
"Microsoft.Compute/virtualMachines/powerOff/action",
"Microsoft.Compute/virtualMachines/start/action",
"Microsoft.Compute/virtualMachines/read",
"Microsoft.DesktopVirtualization/hostpools/read",
"Microsoft.DesktopVirtualization/hostpools/write",
"Microsoft.DesktopVirtualization/hostpools/sessionhosts/read",
"Microsoft.DesktopVirtualization/hostpools/sessionhosts/write",
"Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/delete",
"Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/read", "Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/sendMessage/action",
"Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions/read"
],
"notActions": [],
"dataActions": [],
"notDataActions": []
}
]
}
}
Change <SubscriptionID> with your SubscriptionID
Save the template
Click Review + Create.
Last, Click Create.
Next, Click on Select members
In the search bar, enter and select Windows Virtual Desktop, as shown in the following screenshot.
Last, Click Review + Assign.
As you can see the below step is almost the same as the previous one, so just to clarify the difference:
Usually, every application has its own peak hours where concurrent users tend to increase slowly before the start of peak time. same for AVD users start getting in slowing to the host sessions and at a specific time most of the users will start hitting the services (this is the peak hour)
Then Create..
In the next step, we have to assign the host pool that we will apply this schedule on, scaling plan can be assigned to any number of host pools.
Review and Create..
Testing And Validation
After a few minutes of creating the scaling plan..
Jump to the running AVD virtual machine and check the activity log, you should get an activity stating that the VM was started and this event initiated by WindowsVirtal Desktop App.
Nov 01 2021 02:23 AM
Nov 01 2021 02:29 AM
@Robert Folkers You're logic is right. I had the same problem but now looking at the json (log) it is not the total hostpool capacity but it is the percentage of the current running hosts. So if 5 hosts are running with 10 sessions per host, in my opinion, it calculates the percentage of the current sessions and if that is above the percentage of in this case max 50 sessions, it will power up machines so the percentage will be below your percentage.
Nov 01 2021 02:33 AM
@robbie64 Thanks for verifying this!
Nov 04 2021 03:12 PM
Nov 04 2021 05:14 PM
Nov 05 2021 02:29 AM - edited Nov 05 2021 02:58 AM
What i do see in the logs is that sessionhosts that are turned in Drainmode plus the exclusion tag set still being counted with minimum host percentage. It sounds to me that is not right. VM's with the exlusion tag should not be calculated within the host percentage. I say this because when we do create a new release we will have double the amount of machines before we cleanup the old ones. Maybe I am not sure i get the way you have to put the Tag on the VM. My tag is called excludescaling and i put as value Y. In the schedule i called the exclusiontag excludescaling. Is this the way?
Nov 05 2021 04:16 PM
Hi @robbie64,
Thank you so much for your comment. Could you please provide a bit more details from your example so that we can look into what is happening. More specifically, it would be helpful if you could provide screenshots of where you have placed the tag on the VM and what you are seeing in the logs, plus your subscription ID, host pool, resource ID, and timestamps (when you observed this happening). (Feel free to send me a private message with this sensitive information.) Thank you so much!
Nov 06 2021 03:55 AM
@Seneca_Friend I have a total of 8 hosts in the hostpool. 4 hosts are a new release the other 4 hosts are in drain mode and have the exclusion tag and powered off, ready to be deleted. My scalingplan says a minimum of 50% hosts should be active. In my opinion that should then be 2 hosts minumum, but the plan powers them all on (the 4 newly created). The schedule should turn 2 off since my amount off sessions is below the threshold but the log says the it keeps them on otherwise it would go below the 50% of active hosts. In my believe the 50% should be calculated from 4 hosts and not 8.
Here is a screenshot with the tag. If u need more info let me know, can sent te log through private message if needed.
Tag on VM:
Setting on Scaling plan:
Nov 08 2021 10:20 AM
Nov 08 2021 11:14 AM
Nov 23 2021 11:49 PM
@Robert Folkers To my understanding the threshold of 60% means the actual user sessions / all user sessions on the currently running VMs.
Feb 05 2022 03:46 PM
Feb 18 2022 06:45 AM
Any update to wider availability? I've been testing for a while with scaling plans in their limited regions, none of which are the same regions at my host pools. I'm just now getting alerted that any scaling plan assigned to a host pool in a different region will be disabled on March 21st. My entire infra is in regions not yet supported by scaling plans, and it looks like the plans are still limited to just these four regions: northeurope, westeurope, eastus2, centralus
Feb 18 2022 09:15 AM
Feb 18 2022 09:18 AM
Feb 18 2022 09:22 AM
Feb 23 2022 12:29 AM
Feb 23 2022 12:00 PM
Mar 03 2022 08:01 AM
We really need a timeline of this being available in UK South.
Is there any sort of date ?
Mar 03 2022 08:04 AM