AZ-140 Labs
Click here for details(Microsoft ESI labs)
Lab #1
Azure Virtual Desktop Deployment Lab:
Objective: Deploy an Azure Virtual Desktop (AVD) environment with Microsoft Entra joined session hosts.
Lab Requirements:
Azure subscription with an Entra ID user account having Owner role and device join permissions.
Key Exercises:
- Prepare Azure Subscription:
Register Microsoft.DesktopVirtualization resource provider.
Create a virtual network (az140-vnet11e) and subnet (hp1-Subnet).
Identify user groups (AVD-DAG, AVD-RemoteApp) in Entra ID.
- Deploy AVD Host Pool:
Create a host pool (az140-21-hp1) with pooled session hosts.
Deploy two Windows 11 multi-session VMs in az140-vnet11e.
Enable Entra ID join and configure network settings.
- Create Application Groups:
Assign AVD-DAG group to a desktop app group.
Create a RemoteApp group (az140-21-hp1-Office365-RAG) with Microsoft Word, Excel, and PowerPoint.
Create a second RemoteApp group (az140-21-hp1-Utilities-RAG) for Command Prompt.
- Create an AVD Workspace:
- Register application groups with the workspace (az140-21-ws1).
- Grant Access:
Assign Virtual Machine User Login role to AVD-RemoteApp group for session hosts.
Assign Virtual Machine Administrator Login role for administrative access.
Outcome: Successfully deploy and configure an Entra ID-joined AVD environment with host pools, application groups, and user access controls.
Lab #2
This lab covers managing Azure Virtual Desktop (AVD) host pools and session hosts using the Azure portal with Microsoft Entra ID. The goal is to configure a set of session hosts to meet business requirements, including load balancing, cost reduction, maintenance scheduling, and user experience optimization.
Lab Details:
• Estimated Time: 30 minutes
• Prerequisites:
• An Azure subscription.
• A Microsoft Entra user account with Owner or Contributor role.
• Completion of the Deploy host pools and session hosts by using the Azure portal (Entra ID) lab.
• Dependencies: You must have access to the Azure portal and appropriate permissions to manage AVD resources.
Lab Tasks:
1. Deploy Additional Session Hosts:
• Deploy new session hosts to accommodate more users, including specifying virtual machine settings such as size, OS disk type, and image. You will use the same image (Windows 11 Enterprise multi-session with Microsoft 365 Apps) as the existing session hosts to maintain consistency. You can configure a new image if necessary, but it’s recommended to stick with the same one unless you’re replacing all the VMs in the host pool.
• While provisioning new session hosts, note that the Name prefix and virtual machine location settings must be configured appropriately.
2. Review and Configure Host Pool Properties:
• After deploying the session hosts, you’ll review host pool properties like the preferred app group type, Start VM on Connect (to minimize costs by starting VMs only when users need them), and the load balancing algorithm. You’ll choose Depth-first load balancing and set the Max session limit to 8.
• You will configure Start VM on Connect, which reduces costs by powering on VMs only when needed, and ensure it’s saved correctly.
3. Assign RBAC Role:
• Use PowerShell in Azure Cloud Shell to assign the Desktop Virtualization Power On Contributor role to the AVD service principal. This is necessary to enable the Start VM on Connect functionality for users.
4. Configure Scheduled Agent Updates:
• Set up maintenance windows to schedule updates for the AVD agent, side-by-side stack, and Geneva Monitoring agent outside business hours. You will configure the updates to occur on Saturdays at 11:00 PM to ensure minimal disruption.
5. Configure RDP Properties:
• Enable Microsoft Entra Single Sign-On to allow users to log in seamlessly without needing to reauthenticate. This involves configuring RDP properties and adjusting settings like reconnection attempts, bandwidth auto-detection, device redirection, and display preferences.
• Additional settings reviewed include enabling automatic reconnection for disconnected sessions and ensuring that video playback, compression, and multi-display settings are optimized for user experience.
Objectives:
By the end of this lab, participants will be proficient in:
• Managing AVD session hosts with Microsoft Entra ID.
• Configuring host pool settings, including load balancing and VM start behavior.
• Assigning required permissions via RBAC.
• Scheduling agent updates to minimize downtime.
• Configuring RDP settings to optimize session experience, including single sign-on for users.
This hands-on lab helps reinforce practical skills needed to maintain and optimize an AVD environment effectively.
Lab #3
Lab Summary: Implement Monitoring using Azure Virtual Desktop Insights
Estimated Time: 25 minutes
Lab Scenario: You have an existing Azure Virtual Desktop (AVD) environment and need to monitor its status and activities.
Objectives: Learn how to implement monitoring of an AVD environment using Azure Virtual Desktop Insights.
Prerequisites:
• Azure subscription.
• Microsoft Entra user account with Owner or Contributor role.
• Completion of the labs: “Deploy host pools and session hosts by using the Azure portal (Entra ID)” and “Manage host pools and session hosts by using the Azure portal (Entra ID)”.
Lab Tasks:
1. Register Subscription with Microsoft.Insights Resource Provider:
• Register the Microsoft.Insights resource provider within the Azure portal to enable Azure Virtual Desktop Insights.
2. Create an Azure Log Analytics Workspace:
• Create a Log Analytics workspace in the Azure portal where diagnostic data from AVD will be collected.
• Ensure data collection is enabled for diagnostics, performance counters, and event logs from session hosts.
3. Set up Virtual Desktop Insights Configuration Workbook:
• Access the Insights workbook from the AVD page in the portal.
• Resolve warning messages by linking the configuration workbook to the Log Analytics workspace.
• Enable diagnostics for the AVD environment, including management activities, connections, and agent health.
• Create and associate a data collection rule (DCR) to capture session host data.
4. Deploy Azure Monitor Extension:
• Install the Azure Monitor extension on session hosts in the host pool to enable data collection.
5. Review Collected Data:
• Verify that no warnings or errors appear on the diagnostics page.
• Review collected data such as performance counters, events, and billed data over the last 24 hours.
• Access the Insights page to view telemetry related to user connections, session performance, and resource utilization.
By the end of this lab, you will be able to set up monitoring for your Azure Virtual Desktop environment and utilize Azure Virtual Desktop Insights to track performance, utilization, and diagnostic data.
Lab #4
Connect to Entra ID-Joined AVD Session Hosts
Goal: Validate AVD session hosts by connecting from a non-Entra-joined Windows 11 client using the Remote Desktop client (MSI) and Windows app.
Prerequisites:
• Azure subscription with required permissions.
• Prior labs on deploying and managing session hosts completed.
Steps:
1. Modify RDP Properties in the Azure portal:
• Add targetisaadjoined:i:1.
• Remove enablerdsaadauth:i:value (if present).
2. Install Remote Desktop Client & Windows App:
• Download and install the MSI client.
• Open the Windows Remote Desktop app (from the Store).
3. Subscribe & Connect:
• Sign in and subscribe to the AVD workspace.
• Adjust display settings.
• Verify session host access and admin rights.
• Test RemoteApps (Command Prompt, Office apps).
Ensures Entra ID-joined AVD session hosts work with both the MSI client and Windows app.
Lab #5
Implement and Monitor Autoscaling of Session Hosts in Azure Virtual Desktop
Lab Overview
This lab focuses on configuring and evaluating autoscaling for Azure Virtual Desktop (AVD) session hosts to optimize resource usage and reduce costs. You will implement an autoscale scaling plan, adjust settings, and observe how session hosts automatically start and stop based on demand.
Prerequisites
• An Azure subscription.
• A Microsoft Entra user account with Owner or Contributor role.
• Completion of the following labs:
• Deploy host pools and session hosts using the Azure portal.
• Manage host pools and session hosts.
• Connect to session hosts.
Estimated Time: 45 minutes
Lab Scenario
Your AVD environment experiences fluctuating usage. To optimize costs, you will implement autoscaling using scaling plans, ensuring session hosts dynamically adjust to user demand.
Lab Objectives
By the end of this lab, you will be able to:
• Implement Azure Virtual Desktop autoscaling.
• Evaluate how session hosts scale up or down based on configured schedules.
Exercise 1: Implement Azure Virtual Desktop Autoscale Scaling Plans
Task 1: Assign RBAC Role to AVD Service Principal
• Why? The AVD service principal needs permissions to control VM power states.
• Role: Assign Desktop Virtualization Power On Off Contributor at subscription level.
• Process:
1. Open Azure Cloud Shell.
2. Retrieve subscription ID:
$subId = (Get-AzSubscription).Id
3. Create and apply the RBAC role assignment:
$parameters = @{ RoleDefinitionName = "Desktop Virtualization Power On Off Contributor" ApplicationId = "9cdead84-a844-4324-93f2-b2e6bb768d07" Scope = "/subscriptions/$subId" } New-AzRoleAssignment @parameters
ask 2: Stop and Deallocate All Session Hosts
• Why? To observe autoscale functionality, all hosts must be stopped.
• Process:
1. Navigate to Azure Virtual Desktop > Host Pools.
2. Select az140-21-hp1.
3. Go to Session Hosts and stop all hosts.
Task 3: Adjust Host Pool Settings
• Why? Autoscale for pooled host pools requires MaxSessionLimit.
• Process:
1. Go to Host Pool az140-21-hp1 > Properties.
2. Set Max session limit to 1.
3. Save changes.
Task 4: Create a Scaling Plan
1. Navigate to Azure Virtual Desktop > Scaling Plans > +Create.
2. Basic Settings:
• Subscription: Your Azure subscription.
• Resource Group: az140-412e-RG
• Scaling Plan Name: az140-scalingplan412e
• Region: Your AVD region
• Host Pool Type: Pooled
• Scaling Method: Power Management Autoscaling
3. Schedule Configuration (For daily scaling):
• Name: week_schedule
• Days: All 7 days
• Ramp-up Phase:
• Start Time: Current time - 1 hour.
• Min Hosts: 30% (ensures at least 1 host is running).
• Capacity Threshold: 60%.
• Peak Hours:
• Start Time: Current time + 1 hour.
• Capacity Threshold: 60%.
• Ramp-down Phase:
• Start Time: Current time + 2 hours.
• Min Active Hosts: 10%.
• Capacity Threshold: 80%.
• Off-Peak Phase:
• Start Time: Current time + 3 hours.
• Capacity Threshold: 80%.
4. Host Pool Assignment:
• Assign the plan to az140-21-hp1.
• Enable autoscale.
• Create the scaling plan.
Task 5: Evaluate Autoscaling
Ramp-up Verification
1. Check session hosts in Azure Virtual Desktop > Host Pools > Session Hosts.
2. Confirm that at least 1 host is running.
Load Testing
1. Open Microsoft Remote Desktop Client.
2. Subscribe and sign in with User2 credentials.
3. Open Command Prompt in the remote session.
4. Check the Power State of session hosts in Azure Portal.
5. Expected Outcome: Autoscale starts another host when usage exceeds 60%.
Ramp-down Verification
1. Adjust Ramp-down start time to match the current time.
2. Sign out of the session.
3. Check Power State of session hosts.
4. Expected Outcome: One host remains running, others are deallocated.
Final Steps: Disable Autoscaling
• Navigate to Azure Virtual Desktop > Scaling Plans.
• Select az140-scalingplan412e.
• Disable Autoscaling for az140-21-hp1.
Conclusion
This lab demonstrated how to configure, monitor, and evaluate autoscaling in Azure Virtual Desktop. By implementing autoscale plans, session hosts dynamically adjust to user demand, optimizing cost and performance.