SOLVED

Azure Virtual Desktop (AVD) | Scaling plans and Autoscaling

Brass Contributor

AVD Scaling plans.png

 

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

 

AVD Scaling plans

 

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

  1. Create a Custom RBAC role
  2. Assign the custom role to Windows Virtual Desktop App

Create a Custom RBAC role

  1. Open a subscription or resource group
  2. Click on Access control (IAM)
  3. Click on Add Custom role

MahmoudAAtallah_6-1635081003235.png

 

Click on JSON Tab

 

MahmoudAAtallah_7-1635081037760.png

 

Click on Edit Tab

MahmoudAAtallah_8-1635081050566.png

 

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

 

MahmoudAAtallah_0-1635082258470.png

 

 

Save the template

MahmoudAAtallah_10-1635081095039.png

 

Click Review + Create.

MahmoudAAtallah_11-1635081108629.png

 

Last, Click Create.

 

Assign the custom role to Windows Virtual Desktop App:

  1. Open a subscription or resource group
  2. Click on Access control (IAM)
  3. Select Add role assignments.
  4. Select the role you just created (AutoScale)
 

MahmoudAAtallah_3-1635081600686.png

 

Next, Click on Select members

In the search bar, enter and select Windows Virtual Desktop, as shown in the following screenshot.

MahmoudAAtallah_2-1635081588805.png

 

Last, Click Review + Assign.

 

Create a scaling plan

 

2021-10-19 12_59_36-Create a scaling plan - Microsoft Azure and 10 more pages - Work - Microsoft​ Ed.png

 

  • As usual, we have to select Subscription, Resource Group, Name, and Location for the new resource.
  • Time Zone is important as the whole Autoscaling activity will be triggered and executed to Start/Stop host sessions based on the time zone you select here.

 

2021-10-19 12_57_03-weekdays_schedule - Microsoft Azure and 10 more pages - Work - Microsoft​ Edge.png

  • Next, you have to add a new Schedule and specify the Repeats on

2021-10-19 13_07_22-Add a schedule - Microsoft Azure and 10 more pages - Work - Microsoft​ Edge.png

 

  • Start time: you have to Enter a start time for the scaling plan, the specified time will be also the end time for off-peak hours.
  • Load-balancing algorithm: as you are going to use Autoscaling so the Depth-first load balancing option would be more relevant to your needs as its distributing the new user sessions to the available session host with the highest number of connections but has not reached its maximum session limit threshold which leads to minimizing the number of powered host sessions.
  • Minimum percentage of session hosts: Specify the minimum percentage of session hosts to start for ramp-up and peak hours, the percentage is based on the total number of session hosts in your host pool, so if the host pool includes 10 VMs and the percentage is 20% as in the above image, autoscale will ensure a minimum of 2 session host is available to take user connections.
  • Capacity threshold (%): This percentage evaluates whether to turn on/off VMs during the ramp-up and peak hours. So if your total host pool capacity is 100 sessions, and you specify a 60% Capacity threshold, once you exceed it, then autoscale will turn on additional session hosts.

 

2021-10-19 13_26_27-Add a schedule - Microsoft Azure and 10 more pages - Work - Microsoft​ Edge.png

 

As you can see the below step is almost the same as the previous one, so just to clarify the difference:

Peak hours and Ramp-up:

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)

 

 

2021-10-19 13_42_10-Add a schedule - Microsoft Azure and 10 more pages - Work - Microsoft​ Edge.png

 

  • Start time: 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.
  • Load-balancing algorithm: as you are going to use Autoscaling so the Depth-first load balancing option would be more relevant to your needs as its distributing the new user sessions to the available session host with the highest number of connections but has not reached its maximum session limit threshold which leads to minimizing the number of powered host sessions.
  • Minimum percentage of session hosts: Specify the minimum percentage of session hosts to start for ramp-down and off-peak hours, the percentage is based on the total number of session hosts in your host pool, so if the host pool includes 10 VMs and the percentage is 10% as in the below image, autoscale will ensure a minimum of 1 session host is available to take user connections.
  • Capacity threshold (%): This percentage evaluates whether to turn on/off VMs during the ramp-down and off-peak hours. So if your total host pool capacity is 100 sessions, and you specify a 90% Capacity threshold, once you exceed it, then autoscale will turn on additional session hosts.
  • Delay time before logging out users and shutting down VMs (min): This option will set the session host VMs to drain mode, notify any currently signed-in users to save their work, and wait the configured amount of time before forcing the users to log off. Once all user sessions on the session host VM have been logged off, Autoscale will shut down the VM.
  • Notification message: As shown in the above image you can set your message to be pushed for your end-users to log off.

 

