Azure Virtual Desktop (formerly known as Windows Virtual Desktop or WVD) offers a scalable and flexible platform for virtualizing our desktops and applications in the cloud. Its major benefit lies in the ability to automate and streamline many of the associated management tasks, something we can largely achieve through automation.
Automation Components for Azure Virtual Desktop
You can use the Azure portal, Windows PowerShell, REST APIs, and Azure Resource Manager templates to automate your Azure Virtual Desktop management tasks. Let’s detail this further:
- Azure portal: Enables administrators to carry out individual Azure Virtual Desktop tasks manually.
- Windows PowerShell: Provides the ability to automate tasks by running commands. You can either input these directly at the command line interface or pipe them in a script.
- REST APIs: Provide a programming interface that you can use to automate tasks via HTTP requests.
- Azure Resource Manager templates: Uses JSON to define the resources needed for your applications. These templates can automate deployment and use declarative syntax to state what you intend to deploy without having to write the sequence of programming commands to create it.
Azure Virtual Desktop automation via Azure Resource Manager Templates
Azure Resource Manager Templates provide a method for defining the deployments of our cloud resources.
To create a template, we should construct a JSON file that outlines the resources we wish to deploy to Azure. Once this is done, we can deploy the template using either the Azure portal, CLI, PowerShell, or even directly from our source control repository.
Here’s a basic example of an Azure Resource Manager template for deploying a new Azure Virtual Desktop:
{
“$schema”: “https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#”,
“contentVersion”: “1.0.0.0”,
“resources”: [
{
“type”: “Microsoft.DesktopVirtualization/hostPools”,
“apiVersion”: “2019-12-10-preview”,
“name”: “[parameters(‘hostPoolName’)]”,
“location”: “[parameters(‘location’)]”,
“properties”: {
“description”: “[parameters(‘description’)]”,
“friendlyName”: “[parameters(‘friendlyName’)]”,
“hostPoolType”: “[parameters(‘hostPoolType’)]”,
“maxSessionLimit”: “[parameters(‘maxSessionLimit’)]”
}
}
]
}
This code above is a simple example of an ARM template in JSON format, which will deploy a new host pool for Azure Virtual Desktop.
Azure Virtual Desktop automation via PowerShell/CLI
PowerShell and the Azure CLI are powerful tools for Azure administrators. We can use these tools to script complex or repetitive tasks and run them locally or in the cloud.
Here is an example of a PowerShell script which deploys a new host pool for Azure Virtual Desktop:
param (
[Parameter(Mandatory=$true)]
[String] $resourceGroupName,
[Parameter(Mandatory=$true)]
[String] $hostPoolName,
[Parameter(Mandatory=$true)]
[String] $location
)
New-AzResource -ResourceGroupName $resourceGroupName -Location $location `
-ResourceName $hostPoolName -ResourceType ‘Microsoft.DesktopVirtualization/hostPools’ -ApiVersion ‘2019-01-23-preview’ -Properties @{‘hostPoolType’ = ‘Pooled’; ‘description’ = ‘Host Pool Description’}
This code is a simple example of a PowerShell script that deploys a new host pool in Azure Virtual Desktop.
Preparing For AZ-140 Configuring and Operating Microsoft Azure Virtual Desktop Exam
Implementing the automation of Azure Virtual Desktop is a key topic of the AZ-140 Configuring and Operating Microsoft Azure Virtual Desktop exam. The exam also focuses on other important aspects of Azure Virtual Desktop such as deployment, management, security and compliance, and user experience among others.
Knowing and understanding the depth of automation for Azure Virtual Desktop, including Azure Resource Manager templates and PowerShell, will greatly aid in preparing for the exam. Reviewing and practicing with Microsoft’s official documentation, guidelines, and sample codes alongside hands-on experiments will ensure a comprehensive overview and command of the subject.
Practice Test
True/False: Azure Virtual Desktop is a desktop and app virtualization service that runs in the cloud.
- True
- False
Answer: True
Explanation: Azure Virtual Desktop indeed is a desktop and application virtualization service that runs on the cloud.
Multiple-select: Which of the following are features of Azure Virtual Desktop?
- a) Remote access
- b) Persistence
- c) No network connectivity
- d) Multi-session Windows 10 experience
Answer: a, b, d
Explanation: Azure Virtual Desktop provides features like remote access, persistence, and multi-session Windows 10 experience. Network connectivity is a requirement, not a feature.
True/False: Azure Virtual Desktop can’t be automated using PowerShell.
- True
- False
Answer: False
Explanation: Azure Virtual Desktop offers a full set of PowerShell cmdlets that allows you to automate your tasks.
Single-select: Which configuration isn’t possible in Azure Virtual Desktop?
- a) Disable session persistence
- b) Managing host pools
- c) Configuring FSLogix profile containers
- d) Unlimited user licenses
Answer: d
Explanation: Azure Virtual Desktop licensing depends on your Microsoft 365 or Windows licenses; there’s no option for unlimited user licenses.
True/False: Azure Virtual Desktop requires Azure Active Directory for authentication.
- True
- False
Answer: True
Explanation: Azure AD is the identity provider for Azure Virtual Desktop, meaning authentication happens through Azure AD.
Multiple-select: What are the components required to configure Azure Virtual Desktop?
- a) Tenant
- b) Host pool
- c) Application group
- d) Guest operating system
Answer: a, b, c
Explanation: Tenant, host pool, application group are components required to configure Azure Virtual Desktop. The guest operating system is not a component of the configuration.
True/False: It’s possible to monitor and diagnose Azure Virtual Desktop environments with Azure Monitor.
- True
- False
Answer: True
Explanation: Azure Monitor and Log Analytics provide rich operational insights and advanced monitoring for Azure Virtual Desktop.
Single-select: What is the primary purpose of using FSLogix in Azure Virtual Desktop?
- a) Improve security
- b) Reduce costs
- c) Enhance user experience
- d) Increase storage
Answer: c
Explanation: FSLogix is a set of solutions that improve the user experience primarily in Azure Virtual Desktop and Remote Desktop Services environments.
True/False: You need to configure session host load balancing in Azure Virtual Desktop.
- True
- False
Answer: True
Explanation: Azure Virtual Desktop allows you to load balance your session hosts to achieve maximum efficiency and user productivity.
Multiple-select: What roles can be assigned to users in Azure Virtual Desktop?
- a) Tenant creator
- b) RDS owner
- c) RDS contributor
- d) RDS reader
Answer: a, b, c, d
Explanation: Azure Virtual Desktop provides these four roles – tenant creator, RDS owner, RDS contributor, and RDS reader – which can be assigned to users.
True/False: You can use Azure role-based access control (Azure RBAC) to manage access to your Azure Virtual Desktop environment.
- True
- False
Answer: True
Explanation: Azure RBAC plays a crucial role in managing access to your Azure Virtual Desktop at various scopes.
True/False: Azure Virtual Desktop environments can’t provide Windows 7 virtual desktop with free extended security updates.
- True
- False
Answer: False
Explanation: Azure Virtual Desktop is the only service that offers Windows 7 virtual desktop with free extended security updates.
Single-select: Which licensing model is not supported by Azure Virtual Desktop?
- a) Microsoft 365 E3/E5
- b) Windows 10 Enterprise E3/E5
- c) Windows 10 VDA per user
- d) Microsoft Office 2010
Answer: d
Explanation: Microsoft Office 2010 is a product and not a licensing model supported by Azure Virtual Desktop. The other three are licensing models supported by Azure Virtual Desktop.
Multiple-select: What are the types of host pools available on Azure Virtual Desktop?
- a) Personal
- b) Pooled
- c) Shared
- d) Isolated
Answer: a, b
Explanation: Azure Virtual Desktop provides two types of host pools – personal and pooled.
True/False: Azure Virtual Desktop supports both persistent and non-persistent virtual desktops.
- True
- False
Answer: True
Explanation: Azure Virtual Desktop does support both persistent (stateful) and non-persistent (stateless) virtual desktop configurations. This provides flexibility based on the requirements of the specific implementation.
Interview Questions
What is Azure Virtual Desktop?
Azure Virtual Desktop is a Microsoft service that virtualizes Windows operating systems, applications, and desktops, and delivers them to users on any device.
How can you automate tasks in Azure Virtual Desktop?
Automation tasks in Azure Virtual Desktop can be achieved by using Azure Resource Manager templates, PowerShell scripts, or REST APIs
What is Azure Resource Manager template?
Azure Resource Manager template is a JSON file that describes the resources and properties needed to create an Azure Virtual Desktop deployment.
What is the role of PowerShell in automating Azure Virtual Desktop?
PowerShell can be used to automate tasks such as creating host pools, assigning users, and deploying virtual machines in Azure Virtual Desktop.
What is an important part to automate in Azure Virtual Desktop?
An important part to automate in Azure Virtual Desktop is session host management, which handles the creation, deletion, starting, and stopping of session hosts.
What is the commands to create a new host pool with PowerShell in Azure Virtual Desktop?
The command to create a new host pool with PowerShell is New-AzWvdHostPool.
Can REST APIs be used for automation in Azure Virtual Desktop?
Yes, REST APIs can be used for automation in Azure Virtual Desktop businesses to implement custom solutions for managing their Azure Virtual Desktop environments.
How can you automate session host management in Azure Virtual Desktop?
Session host management in Azure Virtual Desktop can be automated using Azure Automation Account in combination with PowerShell scripts or Azure Logic Apps.
How to schedule automated start and stop times for VMs in Azure Virtual Desktop?
Automated start and stop times for VMs in Azure Virtual Desktop can be scheduled using Azure Automation services.
What is Azure Logic Apps and how does it aid in automating Azure Virtual Desktop?
Azure Logic Apps is a cloud service that helps in designing and running workflows that integrate and automate various services. It aids in automating Azure Virtual Desktop by simplifying complex operations and creating workflows.
What is the fundamental step to automate session host draining in Azure Virtual Desktop?
The fundamental step to automate session host draining in Azure Virtual Desktop is creating an Azure function that lists all running session hosts in the host pool and shuts down user sessions on a schedule.
Which automation service can be used to monitor Azure Virtual Desktop for alerts and potential issues?
Azure Monitor and Azure Log Analytics can be used to monitor Azure Virtual Desktop for alerts and potential issues.
What commands are used to add or remove users from an application group in Azure Virtual Desktop via PowerShell?
The commands used to add or remove users from an application group in Azure Virtual Desktop via PowerShell are Add-AzWvdUser and Remove-AzWvdUser respectively.
How can deployment of applications in Azure Virtual Desktop be automated?
Deployment of applications in Azure Virtual Desktop can be automated using Desired State Configuration (DSC), a PowerShell feature, or Azure DevOps pipelines.
Can Azure Functions be used to automate tasks in Azure Virtual Desktop?
Yes, Azure Functions, a serverless solution, can be used to run small pieces of code (“functions”) in the cloud. It can be used to automate routine tasks in Azure Virtual Desktop.