The course is part of this learning path
In this course, you will learn about host pools and session hosts in Azure Virtual Desktop.
- Deploy and configure host pools and session hosts
- Set up autoscaling for Azure Virtual Desktop
- Understand Azure Virtual Desktop limits
- Set high availability options for Azure Virtual Desktop
- Use Azure Virtual Desktop session host join options
- Automate Azure Virtual Desktop
This course is for anyone planning to take the Azure Virtual Desktop Specialty exam and anyone interested in learning how to deploy an AVD environment.
To get the most out of this course, you should have an administrator-level understanding of Azure Virtual Machines, Azure high availability solutions, Windows management join options, ARM templates, PowerShell, and the Azure CLI.
The next item in the blade is the scaling plans. This relates to the autoscale feature which will allow your pooled host pools to dynamically power on or off your session host which helps to control costs all based on user demand. This feature is currently in preview, however, we don't need the validation environment setting to use it. But we will have to create a custom role to grant the AVD service permissions to control our virtual machines. To begin, we're going to have to go to your Azure subscription. Then on the left near the top, go to access control, click the 'Add' button here at the top, and then click 'Add custom role'. Click over to the JSON tab, and then click the 'Edit' button here at the top.
You're going to want to erase all of the code in the box and then open this link. Scroll down until you find this block of JSON code and click the 'Copy' button, then go back to the Azure portal. Paste in the code in the box and click the 'Save' button at the top. Now go back to the Assignable scopes tab, and you'll see here a placeholder that you need to delete. Now click the 'Assignable Scopes' button. If it's not already on the left, select the subscriptions, and then on the right, select the particular subscription where your host pool is located. Then click the 'Select' button at the bottom. Click the 'Review and Create' button and you can review all of the permissions that will be granted to the virtual desktop service, and then click the 'Create' button at the bottom and you should see this message that you've successfully created a custom role, and that role is called Azure Virtual Desktop Autoscale.
Now it may take a few minutes to display this role everywhere, so be patient. Click the 'Okay' button, back in the host pool, click the 'Access Control' in the top of the blade on the left, then click the 'Add' button at the top, and click 'Add role assignment'. In the filter, type the word autoscale, and then select Azure Virtual Desktop Autoscale, which is a custom role, then click 'Next'. Click in the middle here to select members. Over on the right, search for Windows Virtual Desktop and click on the first item that only says Windows Virtual Desktop. Then click the 'Select' button at the bottom. Now click 'Review and Assign'. When I look at the role assignment section, I can see the Azure Virtual Desktop Autoscale role has been assigned to the Windows Virtual Desktop service scoped at the host pools resource. Back on the left, click on your 'Scaling plans'. Now in order to add a scaling plan to this host pool, first we need to create one.
In the search bar here at the top, type scaling plan, then click on the first item. Click the 'Create' button at the top, select this subscription and the same resource group where your host pool is located, and give your scaling plan a name that matches your naming convention. For me, this will be FirstPool-ScalingPlan. The location must be the same region where the host pool is deployed, and you can optionally give your scaling plan a friendly name and a description. At the bottom, select your time zone and then click 'Next'. I'd like to add a new schedule and many of the settings here are filled out to help guide you along the way. This first schedule's name is weekdays_schedule, and it has Monday through Friday selected. Be aware though at this time each day can only be associated with a single schedule.
Click 'Next'. In the ramp up section, we dictate how the host pool will function during those morning log on storms, and you can specify the start time such as 8:00 AM. The load balancing algorithm here is set for breadth first, which will allow the greatest number of users to log on to the most number of session hosts at the same time, which should leave nobody waiting. The minimum percentage of hosts is set for 20%, which means that 20% of the total hosts in the pool will be powered on at 8:00 AM. And our capacity threshold has to do with the number of the users logged on relative to the max session limit. Now we set our max session limit for 20, and the capacity threshold of 60% means when 12 users have logged onto a VM, autoscale will power on the next VM. Click 'Next'.
In the peak hours tab, we're now past the morning log on storm, and so we've set our time here for 9:00 AM. And we've switched the load balancing algorithm to depth first, and this means we now want to stack as many users as possible onto each VM before more users log on to the next available VM. This will help you get the most usage out of each session host VM in the pool, and as your users log off sessions, eventually the VMs will have no users on them and be able to be powered off to reduce cost. In the ramp down section, we're beginning this at 6:00 PM. So, this is the end of our day. We've still got depth first load balancing set and we want to get as many VMs turned off as soon as possible.
The minimum percentage of hosts that will remain online is 10% and the capacity threshold is 90%, and we have the option to force users to log off. I generally don't recommend this because you don't want to interrupt a user during a session if you don't have to. You can additionally delay the time before those users are forced off and you can display for them a console notification telling them to save their work and log off before the time limit, so that they don't lose anything that they're doing. Click 'Next'. Finally, the off-peak hour section begins at 8 PM. We're still using depth first and we have a capacity threshold of 90%, so we won't spin up a new VM unless 18 out of 20 users are logged onto a machine, and 20 was, again, our max session limit that we chose.
Click 'Add' at the bottom and click 'Next' for your host pool assignment. Since the scaling plan and the host pool must be in the same region, when you click the drop-down, you'll only see the pools that are in the same region as your scaling plan. Check the box for your host pool and then click 'Next'. Add your standard tags just like we did before. This way, all of your resources will all be related to each other. Click 'Next' and you can review all of your settings, and if everything looks correct, then click 'Create'. Back in your host pool, we now see that the scaling plan has been associated with your pool, which means that the autoscale feature is now enabled.
Dean Cefola is a Principal Azure Engineer at Microsoft and has worked in the IT industry for over 20 years. Dean has been supporting Azure Virtual Desktop from the beginning and is the Microsoft FastTrack Global Leader for AVD.