2021-10-19 14_01_08-Add a schedule - Microsoft Azure and 11 more pages - Work - Microsoft​ Edge.png

 

  • Start time (24-hour system): This is the start time for off-peak or non-business hours. This is also the end time for ramp-down.

 

Then Create..

 

2021-10-19 14_03_17-Create a scaling plan - Microsoft Azure and 11 more pages - Work - Microsoft​ Ed.png

 

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. 

MahmoudAAtallah_6-1635081896561.png

 

 

 

 

 

56 Replies

@Seneca_Friend 

Thanks for the update on this, even if this is not the news we hoped or expected!

 

Are you able to elaborate on the UK South capacity issues please, and why exactly this Scaling Plan functionality for the AVD platform is affected by such a capacity issue? Based on the existing scaling script and logic app method that's available to us already (for scaling AVD platforms), I cant image this new Scaling Plan functionality is that resource demanding on a data centre, surely?!?

Hi @RichSaunds,
It is not necessarily that Autoscale is resource demanding, it is that Autoscale is a microservice within AVD which means that the service in addition to the databases need to be deployed to each region for there to be scaling plan support there. Azure is maxed out in the UK South region and has blocked us from deploying there for a while.
Thanks again for the details, not great news indeed!

Slightly off topic, but does that have any impact on customers deploying new resources in UK South then, provisioning new VM's etc...?
Scaling plans are now available in South Central US!
The host pool and the scaling plan need to be in the same region. Scaling plans are now available in any of the following regions:
Canada Central
Canada East
Central US
East US
East US 2
North Central US
North Europe
South Central US
West Central US
West Europe
West US
West US 2
Scaling plans are now available in all of the following regions:
Canada Central
Canada East
Central US
East US
East US 2
North Central US
North Europe
South Central US
West Central US
West Europe
West US
West US 2
Hi,
We're having a problem with the scaling plan feature.

Facts: We test with 2 identical hostpools, the scaling plan prerequisite (RBAC) are set on subscription level. we use the same scaling plan object for both hostpools.

Hostpool1:
w10Multisession Image created with our cloud based imaging service.
- W10Multisession from azure (21H2) Generation1
- FSLogix und VCRedist uninstalled
- Actual windows Updates installed
- Sysprep sysprep.exe /oobe /generalize /shutdown /mode:vm

Hostpool2:
w10Multisession Image manual created in azure.
- W10Multisession from azure (21H2) Generation1
- Sysprep sysprep.exe /oobe /generalize /shutdown /mode:vm

Testing Scenario: All VM's are down / deallocated
Scaling plan for both hostpools disabled

Problem scenario:
-> Enable scaling plan for hostpool 1
-> wait..... -> No host starts up !! -> checking scaling plan log -> Attached scalingplanlog1.json -> all 3 hosts are marked as
ExcludedSessionHostCount !!

Working scenario:
-> Enable scaling plan for hostpool 2
-> wait..... -> after 5 minutes host starts up !! -> checking scaling plan log -> Attached scalingplanlog2.json -> no hosts are marked as "ExcludedSessionHostCount" !!

Does anybody has this effect od knows in which constellations the scaling plan feature is evaluating session hosts as "ExcludedSessionHost" ?

thanks for your help,

Patrick

scalingplanlog1.json

