Migrating Existing RDS environment to Windows Desktop in Azure

This is Hans On Lab Recording from Microsoft Ignite 2019. You can migrate not only existing Remote Desktop Hosts but also VDI solutions. Script used in this Lab:

Install-Module -Name Microsoft.RDInfra.RDPowerShell
$tenant = “HOLVDI”
$hostpoolname = “rg982109-p”
Add-RdsAccount -DeploymentUrl “https://rdbroker.wvd.microsoft.com”
New-RdsHostPool -TenantName $tenant -Name $hostpoolname
New-RdsRegistrationInfo -TenantName $tenant -HostPoolName $hostpoolname -ExpirationHours 4 | Select-Object -ExpandProperty Token > “$env:PUBLIC\Desktop\token.txt”
Add-RdsAppGroupUser -TenantName $tenant -HostPoolName $hostpoolname -AppGroupName “Desktop Application Group” -UserPrincipalName “user982109@cloudplatimmersionlabs.onmicrosoft.com”
Set-RdsRemoteDesktop -TenantName $tenant -HostPoolName $hostpoolname -AppGroupName “Desktop Application Group” -FriendlyName “WS 2019”
#Install Agents
#https://query.prod.cms.rt.microsoft.com/cms/api/am/binary/RWrmXv
#https://query.prod.cms.rt.microsoft.com/cms/api/am/binary/RWrxrH
Get-RdsSessionHost -TenantName $tenant -HostPoolName $hostpoolname
#aka.ms/wvdweb
New-RdsAppGroup -TenantName HOLVDI -HostPoolName $hostpoolname -Name Wordpad -ResourceType RemoteApp
Get-RdsStartMenuApp -TenantName HOLVDI -HostPoolName $hostpoolname -AppGroupName Wordpad
Get-RdsStartMenuApp -TenantName HOLVDI -HostPoolName $hostpoolname -AppGroupName Wordpad | ? {$_.FriendlyName -match “Wordpad”}
New-RdsRemoteApp -TenantName HOLVDI -HostPoolName $hostpoolname -AppGroupName Wordpad -Name Wordpad -Filepath “C:\Program Files\WindowsNT\Accessories\wordpad.exe” -IconPath “C:\Program Files\WindowsNT\Accessories\wordpad.exe”
Get-RdsRemoteApp -TenantName HOLVDI -HostPoolName $hostpoolname -AppGroupName Wordpad
Add-RdsAppGroupUser -TenantName HOLVDI -HostPoolName $hostpoolname -AppGroupName Wordpad -UserPrincipalName “user982109-1@cloudplatimmersionlabs.onmicrosoft.com”
#aka.ms/wvdweb

Before start please do it (if you do not do it you will receive: Add-RdsAccount : One or more errors occurred. or New-RdsHostPool : User is not authorized to query the management service.):

Add Permission just open these links:

  1. https://login.microsoftonline.com/common/adminconsent?client_id=5a0aa725-4958-4b0c-80a9-34562e23f3b7&redirect_uri=https%3A%2F%2Frdweb.wvd.microsoft.com%2FRDWeb%2FConsentCallback
  2. wait a minute
  3. https://login.microsoftonline.com/common/adminconsent?client_id=fa4345a4-a730-4230-84a8-7d9651b86739&redirect_uri=https%3A%2F%2Frdweb.wvd.microsoft.com%2FRDWeb%2FConsentCallback
  4. wait a minute
  5. Open Azure Active Directory, Enterprise applications – Windows Virtual Desktop – Users and groups and add to your user Tenant Creator Role.
    Start Script
  6. Issue:

    New-RdsTenant -Name $tenant -AadTenantId <Azure Active Directory Tenant ID> -AzureSubscriptionId <Subscription Id>

  7. wait a minute and issue:

    New-RdsRoleAssignment -RoleDefinitionName “RDS Owner” -SignInName “mf@specsourcecom.onmicrosoft.com” -TenantGroupName “Default Tenant Group” -TenantName $tenant

More info here.