Professor Dr. Kazemi

CPO550 Lab 05

Implement and monitor autoscaling of session hosts — Interactive Lab Manual · Fall 2026

Task 1: Assign the required RBAC role to an Azure Virtual Desktop service principal 10 pts

Note: for autoscale plans to work, you need to grant the Azure Virtual Desktop service principal the permissions to manage the power state of the session host VMs. These permissions can be granted by using the built-in Desktop Virtualization Power On Off Contributor RBAC role. The role assignment must be performed at the subscription scope.

  1. $subId = (Get-AzSubscription).Id
  2. $parameters = @{ RoleDefinitionName = "Desktop Virtualization Power On Off Contributor" ApplicationId = "9cdead84-a844-4324-93f2-b2e6bb768d07" Scope = "/subscriptions/$subId" }
  3. New-AzRoleAssignment @parameters

Task 2: Stop and deallocate all session hosts 10 pts

Note: to evaluate the autoscaling functionality, you will stop and deallocate all of the session hosts in the Azure Virtual Desktop environment.

  1. Note: you might need to select the ellipsis (...) icon in the toolbar to display the Stop button.

    Note: do not wait until the session hosts are stopped and deallocated but instead proceed to the next task. Stopping and deallocating session hosts might take about 2 minutes.

Task 3: Adjust the host pool settings 15 pts

  1. Note: when using autoscale for pooled host pools, you must have a configured MaxSessionLimit parameter for that host pool. In this lab, you will set it artificially low in order to facilitate illustrating the autoscaling functionality.

