@@ -28,10 +28,10 @@ The PowerShell commands listed in this article require defining the following va
28
28
29
29
``` powershell
30
30
#Define variables
31
- $subscriptionId = ' 00000000-0000-0000-0000-000000000000'
32
- $resourceGroupName = ' MyResourceGroupName'
33
- $hostPoolName = ' MyHostPoolName'
34
- $sessionHostName = ' SessionHostName'
31
+ $subscriptionId = < 00000000-0000-0000-0000-000000000000>
32
+ $resourceGroupName = < MyResourceGroupName>
33
+ $hostPoolName = < MyHostPoolName>
34
+ $sessionHostName = < SessionHostName>
35
35
```
36
36
37
37
## Personal host pools overview
@@ -49,13 +49,13 @@ To automatically assign users, first assign them to the personal desktop host po
49
49
To configure a host pool to automatically assign users to VMs, run the following PowerShell cmdlet:
50
50
51
51
``` powershell
52
- Update-AzWvdHostPool -ResourceGroupName <resourcegroupname> -Name <hostpoolname> -PersonalDesktopAssignmentType Automatic
52
+ Update-AzWvdHostPool -ResourceGroupName $resourceGroupName -Name $hostPoolName -PersonalDesktopAssignmentType Automatic
53
53
```
54
54
55
55
To assign a user to the personal desktop host pool, run the following PowerShell cmdlet:
56
56
57
57
``` powershell
58
- New-AzRoleAssignment -SignInName <userupn> -RoleDefinitionName "Desktop Virtualization User" -ResourceName <appgroupname> -ResourceGroupName <resourcegroupname> -ResourceType 'Microsoft.DesktopVirtualization/applicationGroups'
58
+ New-AzRoleAssignment -SignInName <userupn> -RoleDefinitionName "Desktop Virtualization User" -ResourceName <appgroupname> -ResourceGroupName $resourceGroupName -ResourceType 'Microsoft.DesktopVirtualization/applicationGroups'
59
59
```
60
60
61
61
## Configure direct assignment
@@ -65,19 +65,19 @@ Unlike automatic assignment, when you use direct assignment, you must assign the
65
65
To configure a host pool to require direct assignment of users to session hosts, run the following PowerShell cmdlet:
66
66
67
67
``` powershell
68
- Update-AzWvdHostPool -ResourceGroupName <resourcegroupname> -Name <hostpoolname> -PersonalDesktopAssignmentType Direct
68
+ Update-AzWvdHostPool -ResourceGroupName $resourceGroupName -Name $hostPoolName -PersonalDesktopAssignmentType Direct
69
69
```
70
70
71
71
To assign a user to the personal desktop host pool, run the following PowerShell cmdlet:
72
72
73
73
``` powershell
74
- New-AzRoleAssignment -SignInName <userupn> -RoleDefinitionName "Desktop Virtualization User" -ResourceName <appgroupname> -ResourceGroupName <resourcegroupname> -ResourceType 'Microsoft.DesktopVirtualization/applicationGroups'
74
+ New-AzRoleAssignment -SignInName <userupn> -RoleDefinitionName "Desktop Virtualization User" -ResourceName <appgroupname> -ResourceGroupName $resourceGroupName -ResourceType 'Microsoft.DesktopVirtualization/applicationGroups'
75
75
```
76
76
77
77
To assign a user to a specific session host, run the following PowerShell cmdlet:
78
78
79
79
``` powershell
80
- Update-AzWvdSessionHost -HostPoolName <hostpoolname> -Name <sessionhostname> -ResourceGroupName <resourcegroupname> -AssignedUser <userupn>
80
+ Update-AzWvdSessionHost -HostPoolName $hostPoolName -Name $sessionHostName -ResourceGroupName $resourceGroupName -AssignedUser <userupn>
81
81
```
82
82
83
83
To directly assign a user to a session host in the Azure portal:
@@ -153,14 +153,20 @@ To reassign a personal desktop in the Azure portal:
153
153
154
154
## Reassign a personal desktop using PowerShell
155
155
156
- To reassign a personal desktop, run this command with the placeholder values replaced with values relevant to your deployment:
156
+ Before you start, first define the ` $reassignUserUpn ` variable by running the following command:
157
+
158
+ ``` powershell
159
+ $reassignUserUpn = <UPN of user you are reassigning the desktop to>
160
+ ```
161
+
162
+ To reassign a personal desktop, run this command:
157
163
158
164
``` powershell
159
165
$reassignDesktopParams = @{
160
166
Path = "/subscriptions/$subscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.DesktopVirtualization/hostPools/$hostPoolName/sessionHosts/$($sessionHostName)?api-version=2022-02-10-preview&force=true"
161
167
Payload = @{
162
168
properties = @{
163
- assigneduser = 'UPN of new user'
169
+ assigneduser = $reassignUserUpn
164
170
}} | ConvertTo-Json
165
171
Method = 'PATCH'
166
172
}
@@ -171,7 +177,7 @@ Invoke-AzRestMethod @reassignDesktopParams
171
177
172
178
You can give personal desktops you create * friendly names* to help users distinguish them in their feeds.
173
179
174
- To give a session host a friendly name, run the following command in PowerShell with the placeholder values replaced with values relevant to your deployment :
180
+ To give a session host a friendly name, run the following command in PowerShell:
175
181
176
182
``` powershell
177
183
$body = '{ "properties": {
@@ -192,7 +198,7 @@ Invoke-AzRestMethod @parameters
192
198
193
199
### Get the session host friendly name
194
200
195
- To get the session host friendly name, run this command in PowerShell with the placeholder values replaced with values relevant to your deployment :
201
+ To get the session host friendly name, run this command in PowerShell:
196
202
197
203
``` powershell
198
204
$getParams = @{
0 commit comments