Hi everyone, after a month dedicated full time to work and to the preparation of the renewals of my certifications, I’m back with the first post in a series of articles where I’ll try to explain how to implement Azure Virtual Desktop. This first article will show you how to create an Azure virtual desktop Host pool using PowerShell and Azure CLI.

The idea of this article is to create a host pool group with the essential characteristics and then, in the following posts, gradually include the different resources of the Azure virtual desktop services that interact with it. Therefore, in the creation of the host pool, I will only work with the following parameters:

  • HoostPoolType: <Pooled|Personal>
  • LoadBalancerType: <BreadthFirst|DepthFirst|Persistent>
  • PreferredAppGroupType: <Desktop|RailApplications>
  • StartVMOnConnect: <True|False>
  • ValidationEnvironment: <True|False>
  • MaxSessionLimit

Azure PowerShell Workaround

First, you need to ensure the Az.DesktopVirtualization module is installed on your computer and imported into your Powershell session. To do that, you should use the following commands.

Once you’ve imported the module, you’re ready to go. The easiest way to get started is to log in interactively at the command line.

This cmdlet will bring up a dialog box prompting you for your email address and password associated with your Azure account.
You can choose the default subscription if you have more than one associated with your mail account. To perform this task, we will use the following commands:

Once you set your default subscription, you’re ready to start.

Set the variables

Here, we define the characteristics of our environment and the resource’s properties.

Create a new host pool

To create a host pool, you should use the New-AzWvdHostPool cmdlet with the following syntax.

Update a host pool

Once the resource is created, you can modify it using the Update-AzWvdHostPool cmdlet.

In this example, I will modify the properties of the host pool to use it as a validation host pool. Microsoft recommends creating a validation host pool to apply service updates first and then monitoring the service before applying updates to a production host pool.

Get the properties of a host pool

To list all the properties of a host pool, you should use the Get-AzWvdHostPool cmdlet with the following syntax.

Get-AzWvdHostPool

Remove a host pool

Finally, if you want to remove the host pool, you should use the Remove-AzWvdHostPool cmdlet with the following syntax.

Azure CLI Workaround

In this case, we will use Azure Cloud Shell, a browser-based shell built into Azure Portal. This allows us to use the Azure command-line tools (Azure CLI and Azure PowerShell) directly from a browser. If you want to know more about Azure Cloud Shell, check out this link.
First, we define the characteristics of our environment and store the values in variables.

Create a new host pool

First, to create a host pool, you should use the following command.

Update a host pool

Once the resource is created, you can modify it using the following commands.

In this example, I will modify the properties of the host pool to use it as a validation host pool. Microsoft recommends creating a validation host pool to apply service updates first and then monitoring the service before applying updates to a production host pool.

Get the properties of a host pool

Use the following command to list all the properties of a host pool.

Azure Virtual Desktop HostPool

Delete a host pool

Finally, if you want to remove the host pool,  you should use the following command.

Thanks for reading my post. I hope you find it helpful.

In the next article, I’ll explain how to customize Remote Desktop Protocol (RDP) properties for a host pool.

Check out this link if you want to know more about Azure Virtual Desktop.