@@ -83,10 +83,10 @@ To directly assign a user to a session host in the Azure portal:
83
83
11 . Select the user you want to assign the session host to from the list of available users.
84
84
12 . When you're done, select ** Select** .
85
85
86
-
87
- ## How to unassign a personal desktop
86
+ ## How to unassign a personal desktop using the Azure portal
88
87
89
88
To unassign a personal desktop in the Azure portal:
89
+
90
90
1 . Sign in to the [ Azure portal] ( https://portal.azure.com ) .
91
91
2 . Enter ** Azure Virtual Desktop** into the search bar.
92
92
3 . Under ** Services** , select ** Azure Virtual Desktop** .
@@ -103,7 +103,22 @@ To unassign a personal desktop in the Azure portal:
103
103
104
104
8 . Select ** Unassign** when prompted with the warning.
105
105
106
- ## How to reassign a personal desktop
106
+ ## How to unassign a personal desktop using PowerShell
107
+
108
+ To unassign a personal desktop in PowerShell, run the following command:
109
+
110
+ ``` powershell
111
+ $patchParams = @{
112
+ Path = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}?api-version=2022-02-10-preview&force=true'
113
+ Payload = '{ "properties": {
114
+ "assignedUser": ""
115
+ } }'
116
+ Method = 'PATCH'
117
+ }
118
+ Invoke-AzRestMethod @patchParams
119
+ ```
120
+
121
+ ## How to reassign a personal desktop using the Azure portal
107
122
108
123
To reassign a personal desktop in the Azure portal:
109
124
1 . Sign in to the [ Azure portal] ( https://portal.azure.com ) .
@@ -123,6 +138,21 @@ To reassign a personal desktop in the Azure portal:
123
138
8 . Select the user you want to assign the session host to from the list of available users.
124
139
9 . When you're done, select ** Select** .
125
140
141
+ ## How to reassign a personal desktop using PowerShell
142
+
143
+ To reassign a personal desktop, run this command:
144
+
145
+ ``` powershell
146
+ $patchParams = @{
147
+ Path = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}?api-version=2022-02-10-preview&force=true'
148
+ Payload = '{ "properties": {
149
+ "assignedUser": "{UPN of new user}"
150
+ } }'
151
+ Method = 'PATCH'
152
+ }
153
+ Invoke-AzRestMethod @patchParams
154
+ ```
155
+
126
156
## Give session hosts within a personal host pools a friendly name
127
157
128
158
You can give personal desktops you create * friendly names* to help users distinguish them in their feeds.
@@ -150,6 +180,33 @@ Invoke-AzRestMethod @parameters
150
180
> [ !NOTE]
151
181
> You can also set the friendly name by using a [ REST API] ( /rest/api/desktopvirtualization/session-hosts/update?tabs=HTTP ) .
152
182
183
+ ## Assign the session host friendly name
184
+
185
+ To assign the session host friendly name, run this command in PowerShell:
186
+
187
+ ``` powershell
188
+ $patchParams = @{
189
+ Path = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}?api-version=2022-02-10-preview'
190
+ Payload = '{ "properties": {
191
+ "friendlyName": "Friendly Name"
192
+ } }'
193
+ Method = 'PATCH'
194
+ }
195
+ Invoke-AzRestMethod @patchParams
196
+ ```
197
+
198
+ ### Get the session host friendly name
199
+
200
+ To get the session host friendly name, run this command in PowerShell
201
+
202
+ ``` powershell
203
+ $getParams = @{
204
+ Path = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}?api-version=2022-02-10-preview'
205
+ Method = 'GET'
206
+ }
207
+ Invoke-AzRestMethod @getParams
208
+ ```
209
+
153
210
## Next steps
154
211
155
212
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:
0 commit comments