{
"host_Ring": "R0",
"Level": 4,
"ActivityId": "00000000-0000-0000-0000-000000000000",
"time": "2022-05-03T15:20:21.4366865Z",
"resourceId": "/SUBSCRIPTIONS/00000000-0000-0000-0000-000000000000/RESOURCEGROUPS/P-RG-EDU-TEST-01/PROVIDERS/MICROSOFT.DESKTOPVIRTUALIZATION/SCALINGPLANS/P-SCP-EDU-TEST-02",
"operationName": "ScalingEvaluationSummary",
"category": "Autoscale",
"resultType": "Succeeded",
"level": "Informational",
"correlationId": "8ae9e5b8-c6cb-47ce-943a-923b91c154df",
"properties": {
"Message": "0.00% of session hosts are active (0 of 3 session hosts). This is below the minimum hosts percentage of 20% (1 session hosts). Need to turn on 1 session hosts to meet minimum number of hosts.",
"HostPoolArmPath": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/p-rg-edu-test-01/providers/microsoft.desktopvirtualization/hostpools/p-vhp-edu-test-01",
"ScalingEvaluationStartTime": "5/3/2022 3:19:33 PM",
"TotalSessionHostCount": "3",
"ExcludedSessionHostCount": "3",
"ActiveSessionHostCount": "0",
"SessionCount": "0",
"NonActiveSessionCount": "0",
"CurrentSessionOccupancyPercent": "NaN",
"CurrentActiveSessionHostsPercent": "0",
"Config.ScheduleName": "weekdays_schedule",
"Config.SchedulePhase": "Peak",
"Config.MaxSessionLimitPerSessionHost": "1",
"Config.CapacityThresholdPercent": "60",
"Config.MinActiveSessionHostsPercent": "20",
"DesiredToScaleSessionHostCount": "1",
"EligibleToScaleSessionHostCount": "0",
"ScalingReasonType": "StartVMs_BelowMinimumActiveSessionHosts",
"BeganForceLogoffOnSessionHostCount": "0",
"BeganDeallocateVmCount": "0",
"BeganStartVmCount": "0",
"TurnedOffDrainModeCount": "0",
"TurnedOnDrainModeCount": "0"
}
}

scalingplanlog2.json


{
"host_Ring": "R0",
"Level": 4,
"ActivityId": "00000000-0000-0000-0000-000000000000",
"time": "2022-05-03T14:18:41.0012950Z",
"resourceId": "/SUBSCRIPTIONS/00000000-0000-0000-0000-000000000000/RESOURCEGROUPS/P-RG-EDU-TEST-01/PROVIDERS/MICROSOFT.DESKTOPVIRTUALIZATION/SCALINGPLANS/P-SCP-EDU-TEST-02",
"operationName": "ScalingEvaluationSummary",
"category": "Autoscale",
"resultType": "Succeeded",
"level": "Informational",
"correlationId": "24ef99f5-650c-4d44-a6ab-1a309f9a1c76",
"properties": {
"Message": "0.00% of session hosts are active (0 of 3 session hosts). This is below the minimum hosts percentage of 20% (1 session hosts). Need to turn on 1 session hosts to meet minimum number of hosts.",
"HostPoolArmPath": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/p-rg-edu-test-01/providers/microsoft.desktopvirtualization/hostpools/p-vhp-edu-test-01",
"ScalingEvaluationStartTime": "5/3/2022 2:17:52 PM",
"TotalSessionHostCount": "3",
"ExcludedSessionHostCount": "0",
"ActiveSessionHostCount": "0",
"SessionCount": "0",
"NonActiveSessionCount": "0",
"CurrentSessionOccupancyPercent": "NaN",
"CurrentActiveSessionHostsPercent": "0",
"Config.ScheduleName": "weekdays_schedule",
"Config.SchedulePhase": "Peak",
"Config.MaxSessionLimitPerSessionHost": "1",
"Config.CapacityThresholdPercent": "60",
"Config.MinActiveSessionHostsPercent": "20",
"DesiredToScaleSessionHostCount": "1",
"EligibleToScaleSessionHostCount": "1",
"ScalingReasonType": "StartVMs_BelowMinimumActiveSessionHosts",
"BeganForceLogoffOnSessionHostCount": "0",
"BeganDeallocateVmCount": "0",
"BeganStartVmCount": "1",
"TurnedOffDrainModeCount": "0",
"TurnedOnDrainModeCount": "0"
}
}
Hi @Patrick_Kunz, session hosts marked as ExcludedSessionHosts are those that have the exclusion tag applied to them. Do the session hosts in host pool 1 have any tags on them? Does the scaling plan (P-SCP-EDU-TEST-02) have exclusion tags specified?
Hi @Seneca_Friend, Thanks for your answer. The Session Hosts (Hostpool1 & 2) have one Tag: "Owner", but the scaling plan has no tag definied. We left that field empty. Also Drain mode on all Hosts is off. Any further ideas? thanks a lot, patrick

 

