
In this video, I walk through creating a Service Principal using PowerShell and assigning it the role of Windows Virtual Desktop Owner. Once created, I use the new Azure AD Application Service Principal to deploy a host pool using the Portal.
### PowerShell used in the video ### ########## # RDS and AzureAD modules required Install-Module Microsoft.RDInfra.RDPowershell Install-Module AzureAD # Create a Service Principal # Create the Context for AzureAD $aadContext = Connect-AzureAD # Create the service principle $svcPrincipal = New-AzureADApplication -AvailableToOtherTenants $true -DisplayName "Windows Virtual Desktop Svc Principal" # Assign the SP creds to a variable $svcPrincipalCreds = New-AzureADApplicationPasswordCredential -ObjectId $svcPrincipal.ObjectId # View Credentials # Applicaiton ID $svcPrincipal.AppId # Password $svcPrincipalCreds.Value # Tenant ID $aadContext.TenantId.Guid # Create Role Assignment # Sign in to WVD Add-RdsAccount -DeploymentUrl "https://rdbroker.wvd.microsoft.com" # Assign RDS Owner Role to Tenant $myTenantName = (Get-RdsTenant).TenantName New-RdsRoleAssignment -RoleDefinitionName "RDS Owner" -ApplicationId $svcPrincipal.AppId -TenantName $myTenantName # Verify sign in $creds = New-Object System.Management.Automation.PSCredential($svcPrincipal.AppId, (ConvertTo-SecureString $svcPrincipalCreds.Value -AsPlainText -Force)) Add-RdsAccount -DeploymentUrl "https://rdbroker.wvd.microsoft.com" -Credential $creds -ServicePrincipal -AadTenantId $aadContext.Tenant.Id.Guid
Could that be one in a pipline ?