Task 4: Create a scaling plan 15 pts

  1. SettingValue
    Subscriptionthe name of the Azure subscription you are using in this lab
    Resource groupthe name of a new resource group <sName>-cpoF67-412-RG
    Scaling plan name<sName>-ScalingPlan
    Regionthe name of the Azure region where you deployed the Azure Virtual Desktop environment
    Friendly name<sName>-ScalingPlan
    Time zonethe local time zone of the Azure region where you deployed the Azure Virtual Desktop environment (UTC-05:00) Eastern Time (US & Canada)
    Host pool typePooled
    Scaling methodPower management autoscaling

    Note: leave the Exclusion tag property not set. In general, you can use this feature to exclude Azure VMs with arbitrarily set tags from autoscaling.

  2. Note: schedules allow you to define ramp-up hours, peak hours, ramp-down hours, and off-peak hours for week days and specify autoscaling triggers. A scaling plan must include an associated schedule for at least one day of the week.

  3. SettingValue
    Time zonethe local time zone of your Azure Virtual Desktop environment
    Schedule name<sName>-week_schedule
    Repeat on7 selected (select all days of the week)

    Note: the schedule effectively covers every day of the week, which will facilitate evaluating the outcome of autoscaling.

  4. SettingValue
    Start time (12 hour system)your current time minus 1 hour
    Load balancing algorithmBreadth-first
    Minimum percentage of hosts (%)30
    Capacity threshold (%)60

    Note: for pooled host pools, autoscale ignores existing load-balancing algorithms in your host pool settings and instead applies load balancing based on your schedule configuration.

    Note: the Minimum percentage of hosts setting designates the minimum percentage of session host virtual machines to start for ramp-up and peak hours. For example, if Minimum percentage of hosts is 30% and the total number of session hosts in your host pool is 3, autoscale will ensure a minimum of 1 session host is available. Autoscale rounds up to the nearest whole number.

    Note: the Capacity threshold setting is the percentage of used host pool capacity that will be considered to evaluate whether to turn on/off virtual machines during the ramp-up and peak hours. For example, if capacity threshold is 60% and your host pool capacity is 1 session (with one host running), autoscale will turn on additional session hosts once the load of the host pool exceeds 60% (it's 100% in this case).

  5. SettingValue
    Start time (12 hour system)your current time plus 1 hour
    Load balancing algorithmDepth-first
    Capacity threshold (%)60

    Note: the Capacity threshold (%) setting is shared between the Ramp-up and Peak hours settings.

  6. SettingValue
    Start time (12 hour system)your current time plus 2 hours
    Load balancing algorithmDepth-first
    Minimum percentage of active hosts (%)10
    Capacity threshold (%)80
    Force sign out usersNo
    Stop VMs whenVMs have no active or disconnected sessions

    Note: the Minimum percentage of active hosts (%) setting designates the minimum percentage of session host virtual machines that you would like to get to for ramp-down and off-peak hours. For example, if Minimum percentage of active hosts (%) is set to 10% and the total number of session hosts in your host pool is 3, autoscale will ensure a minimum of 1 session host is available to take user connections.

    Note: the Capacity threshold (%) setting designates the percentage of used host pool capacity that will be considered to evaluate whether to turn off virtual machines during the ramp-down and off-peak hours. For example, with 1 user connection and 3 hosts running, if capacity threshold is specified as 80%, autoscale would turn off 1 host (resulting in 50% used host pool capacity).

    Note: in general, autoscale will stop and deallocate session hosts according to the following rules: the used host pool capacity is below the capacity threshold; turning off session hosts will not result in exceeding the capacity threshold; autoscale only turns off session hosts with no user sessions on them (unless the scaling plan is in ramp-down phase and you've enabled the setting to force user logoff); pooled autoscale will not turn off session hosts in the ramp-up phase to ensure that user experience is not impacted.

  7. SettingValue
    Start time (12 hour system)your current time plus 3 hours
    Load balancing algorithmDepth-first
    Capacity threshold (%)80

    Note: the Capacity threshold setting is shared between the Ramp-down and Off-peak hours settings.

  8. Note: wait for the autoscale configuration to complete. This typically takes just a few seconds.

    Screenshot must show your Odl_user account, the <sName>-ScalingPlan scaling plan with its <sName>-week_schedule schedule and the <sName>-cpoF67-hp1 host pool assignment with autoscale enabled

Task 5: Evaluate the autoscaling functionality 15 pts

Note: you will start by evaluating the Ramp-up settings.

  1. Note: you might need to wait a couple of minutes before the first session host reaches the Running state.

    Note: this is expected, since according to the Ramp-up settings of the newly created scaling plan, at least one session host should be always online. At this point, the host pool capacity is 1 (since there is only 1 host running), but the used host pool capacity is 0%, since there are no user connections.

    Screenshot must show your Odl_user account, the <sName>-cpoF67-hp1 Session hosts page with one session host in the Running state and the other session hosts stopped (deallocated)
  2. Note: next, you will evaluate the Ramp-up and Peak hours capacity threshold setting by launching a single user session. We can evaluate this even outside of the Peak hours window, since the two stages share the same capacity threshold.

  3. Note: at this point, the used host pool capacity is 100%, which is greater than the capacity threshold (60%). This should result in autoscaling turning on another host, which will bring the used host pool capacity to 50%. Since this is below the capacity threshold, the third host will remain stopped/deallocated. You will verify this next.

  4. Screenshot must show your Odl_user account, the <sName>-cpoF67-hp1 Session hosts page with two session hosts in the Running state
  5. Note: see the samples at the end of the instruction for more clarity on what you need to include in your screenshots.

    Screenshot must show your Odl_user account, the User1 SessionDesktop session with the Command Prompt window displaying the whoami /upn output for cpoF67-User1-<sName>
  6. Screenshot must show your Odl_user account, the <sName>-cpoF67-hp1 Session hosts page with all three session hosts in the Running state
  7. Note: next, you will evaluate the Ramp-down capacity threshold setting by adjusting its time window.

  8. Note: you might need to adjust the value of Start time (12 hour system) of the Peak hours phase.

  9. logoff
  10. Note: it may take 1-2 minutes before the session host is shut down.

    Screenshot must show your Odl_user account, the <sName>-cpoF67-hp1 Session hosts page with only one session host in the Running state after the Ramp-down evaluation

Task 6: Disable host pool autoscaling 15 pts

Note: to ensure that the autoscaling configuration will not affect other labs, you will remove the host pool assignment of the scaling plan you implemented in this lab.

Task 7: Summary Questions 20 pts

Minimum 2-3 sentences each — original thinking, your own words!

Your submission preview

Screenshots you attach above and your Task 7 answers appear here. This is exactly what prints/exports as your PDF.

Submit compile & export