How to remove a HostPool from the Windows Virtual Desktop on Azure

After a few times deploying a Windows Virtual Desktop (WVD) infrastructure on Azure, I always found that sometimes you have the necessity to reset your environment, specially if this is your test environment.

After a few tries on resetting the environment I develop the following process that allows me to reset in a few minutes. The process is simple. You just need to remove the virtual machines crested, the Application group(s), the Session Host servers and the Host Pool.

The Virtual Machines created on the moment of the deployment of your environment is simple to remove. If you follow the best practices of create an empty Resource Group, you just need to delete the Resource group. Although there are some services/resources on the background that you need to delete as well, like the Application groups, Session Hosts and the Host Pool. At the present moment, you can’t do it through the Azure Portal, so the only option is PowerShell.

You can either use the PowerShell on your desktop or the use the CloudShell on Azure.

1 – Login on Windows Virtual Desktop Tenant

2 – Validate the WVD Infrastructure

3 – Remove the Application Group(s)

4 – Remove the Session Host servers

5 – Remove the Host Pool

To simplify, here is the script that I created for this:

$TenantName="<TENANT_NAME>"
$HostPoolName="<HOST_POOL_NAME>" 

#STEP 1 - Login on Windows Virtual Desktop Tenant 
Add-RdsAccount -DeploymentUrl "https://rdbroker.wvd.microsoft.com" 
#STEP 2 - Remove Application Group associated to the Host Pool 
Get-RdsAppGroup -TenantName $TenantName -HostPoolName $HostPoolName |Remove-RdsAppGroup 
#STEP 3 - Remove Session Host servers associated to the Host Pool 
Get-RdsSessionHost -TenantName $TenantName -HostPoolName $HostPoolName |Remove-RdsSessionHost 
#STEP 4 - Remove the Host Pool 
Get-RdsHostPool -TenantName $TenantName -HostPoolName $HostPoolName |Remove-RdsHostPool 

Cheers,

Marcos Nogueira
Azure MVP
azurecentric.com
Twitter: @mdnoga

Marcos Nogueira

With more than 18 years experience in Datacenter Architectures, Marcos Nogueira is currently working as a Principal Cloud Solution Architect. He is an expert in Private and Hybrid Cloud, with a focus on Microsoft Azure, Virtualization and System Center. He has worked in several industries, including Aerospace, Transportation, Energy, Manufacturing, Financial Services, Government, Health Care, Telecoms, IT Services, and Gas & Oil in different countries and continents. Marcos was a Canadian MVP in System Center Cloud & Datacenter Managenment and he has +14 years as Microsoft Certified, with more than 100+ certifications (MCT, MCSE, and MCITP, among others). Marcos is also certified in VMware, CompTIA and ITIL v3. He assisted Microsoft in the development of workshops and special events on Private & Hybrid Cloud, Azure, System Center, Windows Server, Hyper-V and as a speaker at several Microsoft TechEd/Ignite and communities events around the world.

One Reply to “How to remove a HostPool from the Windows Virtual Desktop on Azure”

  1. Hi Marcos. Great Article!. I deployed a windows Desktop envrionment with 19)VMs/Users and now we need to add 4 new users. What is the best way to do it?.

    Thanks and Regards!

Leave a Reply

Your email address will not be published. Required fields are marked *