Add-RdsAccount
Adds an authenticated account to use for Windows Virtual Desktop cmdlet requests.
Syntax
Add-RdsAccount
[-DeploymentUrl] <String>
[[-Credential] <PSCredential>]
[<CommonParameters>]
Add-RdsAccount
[-DeploymentUrl] <String>
[-Credential] <PSCredential>
[-ServicePrincipal]
[-AadTenantId] <String>
[<CommonParameters>]
Add-RdsAccount
[-DeploymentUrl] <String>
[-CertificateThumbprint] <String>
[-ApplicationId] <String>
[-AadTenantId] <String>
[<CommonParameters>]
Description
The Add-RdsAccount cmdlet adds an authenticated account to use for Windows Virtual Desktop cmdlet requests. Upon completion, the context is automatically set to use the "Default Tenant Group" as the tenant group name. You can run the Set-RdsContext cmdlet to change the context.
Examples
Example 1: Connect to Windows Virtual Desktop through an interactive login
PS C:\> Add-RdsAccount -DeploymentUrl "https://rdbroker.wvd.microsoft.com"
DeploymentUrl TenantGroupName UserName
------------- --------------- --------
https://rdbroker.wvd.microsoft.com Default Tenant Group admin@contoso.com
This command connects to a work or school account. To run Windows Virtual Desktop cmdlets with this account, you must provide organizational ID credentials at the prompt. If multi-factor authentication is enabled for your credentials, you must log in using the interactive option or use service principal authentication.
Example 2: Connect to Windows Virtual Desktop using organizational ID credentials
`powershell
PS C:\> $Credential = Get-Credential
PS C:\> Add-RdsAccount -DeploymentUrl "https://rdbroker.wvd.microsoft.com"
DeploymentUrl TenantGroupName UserName
------------- --------------- --------
https://rdbroker.wvd.microsoft.com Default Tenant Group admin@contoso.com
` The first command will prompt for user credentials (username and password), and then stores them in the $Credential variable. The second command connects to the Azure AD account using the credentials stored in $Credential. This account authenticates with Windows Virtual Desktop using organizational ID credentials. If multi-factor authentication is enabled for your credentials, you must log in using the interactive option or use service principal authentication.
Example 3: Connect to Windows Virtual Desktop using a service principal account with password credentials
`powershell
PS C:\> $Credential = Get-Credential
PS C:\> Add-RdsAccount -DeploymentUrl "https://rdbroker.wvd.microsoft.com" -ServicePrincipal -AadTenantId "xxxx-xxxx-xxxx-xxxx"
DeploymentUrl TenantGroupName UserName
------------- --------------- --------
https://rdbroker.wvd.microsoft.com Default Tenant Group admin@contoso.com
` The first command gets the service principal credentials (Application ID and service principal secret), and then stores them in the $Credential variable. The second command connects to the Azure AD account using the service principal credentials stored in $Credential for the specified Tenant. The ServicePrincipal switch parameter indicates that the account authenticates as a service principal.
Example 4: Connect to Windows Virtual Desktop using a service principal account with certificate credentials
# For more information on creating a self-signed certificate
# and giving it proper permissions, please see the following:
# https://learn.microsoft.com/azure/active-directory/develop/howto-authenticate-service-principal-powershell
PS C:\> $Thumbprint = "0SZTNJ34TCCMUJ5MJZGR8XQD3S0RVHJBA33Z8ZXV"
PS C:\> $TenantId = "4cd76576-b611-43d0-8f2b-adcb139531bf"
PS C:\> $ApplicationId = "3794a65a-e4e4-493d-ac1d-f04308d712dd"
PS C:\> Add-RdsAccount -DeploymentUrl "https://rdbroker.wvd.microsoft.com" -CertificateThumbprint $Thumbprint -ApplicationId $ApplicationId -AadTenantId $TenantId
DeploymentUrl TenantGroupName UserName
------------- --------------- --------
https://rdbroker.wvd.microsoft.com Default Tenant Group admin@contoso.com
`
Parameters
-AadTenantId
Specifies the Azure AD tenant ID from which the service principal is a member.
Type: | String |
Aliases: | TenantId |
Position: | 3 |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ApplicationId
The application ID of the service principal to authenticate to Windows Virtual Desktop.
Type: | String |
Position: | 2 |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-CertificateThumbprint
The thumbprint for the installed certificate to authenticate as the service principal to Windows Virtual Desktop.
Type: | String |
Position: | 1 |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Credential
Specifies a PSCredential object. For more information about the PSCredential object, type Get-Help Get-Credential. The PSCredential object provides the user ID and password for organizational ID credentials, or the application ID and secret for service principal credentials.
Type: | PSCredential |
Position: | 1 |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DeploymentUrl
The Universal Resource Locator (URL) string pointing to the Windows Virtual Desktop management site.
Type: | String |
Position: | 0 |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ServicePrincipal
Switch indicating that this account authenticates by providing service principal credentials.
Type: | SwitchParameter |
Position: | 2 |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
None
Outputs
Microsoft.RDInfra.RDManagementData.RdMgmtContext