{"id":2877,"date":"2022-03-10T18:17:36","date_gmt":"2022-03-10T18:17:36","guid":{"rendered":"https:\/\/exceedthecloud.com\/?p=2877"},"modified":"2022-03-10T18:44:10","modified_gmt":"2022-03-10T18:44:10","slug":"deploy-and-manage-virtual-desktop-host-pools-and-hosts-by-using-powershell","status":"publish","type":"post","link":"https:\/\/exceedthecloud.com\/?p=2877","title":{"rendered":"Deploy and manage Virtual Desktop host pools and hosts by using PowerShell"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You need to automate deployment of Azure Virtual Desktop host pools and hosts by using PowerShell in an Active Directory Domain Services (AD DS) environment.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Prerequisites for this labs<\/strong>&nbsp;:&nbsp;<a href=\"https:\/\/azure.microsoft.com\/en-us\/free\/\" target=\"_blank\" rel=\"noreferrer noopener\">Azure Account<\/a>&nbsp;\/&nbsp;<a href=\"https:\/\/github.com\/marcelin-ndjila\/Practical-Labs-Series\/blob\/master\/Azurelabs13.zip\" target=\"_blank\" rel=\"noreferrer noopener\">Download Labs Files here<\/a><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>An Azure subscription you will be using in this lab.<\/li><li>A Microsoft account or an Azure AD account with the Owner or Contributor role in the Azure subscription you will be using in this lab and with the Global Administrator role in the Azure AD tenant associated with that Azure subscription.<\/li><li>The completed lab <strong><a href=\"https:\/\/exceedthecloud.com\/?p=2660\" target=\"_blank\" rel=\"noreferrer noopener\" title=\"Prepare for deployment of Azure Virtual Desktop (AD DS)\">Prepare for deployment of Azure Virtual Desktop (AD DS)<\/a><\/strong><\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Objectives<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After completing this lab, you will be able to:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Deploy Azure Virtual Desktop host pools and hosts by using PowerShell<\/li><li>Add hosts to the Azure Virtual Desktop host pool by using PowerShell<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Lab 1: Implement Azure Virtual Desktop host pools and session hosts by using PowerShell<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The main tasks for this Lab are as follows:<\/p>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>Prepare for deployment of Azure Virtual Desktop host pool by using PowerShell<\/li><li>Create a Azure Virtual Desktop host pool by using PowerShell<\/li><li>Perform a template-based deployment of an Azure VM running Windows 10 Enterprise by using PowerShell<\/li><li>Add an Azure VM running Windows 10 Enterprise as a session host to the Azure Virtual Desktop host pool by using PowerShell<\/li><li>Verify the deployment of the Azure Virtual Desktop session host<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Task 1: Prepare for deployment of Azure Virtual Desktop host pool by using PowerShell<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>From your lab computer, start a web browser, navigate to the <a href=\"https:\/\/portal.azure.com\" target=\"_blank\" rel=\"noreferrer noopener\">Azure portal<\/a>, and sign in by providing credentials of a user account with the Owner role in the subscription you will be using in this lab.<\/li><li>In the Azure portal, search for and select <strong>Virtual machines<\/strong> and, from the <strong>Virtual machines<\/strong> blade, select <strong>exceed-dc-vm11<\/strong>.<\/li><li>On the <strong>exceed-dc-vm11<\/strong> blade, select <strong>Connect<\/strong>, in the drop-down menu, select <strong>Bastion<\/strong>, on the <strong>Bastion<\/strong> tab of the <strong>exceed-dc-vm11 | Connect<\/strong> blade, select <strong>Use Bastion<\/strong>.<\/li><li>When prompted, provide the following credentials and select <strong>Connect<\/strong>:<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><td><strong>Setting<\/strong><\/td><td><strong>Value<\/strong><\/td><\/tr><\/thead><tbody><tr><td>User Name<\/td><td><strong>Student<\/strong><\/td><\/tr><tr><td>Password<\/td><td><strong>Pa55w.rd1234<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"465\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture1-1-1024x465.png\" alt=\"\" class=\"wp-image-2878\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture1-1-1024x465.png 1024w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture1-1-300x136.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture1-1-768x349.png 768w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture1-1.png 1044w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>Within the Remote Desktop session to <strong>exceed-dc-vm11<\/strong>, start <strong>Windows PowerShell ISE<\/strong> as administrator.<\/li><li>Within the Remote Desktop session to <strong>exceed-dc-vm11<\/strong>, from the <strong>Administrator: Windows PowerShell ISE<\/strong> console, run the following to identify the distinguished name of the organizational unit named <strong>WVDInfra<\/strong> that will host the computer objects of the Azure Virtual Desktop pool session hosts:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>(Get-ADOrganizationalUnit -Filter \"Name -eq 'WVDInfra'\").distinguishedName<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"850\" height=\"477\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture2.png\" alt=\"\" class=\"wp-image-2879\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture2.png 850w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture2-300x168.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture2-768x431.png 768w\" sizes=\"auto, (max-width: 850px) 100vw, 850px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Within the Remote Desktop session to <strong>exceed-dc-vm11<\/strong>, from the <strong>Administrator: Windows PowerShell ISE<\/strong> script pane, run the following to identify the UPN suffix of the <strong>ADATUM\\Student<\/strong> account that you will use to join the Azure Virtual Desktop hosts to the AD DS domain (<a href=\"mailto:student@adatum.com\"><strong>student@adatum.com<\/strong><\/a>):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>(Get-ADUser -Filter {sAMAccountName -eq 'student'} -Properties userPrincipalName).userPrincipalName<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"850\" height=\"477\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture3.png\" alt=\"\" class=\"wp-image-2880\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture3.png 850w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture3-300x168.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture3-768x431.png 768w\" sizes=\"auto, (max-width: 850px) 100vw, 850px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Within the Remote Desktop session to <strong>exceed-dc-vm11<\/strong>, from the <strong>Administrator: Windows PowerShell ISE<\/strong> script pane, run the following to install the DesktopVirtualization PowerShell module (when prompted, click <strong>Yes to All<\/strong>):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Install-Module -Name Az.DesktopVirtualization -Force<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"841\" height=\"385\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture4.png\" alt=\"\" class=\"wp-image-2881\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture4.png 841w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture4-300x137.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture4-768x352.png 768w\" sizes=\"auto, (max-width: 841px) 100vw, 841px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note<\/strong>: Ignore any warnings regarding existing PowerShell modules in use.<\/p>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>Within the Remote Desktop session to <strong>exceed-dc-vm11<\/strong>, start Microsoft Edge and navigate to the <a href=\"https:\/\/portal.azure.com\" target=\"_blank\" rel=\"noreferrer noopener\">Azure portal<\/a>. If prompted, sign in by using the Azure AD credentials of the user account with the Owner role in the subscription you are using in this lab.<\/li><li>Within the Remote Desktop session to <strong>exceed-dc-vm11<\/strong>, in the Azure portal, use the <strong>Search resources, services, and docs<\/strong> text box at the top of the Azure portal page to search for and navigate to <strong>Virtual networks<\/strong> and, on the <strong>Virtual networks<\/strong> blade, select <strong>exceed-adds-vnet11<\/strong>.<\/li><li>On the <strong>exceed-adds-vnet11<\/strong> blade, select <strong>Subnets<\/strong>, on the <strong>Subnets<\/strong> blade, select <strong>+ Subnet<\/strong>, on the <strong>Add subnet<\/strong> blade, specify the following settings (leave all other settings with their default values) and click <strong>Save<\/strong>:<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><td><strong>Setting<\/strong><\/td><td><strong>Value<\/strong><\/td><\/tr><\/thead><tbody><tr><td>Name<\/td><td><strong>hp3-Subnet<\/strong><\/td><\/tr><tr><td>Subnet address range<\/td><td><strong>10.0.3.0\/24<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"606\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture5-1024x606.png\" alt=\"\" class=\"wp-image-2882\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture5-1024x606.png 1024w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture5-300x177.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture5-768x454.png 768w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture5.png 1207w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>Within the Remote Desktop session to <strong>exceed-dc-vm11<\/strong>, in the Azure portal, use the <strong>Search resources, services, and docs<\/strong> text box at the top of the Azure portal page to search for and navigate to <strong>Network security groups<\/strong> and, on the <strong>Network security groups<\/strong> blade, select the security group in the <strong>exceed140-11-RG <\/strong>resource group.<\/li><li>On the network security group blade, in the vertical menu on the left, in the <strong>Settings<\/strong> section, click <strong>Properties<\/strong>.<\/li><li>On the <strong>Properties<\/strong> blade, click the <strong>Copy to clipboard<\/strong> icon on the right side of the <strong>Resource ID<\/strong> textbox.<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"446\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture6-1024x446.png\" alt=\"\" class=\"wp-image-2883\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture6-1024x446.png 1024w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture6-300x131.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture6-768x334.png 768w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture6.png 1217w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note<\/strong>: The value should resemble the format \/subscriptions\/de8279a3-0675-40e6-91e2-5c3728792cb5\/resourceGroups\/exceed140-11-RG\/providers\/Microsoft.Network\/networkSecurityGroups\/exceed-cl-vm11-nsg, although the subscription ID will differ. Record it since you will need it in the next task.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Task 2: Create a Azure Virtual Desktop host pool by using PowerShell<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>Within the Remote Desktop session to <strong>exceed-dc-vm11<\/strong>, from the <strong>Administrator: Windows PowerShell ISE<\/strong> script pane, run the following to sign in to your Azure subscription:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>Connect-AzAccount<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"847\" height=\"387\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture7.png\" alt=\"\" class=\"wp-image-2884\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture7.png 847w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture7-300x137.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture7-768x351.png 768w\" sizes=\"auto, (max-width: 847px) 100vw, 847px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>When prompted, provide the credentials of the user account with the Owner role in the subscription you are using in this lab.<\/li><li>Within the Remote Desktop session to <strong>exceed-dc-vm11<\/strong>, from the <strong>Administrator: Windows PowerShell ISE<\/strong> script pane, run the following to identify the Azure region hosting the Azure virtual network <strong>exceed-adds-vnet11<\/strong>:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>$location = (Get-AzVirtualNetwork -ResourceGroupName 'exceed140-11-RG' -Name 'exceed-adds-vnet11').Location<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"941\" height=\"386\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture8.png\" alt=\"\" class=\"wp-image-2885\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture8.png 941w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture8-300x123.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture8-768x315.png 768w\" sizes=\"auto, (max-width: 941px) 100vw, 941px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Within the Remote Desktop session to <strong>exceed-dc-vm11<\/strong>, from the <strong>Administrator: Windows PowerShell ISE<\/strong> script pane, run the following to create a resource group that will host the host pool and its resources:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$resourceGroupName = 'exceed140-24-RG'\nNew-AzResourceGroup -Location $location -Name $resourceGroupName<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"938\" height=\"380\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture9.png\" alt=\"\" class=\"wp-image-2886\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture9.png 938w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture9-300x122.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture9-768x311.png 768w\" sizes=\"auto, (max-width: 938px) 100vw, 938px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Within the Remote Desktop session to <strong>exceed-dc-vm11<\/strong>, from the <strong>Administrator: Windows PowerShell ISE<\/strong> script pane, run the following to create an empty host pool:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$hostPoolName = 'exceed140-24-hp3'\n$workspaceName = 'exceed140-24-ws1'\n$dagAppGroupName = \"$hostPoolName-DAG\"\nNew-AzWvdHostPool -ResourceGroupName $resourceGroupName -Name $hostPoolName -WorkspaceName $workspaceName -HostPoolType Pooled -LoadBalancerType BreadthFirst -Location $location -DesktopAppGroupName $dagAppGroupName -PreferredAppGroupType Desktop<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"938\" height=\"467\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture10.png\" alt=\"\" class=\"wp-image-2887\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture10.png 938w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture10-300x149.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture10-768x382.png 768w\" sizes=\"auto, (max-width: 938px) 100vw, 938px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note<\/strong>: The <strong>New-AzWvdHostPool<\/strong> cmdlet allows you to create a host pool, workspace, and the desktop app group, as well as to register the desktop app group with the workspace. You have the option of creating a new workspace or using an existing one.<\/p>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>Within the Remote Desktop session to <strong>exceed-dc-vm11<\/strong>, from the <strong>Administrator: Windows PowerShell ISE<\/strong> console, run the following to retrieve the objectID attribute of the Azure AD group named <strong>exceed140-wvd-pooled<\/strong>:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>$aadGroupObjectId = (Get-AzADGroup -DisplayName 'exceed140-wvd-pooled').Id<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Within the Remote Desktop session to <strong>exceed-dc-vm11<\/strong>, from the <strong>Administrator: Windows PowerShell ISE<\/strong> console, run the following to assign the Azure AD group named <strong>exceed140-wvd-pooled<\/strong> to the default desktop app group of the newly created host pool:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$roleDefinitionName = 'Desktop Virtualization User'\nNew-AzRoleAssignment -ObjectId $aadGroupObjectId -RoleDefinitionName $roleDefinitionName -ResourceName $dagAppGroupName -ResourceGroupName $resourceGroupName -ResourceType 'Microsoft.DesktopVirtualization\/applicationGroups'<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"950\" height=\"516\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture11.png\" alt=\"\" class=\"wp-image-2888\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture11.png 950w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture11-300x163.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture11-768x417.png 768w\" sizes=\"auto, (max-width: 950px) 100vw, 950px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Task 3: Perform a template-based deployment of an Azure VM running Windows 10 Enterprise by using PowerShell<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>From your lab computer, use the Remote Desktop session to the <strong>exceed-dc-vm11<\/strong> Azure VM to copy the lab files <strong>\\\\Yourfolder\\exceed140-24_azuredeployhp3.json<\/strong> and <strong>\\\\Yourfolder\\exceed140-24_azuredeployhp3.parameters.json<\/strong> to the <strong>C:\\AllFiles\\Labs\\02<\/strong> folder (create it if needed).<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> If you&#8217;re having trouble getting the files from the Lab computer over to the nested virtual machine, in the Azure portal on the lab computer, you can upload the 2 files to the <strong>exceed140-22-profiles<\/strong> file share you made in the previous lab. After uploading the files to the share, simply go to <strong>exceed-dc-vm1<\/strong> and, in the Azure portal, from the file share there, download the files locally.<\/p>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>Within the Remote Desktop session to <strong>exceed-dc-vm11<\/strong>, from the <strong>Administrator: Windows PowerShell ISE<\/strong> console, run the following to deploy an Azure VM running Windows 10 Enterprise (multi-session) that will serve as a Azure Virtual Desktop session host in the host pool you created in the previous task:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>$resourceGroupName = 'exceed140-24-RG'\n$location = (Get-AzResourceGroup -ResourceGroupName $resourceGroupName).Location\nNew-AzResourceGroupDeployment `\n  -ResourceGroupName $resourceGroupName `\n  -Location $location `\n  -Name exceed140lab24hp3Deployment `\n  -TemplateFile C:\\AllFiles\\Labs\\02\\exceed140-24_azuredeployhp3.json `\n-TemplateParameterFile C:\\AllFiles\\Labs\\02\\exceed140-24_azuredeployhp3.parameters.json<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"957\" height=\"721\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture12.png\" alt=\"\" class=\"wp-image-2889\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture12.png 957w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture12-300x226.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture12-768x579.png 768w\" sizes=\"auto, (max-width: 957px) 100vw, 957px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note<\/strong>: Wait for the deployment to complete before you proceed to the next task. This might take about 5 minutes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note<\/strong>: The deployment uses an Azure Resource Manager template to provision an Azure VM and applies a VM extension that automatically joins the operating system to the <strong>adatum.com<\/strong> AD DS domain.<\/p>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>Within the Remote Desktop session to <strong>exceed-dc-vm11<\/strong>, from the <strong>Administrator: Windows PowerShell ISE<\/strong> console, run the following to verify that the third session host was successfully joined to the <strong>adatum.com<\/strong> AD DS domain:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>Get-ADComputer -Filter \"sAMAccountName -eq 'exceed-24-p3-0$'\"<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"962\" height=\"422\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture13.png\" alt=\"\" class=\"wp-image-2890\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture13.png 962w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture13-300x132.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture13-768x337.png 768w\" sizes=\"auto, (max-width: 962px) 100vw, 962px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Task 4: Add an Azure VM running Windows 10 Enterprise as a host to the Azure Virtual Desktop host pool by using PowerShell<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>Within the Remote Desktop session to <strong>exceed-dc-vm11<\/strong>, in the browser window displaying the Azure portal, search for and select <strong>Virtual machines<\/strong> and, on the <strong>Virtual machines<\/strong> blade, in the list of virtual machines, select <strong>exceed-24-p3-0<\/strong>.<\/li><li>On the <strong>exceed-24-p3-0<\/strong> blade, select <strong>Connect<\/strong>, in the drop-down menu, select <strong>RDP<\/strong>, on the <strong>RDP<\/strong> tab of the <strong>exceed-24-p3-0 | Connect<\/strong> blade, in the <strong>IP address<\/strong> drop-down list, select the <strong>Private IP address (10.0.3.4)<\/strong> entry, and then select <strong>Download RDP File<\/strong>.<\/li><li>When prompted, sign in with the following credentials:<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><td><strong>Setting<\/strong><\/td><td><strong>Value<\/strong><\/td><\/tr><\/thead><tbody><tr><td>User Name<\/td><td><strong>ADATUM\\Student<\/strong><\/td><\/tr><tr><td>Password<\/td><td><strong>Pa55w.rd1234<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"518\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture14-1024x518.png\" alt=\"\" class=\"wp-image-2891\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture14-1024x518.png 1024w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture14-300x152.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture14-768x389.png 768w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture14.png 1211w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>Within the Remote Desktop session to <strong>exceed-24-p3-0<\/strong>, start <strong>Windows PowerShell ISE<\/strong> as administrator.<\/li><li>Within the Remote Desktop session to <strong>exceed-24-p3-0<\/strong>, from the <strong>Administrator: Windows PowerShell ISE<\/strong> script pane, run the following to create a folder that will host files required to add the newly deployed Azure VM as a session host to the host pool you provisioned earlier in this lab:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>$labFilesFolder = 'C:\\AllFiles\\Labs\\02'\nNew-Item -ItemType Directory -Path $labFilesFolder\n\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"902\" height=\"435\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture15.png\" alt=\"\" class=\"wp-image-2892\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture15.png 902w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture15-300x145.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture15-768x370.png 768w\" sizes=\"auto, (max-width: 902px) 100vw, 902px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note<\/strong> take care using the [T] construct to copy over the PowerShell cmdlets. In some instances, the text copied over can be incorrect, such as the $ sign showing as a 4 number character. You will need to correct these before issuing the cmdlet. Copy over to the PowerShell ISE <strong>Script<\/strong> pane, make the corrections there, and then highlight the corrected text and press <strong>F8<\/strong> (<strong>Run Selection<\/strong>).<\/p>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>Within the Remote Desktop session to <strong>exceed-24-p3-0<\/strong>, from the <strong>Administrator: Windows PowerShell ISE<\/strong> script pane, run the following to download the Azure Virtual Desktop Agent and Boot Loader installers, required to add the session host to the host pool:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>$webClient = New-Object System.Net.WebClient\n$wvdAgentInstallerURL = 'https:\/\/query.prod.cms.rt.microsoft.com\/cms\/api\/am\/binary\/RWrmXv'\n$wvdAgentInstallerName = 'WVD-Agent.msi'\n$webClient.DownloadFile($wvdAgentInstallerURL,\"$labFilesFolder\/$wvdAgentInstallerName\")\n$wvdBootLoaderInstallerURL = 'https:\/\/query.prod.cms.rt.microsoft.com\/cms\/api\/am\/binary\/RWrxrH'\n$wvdBootLoaderInstallerName = 'WVD-BootLoader.msi'\n$webClient.DownloadFile($wvdBootLoaderInstallerURL,\"$labFilesFolder\/$wvdBootLoaderInstallerName\")<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"892\" height=\"435\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture16.png\" alt=\"\" class=\"wp-image-2893\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture16.png 892w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture16-300x146.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture16-768x375.png 768w\" sizes=\"auto, (max-width: 892px) 100vw, 892px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"845\" height=\"376\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture17.png\" alt=\"\" class=\"wp-image-2894\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture17.png 845w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture17-300x133.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture17-768x342.png 768w\" sizes=\"auto, (max-width: 845px) 100vw, 845px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Within the Remote Desktop session to <strong>exceed-24-p3-0<\/strong>, from the <strong>Administrator: Windows PowerShell ISE<\/strong> script pane, run the following to install the latest version of the PowerShellGet module (select <strong>Yes<\/strong> when prompted for confirmation):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;Net.ServicePointManager]::SecurityProtocol = &#91;Net.SecurityProtocolType]::Tls12\nInstall-Module -Name PowerShellGet -Force -SkipPublisherCheck<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"432\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture18-1024x432.png\" alt=\"\" class=\"wp-image-2895\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture18-1024x432.png 1024w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture18-300x127.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture18-768x324.png 768w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture18.png 1275w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">From the <strong>Administrator: Windows PowerShell ISE<\/strong> console, run the following to install the latest version of the Az.DesktopVirtualization PowerShell module:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Install-Module -Name Az.DesktopVirtualization -AllowClobber -Force\nInstall-Module -Name Az -AllowClobber -Force<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"436\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture19.png\" alt=\"\" class=\"wp-image-2896\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture19.png 900w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture19-300x145.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture19-768x372.png 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">From the <strong>Administrator: Windows PowerShell ISE<\/strong> console, run the following to modify the PowerShell execution policy and sign in to your Azure subscription:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser -Force\nConnect-AzAccount\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"891\" height=\"437\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture20.png\" alt=\"\" class=\"wp-image-2897\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture20.png 891w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture20-300x147.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture20-768x377.png 768w\" sizes=\"auto, (max-width: 891px) 100vw, 891px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>When prompted, provide the credentials of the user account with the Owner role in the subscription you are using in this lab.<\/li><li>Within the Remote Desktopliveid session to <strong>exceed-24-p3-0<\/strong>, from the <strong>Administrator: Windows PowerShell ISE<\/strong> console, run the following to generate the token necessary to join new session hosts to the pool you provisioned earlier in this Lab:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>$resourceGroupName = 'exceed140-24-RG'\n$hostPoolName = 'exceed140-24-hp3'\n$registrationInfo = New-AzWvdRegistrationInfo -ResourceGroupName $resourceGroupName -HostPoolName $hostPoolName -ExpirationTime $((get-date).ToUniversalTime().AddDays(1).ToString('yyyy-MM-ddTHH:mm:ss.fffffffZ'))<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"897\" height=\"434\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture21.png\" alt=\"\" class=\"wp-image-2898\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture21.png 897w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture21-300x145.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture21-768x372.png 768w\" sizes=\"auto, (max-width: 897px) 100vw, 897px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note<\/strong>: A registration token is required to authorize a session host to join the host pool. The value of token&#8217;s expiration date must be between one hour and one month from the current date and time.<\/p>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>Within the Remote Desktop session to <strong>exceed-24-p3-0<\/strong>, from the <strong>Administrator: Windows PowerShell ISE<\/strong> console, run the following to install the Azure Virtual Desktop Agent:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>Set-Location -Path $labFilesFolder\nStart-Process -FilePath 'msiexec.exe' -ArgumentList \"\/i $WVDAgentInstallerName\", \"\/quiet\", \"\/qn\", \"\/norestart\", \"\/passive\", \"REGISTRATIONTOKEN=$($registrationInfo.Token)\", \"\/l* $labFilesFolder\\AgentInstall.log\" | Wait-Process<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"895\" height=\"438\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture22.png\" alt=\"\" class=\"wp-image-2899\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture22.png 895w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture22-300x147.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture22-768x376.png 768w\" sizes=\"auto, (max-width: 895px) 100vw, 895px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Within the Remote Desktop session to <strong>exceed-24-p3-0<\/strong>, from the <strong>Administrator: Windows PowerShell ISE<\/strong> console, run the following to install the Azure Virtual Desktop Boot Loader:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Start-Process -FilePath \"msiexec.exe\" -ArgumentList \"\/i $wvdBootLoaderInstallerName\", \"\/quiet\", \"\/qn\", \"\/norestart\", \"\/passive\", \"\/l* $labFilesFolder\\BootLoaderInstall.log\" | Wait-process<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"437\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture23.png\" alt=\"\" class=\"wp-image-2900\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture23.png 900w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture23-300x146.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture23-768x373.png 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Task 5: Verify the deployment of the Azure Virtual Desktop host<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>Switch to the lab computer, in the web browser displaying the Azure portal, search for and select <strong>Azure Virtual Desktop<\/strong>, on the <strong>Azure Virtual Desktop<\/strong> blade, select <strong>Host pools<\/strong> and, on the <strong>Azure Virtual Desktop | Host pools<\/strong> blade, select the entry <strong>exceed140-24-hp3<\/strong> representing the newly modified pool.<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"336\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture24-1024x336.png\" alt=\"\" class=\"wp-image-2901\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture24-1024x336.png 1024w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture24-300x98.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture24-768x252.png 768w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture24.png 1223w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">On the <strong>exceed140-24-hp3<\/strong> blade, in the vertical menu on the left side, in the <strong>Manage<\/strong> section, click <strong>Session hosts<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"511\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture25-1024x511.png\" alt=\"\" class=\"wp-image-2902\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture25-1024x511.png 1024w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture25-300x150.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture25-768x383.png 768w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture25.png 1216w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>On the <strong>exceed140-24-hp3 | Session hosts<\/strong> blade, verify that the deployment includes a single host.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Task 6: Manage app groups using PowerShell<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>From the lab computer, switch to the Remote Desktop session to <strong>exceed-dc-vm11<\/strong>, from the <strong>Administrator: Windows PowerShell ISE<\/strong> console, run the following to create a Remote App group:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>$subscriptionId = (Get-AzContext).Subscription.Id\n$appGroupName = 'exceed140-24-hp3-Office365-RAG'\n$resourceGroupName = 'exceed140-24-RG'\n$hostPoolName = 'exceed140-24-hp3'\n$location = (Get-AzVirtualNetwork -ResourceGroupName 'exceed140-11-RG' -Name 'exceed-adds-vnet11').Location\nNew-AzWvdApplicationGroup -Name $appGroupName -ResourceGroupName $resourceGroupName -ApplicationGroupType 'RemoteApp' -HostPoolArmPath \"\/subscriptions\/$subscriptionId\/resourcegroups\/$resourceGroupName\/providers\/Microsoft.DesktopVirtualization\/hostPools\/$hostPoolName\"-Location $location<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"941\" height=\"485\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture26.png\" alt=\"\" class=\"wp-image-2903\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture26.png 941w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture26-300x155.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture26-768x396.png 768w\" sizes=\"auto, (max-width: 941px) 100vw, 941px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Within the Remote Desktop session to <strong>exceed-dc-vm11<\/strong>, from the <strong>Administrator: Windows PowerShell ISE<\/strong> console, run the following to list the <strong>Start<\/strong> menu apps on the pool&#8217;s hosts and review the output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Get-AzWvdStartMenuItem -ApplicationGroupName $appGroupName -ResourceGroupName $resourceGroupName | Format-List | more<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"929\" height=\"696\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture27.png\" alt=\"\" class=\"wp-image-2904\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture27.png 929w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture27-300x225.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture27-768x575.png 768w\" sizes=\"auto, (max-width: 929px) 100vw, 929px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note<\/strong>: For any application you want to publish, you should record the information included in the output, including such parameters as <strong>FilePath<\/strong>, <strong>IconPath<\/strong>, and <strong>IconIndex<\/strong>.<\/p>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>Within the Remote Desktop session to <strong>exceed-dc-vm11<\/strong>, from the <strong>Administrator: Windows PowerShell ISE<\/strong> console, run the following to publish Microsoft Word:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>$name = 'Microsoft Word'\n$filePath = 'C:\\Program Files\\Microsoft Office\\root\\Office16\\WINWORD.EXE'\n$iconPath = 'C:\\Program Files\\Microsoft Office\\Root\\VFS\\Windows\\Installer\\{90160000-000F-0000-1000-0000000FF1CE}\\wordicon.exe'\nNew-AzWvdApplication -GroupName $appGroupName -Name $name -ResourceGroupName $resourceGroupName -FriendlyName $name -Filepath $filePath -IconPath $iconPath -IconIndex 0 -CommandLineSetting 'DoNotAllow' -ShowInPortal:$true<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"934\" height=\"417\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture28.png\" alt=\"\" class=\"wp-image-2905\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture28.png 934w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture28-300x134.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture28-768x343.png 768w\" sizes=\"auto, (max-width: 934px) 100vw, 934px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Within the Remote Desktop session to <strong>exceed-dc-vm11<\/strong>, from the <strong>Administrator: Windows PowerShell ISE<\/strong> console, run the following to publish Microsoft Word:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$aadGroupObjectId = (Get-AzADGroup -DisplayName 'exceed140-wvd-remote-app').Id\nNew-AzRoleAssignment -ObjectId $aadGroupObjectId -RoleDefinitionName 'Desktop Virtualization User' -ResourceName $appGroupName -ResourceGroupName $resourceGroupName -ResourceType 'Microsoft.DesktopVirtualization\/applicationGroups'<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"928\" height=\"702\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture29.png\" alt=\"\" class=\"wp-image-2906\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture29.png 928w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture29-300x227.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture29-768x581.png 768w\" sizes=\"auto, (max-width: 928px) 100vw, 928px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Switch to the lab computer, in the web browser displaying the Azure portal, on the <strong>exceed140-24-hp3 | Session hosts<\/strong> blade, in the vertical menu on the left side, in the <strong>Manage<\/strong> section, select <strong>Application groups<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"497\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture30-1024x497.png\" alt=\"\" class=\"wp-image-2907\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture30-1024x497.png 1024w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture30-300x146.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture30-768x373.png 768w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture30.png 1219w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">On the <strong>exceed140-24-hp3 | Application groups<\/strong> blade, in the list of application groups, select the <strong>exceed140-24-hp3-Office365-RAG<\/strong> entry.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"518\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture31-1024x518.png\" alt=\"\" class=\"wp-image-2908\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture31-1024x518.png 1024w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture31-300x152.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture31-768x388.png 768w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture31.png 1208w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">On the <strong>exceed140-24-hp3-Office365-RAG<\/strong> blade, verify the configuration of the application group, including the applications and assignments.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"422\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture32-1024x422.png\" alt=\"\" class=\"wp-image-2909\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture32-1024x422.png 1024w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture32-300x124.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture32-768x316.png 768w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture32.png 1219w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"468\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture33-1024x468.png\" alt=\"\" class=\"wp-image-2910\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture33-1024x468.png 1024w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture33-300x137.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture33-768x351.png 768w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture33.png 1108w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Lab 2: Stop and deallocate Azure VMs provisioned in the lab<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The main tasks for this Lab are as follows:<\/p>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>Stop and deallocate Azure VMs provisioned in the lab<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note<\/strong>: In this Lab, you will deallocate the Azure VMs provisioned in this lab to minimize the corresponding compute charges<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Task 1: Deallocate Azure VMs provisioned in the lab<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>Switch to the lab computer and, in the web browser window displaying the Azure portal, open the <strong>PowerShell<\/strong> shell session within the <strong>Cloud Shell<\/strong> pane.<\/li><li>From the PowerShell session in the Cloud Shell pane, run the following to list all Azure VMs created in this lab:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>Get-AzVM -ResourceGroup 'exceed140-24-RG'<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"940\" height=\"215\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture34.png\" alt=\"\" class=\"wp-image-2911\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture34.png 940w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture34-300x69.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture34-768x176.png 768w\" sizes=\"auto, (max-width: 940px) 100vw, 940px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">From the PowerShell session in the Cloud Shell pane, run the following to stop and deallocate all Azure VMs you created in this lab:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Get-AzVM -ResourceGroup 'exceed140-24-RG' | Stop-AzVM -NoWait -Force<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"837\" height=\"244\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture35.png\" alt=\"\" class=\"wp-image-2912\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture35.png 837w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture35-300x87.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture35-768x224.png 768w\" sizes=\"auto, (max-width: 837px) 100vw, 837px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note<\/strong>: The command executes asynchronously (as determined by the -NoWait parameter), so while you will be able to run another PowerShell command immediately afterwards within the same PowerShell session, it will take a few minutes before the Azure VMs are actually stopped and deallocated.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"509\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture36-1024x509.png\" alt=\"\" class=\"wp-image-2913\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture36-1024x509.png 1024w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture36-300x149.png 300w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture36-768x381.png 768w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/picture36.png 1214w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Congratulations, you are now able to automate deployment of Azure Virtual Desktop host pools and hosts by using PowerShell in an Active Directory Domain Services (AD DS) environment.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark class=\"kt-highlight\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-virtue-primary-color\">Reminder: Don&#8217;t forget to delete or shutdown all unused Azure resources after your labs for cost saving<\/mark><\/mark><\/p>\n","protected":false},"excerpt":{"rendered":"<p>You need to automate deployment of Azure Virtual Desktop host pools and hosts by using PowerShell in an Active Directory Domain Services (AD DS) environment. Prerequisites for this labs&nbsp;:&nbsp;Azure Account&nbsp;\/&nbsp;Download Labs Files here An Azure subscription you will be using &hellip; <a href=\"https:\/\/exceedthecloud.com\/?p=2877\">Continued<\/a><\/p>\n","protected":false},"author":1,"featured_media":2918,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"kt_blocks_editor_width":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[102,98,4,19],"tags":[103,99,35],"class_list":["post-2877","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure-virtual-desktop","category-powershell","category-practical-labs-series","category-virtual-machines","tag-azure-virtual-desktop","tag-powershell","tag-virtual-machines"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2022\/03\/istockphoto-1317226698-170667a.jpg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/exceedthecloud.com\/index.php?rest_route=\/wp\/v2\/posts\/2877","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/exceedthecloud.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/exceedthecloud.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/exceedthecloud.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/exceedthecloud.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2877"}],"version-history":[{"count":8,"href":"https:\/\/exceedthecloud.com\/index.php?rest_route=\/wp\/v2\/posts\/2877\/revisions"}],"predecessor-version":[{"id":2929,"href":"https:\/\/exceedthecloud.com\/index.php?rest_route=\/wp\/v2\/posts\/2877\/revisions\/2929"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/exceedthecloud.com\/index.php?rest_route=\/wp\/v2\/media\/2918"}],"wp:attachment":[{"href":"https:\/\/exceedthecloud.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2877"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/exceedthecloud.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2877"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/exceedthecloud.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2877"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}