Create an application group, a workspace, and assign users in Azure Virtual Desktop
Article
13 minutes to read
This article shows you how to create an application group and a workspace, then add the application group to a workspace and assign users by using the Azure portal, Azure CLI, or Azure PowerShell. Before you complete these steps, you should have already created a host pool.
An existing host pool. See Create a host pool to find out how to create one.
The account must have the following built-in role-based access control (RBAC) roles on the resource group, or on a subscription to create the resources.
To assign users to the application group, you'll also need Microsoft.Authorization/roleAssignments/write permissions on the application group. Built-in RBAC roles that include this permission are User Access Administrator and Owner.
On the Review + create tab, ensure validation passes and review the information that will be used during deployment.
Select Create to create the application group.
Once the application group has been created, select Go to resource to go to the overview of your new application group, then select Properties to view its properties.
Here's how to create an application group using the desktopvirtualization extension for Azure CLI.
Important
In the following examples, you'll need to change the <placeholder> values for your own.
Launch the Azure Cloud Shell in the Azure portal with the Bash terminal type, or run Azure CLI on your local device.
To create a RemoteApp application group in the Azure region UK South, run the following command. You can only create a RemoteApp application group with a pooled host pool.
To create a RemoteApp application group in the Azure region UK South, run the following command. You can only create a RemoteApp application group with a pooled host pool.
Use the az desktopvirtualization workspace create command with the following example to create a workspace. More parameters are available, such as to register existing application groups. For more information, see the az desktopvirtualization workspace Azure CLI reference.
az desktopvirtualization workspace create --name <Name> --resource-group <ResourceGroupName>
You can view the properties of your new workspace by running the following command:
az desktopvirtualization workspace show --name <Name> --resource-group <ResourceGroupName>
Use the New-AzWvdWorkspace cmdlet with the following example to create a workspace. More parameters are available, such as to register existing application groups. For more information, see the New-AzWvdWorkspace PowerShell reference.
Use the az desktopvirtualization workspace update command with the following example to add an application group to a workspace:
# Get the resource ID of the application group you want to add to the workspace
appGroupPath=$(az desktopvirtualization applicationgroup show \
--name <Name> \
--resource-group <ResourceGroupName> \
--query [id] \
--output tsv)
# Add the application group to the workspace
az desktopvirtualization workspace update \
--name <Name> \
--resource-group <ResourceGroupName> \
--application-group-references $appGroupPath
You can view the properties of your workspace by running the following command. The key applicationGroupReferences contains an array of the application groups added to the workspace.
az desktopvirtualization applicationgroup show \
--name <Name> \
--resource-group <ResourceGroupName>
Here's how to add an application group to a workspace using the Az.DesktopVirtualization PowerShell module.
Important
In the following examples, you'll need to change the <placeholder> values for your own.
Launch the Azure Cloud Shell in the Azure portal with the PowerShell terminal type, or run PowerShell on your local device.
Use the Update-AzWvdWorkspace cmdlet with the following example to add an application group to a workspace:
# Get the resource ID of the application group you want to add to the workspace
$appGroupPath = (Get-AzWvdApplicationGroup -Name <Name -ResourceGroupName <ResourceGroupName>).Id
# Add the application group to the workspace
Update-AzWvdWorkspace -Name <Name> -ResourceGroupName <ResourceGroupName> -ApplicationGroupReference $appGroupPath
You can view the properties of your workspace by running the following command. The key ApplicationGroupReference contains an array of the application groups added to the workspace.
Finally, to assign users or user groups to an application group, select the relevant tab for your scenario and follow the steps. We recommend you assign user groups to application groups to make ongoing management simpler.
Use the az role assignment create command with the following examples to assign users or user groups to an application group.
To assign users to the application group, run the following commands:
# Get the resource ID of the application group you want to add to the workspace
appGroupPath=$(az desktopvirtualization applicationgroup show \
--name <Name> \
--resource-group <ResourceGroupName> \
--query [id] \
--output tsv)
# Assign users to the application group
az role assignment create \
--assignee '<UserPrincipalName>' \
--role 'Desktop Virtualization User' \
--scope $appGroupPath
To assign user groups to the application group, run the following commands:
# Get the resource ID of the application group you want to add to the workspace
appGroupPath=$(az desktopvirtualization applicationgroup show \
--name <Name> \
--resource-group <ResourceGroupName> \
--query [id] \
--output tsv)
# Get the object ID of the user group you want to assign to the application group
userGroupId=$(az ad group show \
--group <UserGroupName> \
--query [id] \
--output tsv)
# Assign users to the application group
az role assignment create \
--assignee $userGroupId \
--role 'Desktop Virtualization User' \
--scope $appGroupPath
Here's how to assign users or user groups to an application group to a workspace using Az.Resources PowerShell module.
Important
In the following examples, you'll need to change the <placeholder> values for your own.
Launch the Azure Cloud Shell in the Azure portal with the PowerShell terminal type, or run PowerShell on your local device.
To assign user groups to the application group, run the following commands:
# Get the object ID of the user group you want to assign to the application group
$userGroupId = (Get-AzADGroup -DisplayName "<UserGroupName>").Id
# Assign users to the application group
$parameters = @{
ObjectId = $userGroupId
ResourceName = '<ApplicationGroupName>'
ResourceGroupName = '<ResourceGroupName>'
RoleDefinitionName = 'Desktop Virtualization User'
ResourceType = 'Microsoft.DesktopVirtualization/applicationGroups'
}
New-AzRoleAssignment @parameters
Next steps
Now that you've created an application group and a workspace, added the application group to a workspace and assigned users, you'll need to: