activities
latest
false
IT Automation Activities
Last updated Jun 11, 2024

Create a New Personal Virtual Desktop for a User

The example below explains how to use Azure WVD activities to automate the creation of a new virtual desktop for a specific user. It presents activities such as Windows Virtual Desktop Scope, Create Host Pool, Get Application Group, Assign Users and Groups to Application Group, Add Virtual Machine to Host Pool, Update Session Host.

The workflow consists of the following actions:

  1. Connect to Azure.
  2. Create a new Personal host pool.
  3. Assign the user account to the default desktop application group of the host pool.
  4. Create a new session host by adding an existing Virtual Machine (VM) to the host pool.
  5. Assign the user to the session host.
  6. Send an email to the user with details about how to access the virtual desktop.

1. Connect to Azure

  • Add the Windows Virtual Desktop Scope activity to connect to Azure and provide a scope for Azure WVD activities.
  • Set a value for ClientID, ClientSecret (SecureString), Environment, SubscriptionID, and TenantID parameters.


2. Create a new Personal host pool

  • Add the Create Host Pool activity to create a host pool of type Personal. In this case, each user is allocated a desktop. This activity creates a default desktop application group.
  • Set Type to Personal.
  • Set PersonalDesktopAssignmentType to Direct. In this case, you must later assign the user to both the host pool’s desktop application group and to a specific session host before the user can connect to the personal desktop.
  • Set a value for the mandatory parameters Name, ResourceGroupName, and Region.
  • To register the host pool's default desktop application group with the specified workspace, set a value for the Workspace parameter.

    Note: A desktop application group must be associated with a workspace in order for users to see the desktops published to them.
  • (Optional) Provide a value for FriendlyName, Description, and Tags parameters.



3. Assign the user account to an application group

  • Add the Get Application Group activity to retrieve the WVDApplicationGroup object associated with the host pool's default desktop application group.
  • Set hostPoolInfo.DefaultDesktopApplicationGroupName to ApplicationGroupName.
  • Set hostPoolInfo.ResourceGroupName to ResourceGroupName.


  • Assign the user to the desktop application group by using the Assign Users and Groups to Application Group activity.

    Important:

    In order to use the Assign Users and Groups to Application Group activity, the client (application) specified in the Windows Virtual Desktop Scope activity (ClientID property) should have the permissions described here.

    For example, you can assign the Owner role to your client (application) for the resource group to which the application group belongs by following the steps described here.

  • Specify the user by setting UsersAndGroupsIds to {"user-object-id"}, where user-object-id represents the Object ID of the user account in Azure AD. This value can be obtained from Azure portal or using the Get User activity of the UiPath.AzureActiveDirectory.Activities package.


4. Create a new session host

  • Add a VM to the host pool using the Add Virtual Machine to Host Pool activity.
  • The VM can be created in the Azure portal or using the Create VM activity of the UiPath.Azure.Activities package.
  • Specify the Azure VM by setting a value for the parameters in the Virtual Machine category, namely Name and ResourceGroupName.

    Tip: The VM’s status needs to be set to Running when using the Add Virtual Machine to Host Pool activity.
  • Specify the credentials of a domain user account that will be used to join the VM to the domain. If DomainToJoin is not set, the VM will be joined to the domain matching the suffix of the user principal name provided in the DomainUsername parameter.
  • The Add Virtual Machine to Host Pool activity runs for a long time, so it is recommended to set a Timeout of 1200 or longer to be sure it will complete (in case you want to wait for completion to perform other operations on the resulted session host).



5. Assign the user to the session host

  • Once the session host has been created, assign the user to the session host using the Update Session Host activity.



    Note: This step is required only when the host pool to which the session host belongs has the Direct assignment option enabled.

6. Send an email to the user

  • Inform the user about the new personal virtual desktop by sending an email using the Send Outlook Mail Message activity.



  • The email contains information about how to access the virtual desktop.



Run the process. The robot uses the Azure Windows Virtual Desktop activities to automate your Azure WVD tasks.

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.