Skip to content

Commit 955d733

Browse files
Merge pull request #227455 from Heidilohr/work-friendly-sessions2
Creating alternate pull request with split info.
2 parents 46d617c + c49fdca commit 955d733

File tree

2 files changed

+85
-7
lines changed

2 files changed

+85
-7
lines changed

articles/virtual-desktop/configure-host-pool-personal-desktop-assignment-type.md

Lines changed: 84 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ title: Azure Virtual Desktop personal desktop assignment type - Azure
33
description: How to configure automatic or direct assignment for an Azure Virtual Desktop personal desktop host pool.
44
author: Heidilohr
55
ms.topic: how-to
6-
ms.date: 07/09/2020
6+
ms.date: 03/02/2023
77
ms.author: helohr
88
ms.custom: devx-track-azurepowershell
99
manager: femila
1010
---
11-
# Configure the personal desktop host pool assignment type
11+
# Configure personal desktop host pool assignment
1212

1313
>[!IMPORTANT]
1414
>This content applies to Azure Virtual Desktop with Azure Resource Manager Azure Virtual Desktop objects. If you're using Azure Virtual Desktop (classic) without Azure Resource Manager objects, see [this article](./virtual-desktop-fall-2019/configure-host-pool-personal-desktop-assignment-type-2019.md).
@@ -22,6 +22,18 @@ You can configure the assignment type of your personal desktop host pool to adju
2222

2323
This article assumes you've already downloaded and installed the Azure Virtual Desktop PowerShell module. If you haven't, follow the instructions in [Set up the PowerShell module](powershell-module.md).
2424

25+
### Define variables
26+
27+
The PowerShell commands listed in this article require defining the following variables:
28+
29+
```powershell
30+
#Define variables
31+
$subscriptionId = '00000000-0000-0000-0000-000000000000'
32+
$resourceGroupName = 'MyResourceGroupName'
33+
$hostPoolName = 'MyHostPoolName'
34+
$sessionHostName = 'SessionHostName'
35+
```
36+
2537
## Personal host pools overview
2638

2739
A personal host pool is a type of host pool that has personal desktops. Personal desktops have one-to-one mapping, which means a single user can only be assigned to a single personal desktop. Every time the user signs in, their user session is directed to their assigned personal desktop session host. This host pool type is ideal for customers with resource-intensive workloads because user experience and session performance will improve if there's only one session on the session host. Another benefit of this host pool type is that user activities, files, and settings persist on the virtual machine operating system (VM OS) disk after the user signs out.
@@ -83,10 +95,10 @@ To directly assign a user to a session host in the Azure portal:
8395
11. Select the user you want to assign the session host to from the list of available users.
8496
12. When you're done, select **Select**.
8597

86-
87-
## How to unassign a personal desktop
98+
## Unassign a personal desktop using the Azure portal
8899

89100
To unassign a personal desktop in the Azure portal:
101+
90102
1. Sign in to the [Azure portal](https://portal.azure.com).
91103
2. Enter **Azure Virtual Desktop** into the search bar.
92104
3. Under **Services**, select **Azure Virtual Desktop**.
@@ -103,7 +115,23 @@ To unassign a personal desktop in the Azure portal:
103115
104116
8. Select **Unassign** when prompted with the warning.
105117

106-
## How to reassign a personal desktop
118+
## Unassign a personal desktop using PowerShell
119+
120+
To unassign a personal desktop in PowerShell, run the following command:
121+
122+
```powershell
123+
$unassignDesktopParams = @{
124+
Path = "/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.DesktopVirtualization/hostPools/$hostPoolName/sessionHosts/$($sessionHostName)?api-version=2022-02-10-preview&force=true"
125+
Payload = @{
126+
properties = @{
127+
assignedUser = ''
128+
}} | ConvertTo-Json
129+
Method = 'PATCH'
130+
}
131+
Invoke-AzRestMethod @unassignDesktopParams
132+
```
133+
134+
## Reassign a personal desktop using the Azure portal
107135

108136
To reassign a personal desktop in the Azure portal:
109137
1. Sign in to the [Azure portal](https://portal.azure.com).
@@ -123,6 +151,57 @@ To reassign a personal desktop in the Azure portal:
123151
8. Select the user you want to assign the session host to from the list of available users.
124152
9. When you're done, select **Select**.
125153

154+
## Reassign a personal desktop using PowerShell
155+
156+
To reassign a personal desktop, run this command:
157+
158+
```powershell
159+
$reassignDesktopParams = @{
160+
Path = "/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.DesktopVirtualization/hostPools/$hostPoolName/sessionHosts/$($sessionHostName)?api-version=2022-02-10-preview&force=true"
161+
Payload = @{
162+
properties = @{
163+
assigneduser = 'UPN of new user'
164+
}} | ConvertTo-Json
165+
Method = 'PATCH'
166+
}
167+
Invoke-AzRestMethod @reassignDesktopParams
168+
```
169+
170+
## Give session hosts within a personal host pools a friendly name
171+
172+
You can give personal desktops you create *friendly names* to help users distinguish them in their feeds.
173+
174+
To give a host pool a friendly name, run the following command in PowerShell:
175+
176+
```powershell
177+
$body = '{ "properties": {
178+
"friendlyName": "friendlyName"
179+
} }'
180+
181+
$parameters = @{
182+
Method = 'Patch'
183+
Path = "/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.DesktopVirtualization/hostPools/$hostPoolName?api-version=2022-02-10-preview"
184+
Payload = $body
185+
}
186+
187+
Invoke-AzRestMethod @parameters
188+
```
189+
190+
>[!NOTE]
191+
>You can also set the friendly name by using a [REST API](/rest/api/desktopvirtualization/session-hosts/update?tabs=HTTP).
192+
193+
### Get the session host friendly name
194+
195+
To get the session host friendly name, run this command in PowerShell
196+
197+
```powershell
198+
$getParams = @{
199+
Path = '/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.DesktopVirtualization/hostPools/$hostPoolName/sessionHosts/$($sessionHostName)?api-version=2022-02-10-preview'
200+
Method = 'GET'
201+
}
202+
Invoke-AzRestMethod @getParams
203+
```
204+
126205
## Next steps
127206

128207
Now that you've configured the personal desktop assignment type, you can sign in to an Azure Virtual Desktop client to test it as part of a user session. These articles will show you how to connect to a session using the client of your choice:

articles/virtual-desktop/create-host-pools-powershell.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ To successfully domain-join, do the following things on each virtual machine:
144144
145145
## Register the virtual machines to the Azure Virtual Desktop host pool
146146

147-
Registering the virtual machines to a Azure Virtual Desktop host pool is as simple as installing the Azure Virtual Desktop agents.
147+
Registering the virtual machines to an Azure Virtual Desktop host pool is as simple as installing the Azure Virtual Desktop agents.
148148

149149
To register the Azure Virtual Desktop agents, do the following on each virtual machine:
150150

@@ -184,7 +184,6 @@ To update the agent:
184184

185185
6. Once you've uninstalled these items, this should remove all associations with the old host pool. If you want to reregister this host to the service, follow the instructions in [Register the virtual machines to the Azure Virtual Desktop host pool](create-host-pools-powershell.md#register-the-virtual-machines-to-the-azure-virtual-desktop-host-pool).
186186

187-
188187
## Next steps
189188

190189
Now that you've made a host pool, you can populate it with RemoteApps. To learn more about how to manage apps in Azure Virtual Desktop, see the Manage app groups tutorial.

0 commit comments

Comments
 (0)