While I appreciate Microsoft finally having an integrated scaling solution, it is painfully basic. I am a Microsoft Certified Trainier giving AVD training and conducting workshops and have been struggling selling AVD for a year now. AVD is complex. AVD is just a platform, not a solution.

 

   Now, things starting to change, partners and myself are excited about AVD again since I started training and selling AVD using Nerdio MSP. 

Their scaling allows me to even use Session Hosts with Ephemeral Disks, which are slightly more expensive (like 10$/month more for a D4ds vs a D4s), but do not need a managed disk and have *zero* disk cost while running and zero cost when not running (obviously, since they cannot be stopped/started, but are always created and destroyed) - and have 50% better Disk I/O throughput.

 

   Even for a partner starting with a customer with just 25 AVD-enabled employees, I save so much compute and storage cost, that the 12$/seat license I pay covers 75% of the Nerdio license (compared to a 3-year RI calculation). The remaining 25% are equivalent to an Swiss IT guys average 1h work rate, around 80$.

 

   And their solution is production ready. Now if you compare it with the scaling solution Microsoft is providing, the cost saving is less, but you cannot compare the scaling plan functionality with Nerdios'. It is so much more powerful, light years ahead. Check out the print screen and you will understand what I mean. You will end up with the 3-year RI solution that many customers opted for, because setting up and maintaining Scaling is either lacking functionality (like the new Scaling Plans) or too complex (Azure Automation).

 

   Do a FULL COST calculation and you will see that (at least in a place like Switzerland, where labor is expensive), a solution like Nerdio might be a better fit - and saves you A LOT of headaches. In my case, using Swiss labor rates and comparing how much MORE time you need to maintain AVD WITHOUT a proper tooling like Nerdio MSP, we save 39%, from a TCO perspective.

 

   Best of all, this Friday, May 6th, they roll out a release that allows me to use AADJ with FSLogix (using Blob storage), so bye bye to two DC's and two days of work for cloud native customers (our instruction manual ist over a hundred pages long for this seamless SSO setup with ADFS). If you are not experienced with Azure, you need a week to set this up, if you hire me, I will do it in two days. If you have Nerdio MSP, you have this up and running before lunch time. :smiling_face_with_smiling_eyes:

 

   Reach out to me if you are based in Switzerland and I will demo you the magic.

 

Remo_G_0-1651735860110.png

 

Nerdio MSP Auto-Scaling Print Screen 

 

Hey Remo_G, I am the UK Field CTO for Nerdio, thanks for your kind comments about the product!! I'll be in Switzerland next week for the IGEL Disrupt even showing the Nerdio magic to the rest of the world :)
Hi @Remo_G, Thanks for your answers. At this time of the project, we're looking for a solution with microsoft basic features. Therfore we need help with avd scaling plans :-). In a further step, nerdio could be an option..., patrick

Hello @Seneca_Friend,

Thanks first and foremost -

Read through the comments and undertand the UK South limitations. However, how does one stay notified about this being released in UK South?

Should I just keep coming back to this post to find out?

Thank you.

Hi! Yes I will update this post when scaling plans are available in UK South. In the meantime, we have been asked to compile a list of customers that are blocked by not having UK South scaling plan availability to support our request for capacity in that region. If you or anyone else is blocked on this, please send me a private message with the following information:
• What is the company/organization that you work for?
• Are you currently blocked from using Autoscale due to scaling plans not being available in UK South?
• Can you explain the business impact of not being able to use Autoscale in UK South?
• How many AVD MAU (monthly active users) and MAV (monthly active VMs) does your company have?

Scaling plans are now available in additional regions, including UK South. @Seneca_Friend 

 

chiners_68_0-1662103198181.png

 

How can I monitor?, and see logs of the escalation plan, I can not find a table in Log analytics for it, being that I am redirecting the diagnoses.

@MiguelOmar Currently, you can either send diagnostic logs for autoscale to an Azure Storage account or consume logs with Microsoft Azure Event Hubs. 

Set up diagnostics for autoscale in Azure Virtual Desktop | Microsoft Learn