Skip to content

Commit f080737

Browse files
Merge pull request #279432 from dknappettmsft/charleskorb-patch-1
AVD update app attach PowerShell after parameters removed
2 parents d3b97c2 + cb326c0 commit f080737

File tree

1 file changed

+44
-42
lines changed

1 file changed

+44
-42
lines changed

articles/virtual-desktop/app-attach-setup.md

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,13 @@ Here's how to add an MSIX or Appx image as an app attach package using the [Az.D
207207
$app = Import-AzWvdAppAttachPackageInfo @parameters
208208
```
209209

210-
4. Check you only have one object in the application properties by running the following command:
210+
4. Check you only have one object in the application properties by running the following commands:
211211

212212
```azurepowershell
213213
$app | FL *
214214
```
215215

216-
*Optional*: if you have more than one object in the output, for example an x64 and an x86 version of the same application, you can use the parameter `PackageFullName` to specify which application you want to add by running the following command:
216+
*Optional*: if you have more than one object in the output, for example an x64 and an x86 version of the same application, you can use the parameter `PackageFullName` to specify which application you want to add by running the following commands:
217217

218218
```azurepowershell
219219
# Specify the package full name
@@ -247,7 +247,7 @@ Here's how to add an MSIX or Appx image as an app attach package using the [Az.D
247247

248248
There's no output when the package is added successfully.
249249

250-
6. You can verify the package is added by running the following command:
250+
6. You can verify the package is added by running the following commands:
251251

252252
```azurepowershell
253253
$parameters = @{
@@ -313,7 +313,7 @@ Here's how to assign an application package to host pools as well as groups and
313313
> [!IMPORTANT]
314314
> The host pool IDs you specify each time will overwrite any existing assignments. If you want to add or remove a host pool to or from an existing list of host pools, you need to specify all the host pools you want to assign the application to.
315315
316-
1. In the same PowerShell session, get the resource IDs of the host pool(s) you want to assign the application to and add them to an array to by running the following command:
316+
1. In the same PowerShell session, get the resource IDs of the host pool(s) you want to assign the application to and add them to an array to by running the following commands:
317317

318318
```azurepowershell
319319
# Add a comma-separated list of host pools names
@@ -326,7 +326,7 @@ Here's how to assign an application package to host pools as well as groups and
326326
}
327327
```
328328

329-
1. Once you have the resource IDs of the host pool(s), you can assign the application package to them by running the following command:
329+
1. Once you have the resource IDs of the host pool(s), you can assign the application package to them by running the following commands:
330330

331331
```azurepowershell
332332
$parameters = @{
@@ -339,7 +339,7 @@ Here's how to assign an application package to host pools as well as groups and
339339
Update-AzWvdAppAttachPackage @parameters
340340
```
341341

342-
1. To unassign the application package from all host pools, you can pass an empty array of host pools by running the following command:
342+
1. To unassign the application package from all host pools, you can pass an empty array of host pools by running the following commands:
343343

344344
```azurepowershell
345345
$parameters = @{
@@ -358,7 +358,7 @@ Here's how to assign an application to groups and users using the [Az.DesktopVir
358358

359359
1. Get the object ID of the groups or users you want to add to or remove from the application and add them to an array to by using one of the following examples. We recommend you assign applications to groups.
360360

361-
1. Get the object ID of the group or groups and add them to an array to by running the following command. This example uses the group display name:
361+
1. Get the object ID of the group or groups and add them to an array to by running the following commands. This example uses the group display name:
362362

363363
```azurepowershell
364364
# Add a comma-separated list of group names
@@ -375,7 +375,7 @@ Here's how to assign an application to groups and users using the [Az.DesktopVir
375375
}
376376
```
377377
378-
1. Get the object ID of the user(s) and add them to an array to by running the following command. This example uses the user principal name (UPN):
378+
1. Get the object ID of the user(s) and add them to an array to by running the following commands. This example uses the user principal name (UPN):
379379
380380
```azurepowershell
381381
# Add a comma-separated list of user principal names
@@ -385,39 +385,43 @@ Here's how to assign an application to groups and users using the [Az.DesktopVir
385385
Connect-MgGraph -Scopes 'User.Read.All'
386386
387387
# Create an array and add the ID for each user
388-
$Ids = @()
388+
$userIds = @()
389389
390390
foreach ($user in $users) {
391-
$Ids += (Get-MgUser | ? UserPrincipalName -eq $user).Id
391+
$userIds += (Get-MgUser | ? UserPrincipalName -eq $user).Id
392392
}
393393
```
394394
395-
1. Once you have the object IDs of the users or groups, you can add them to or remove them from the application by using one of the following examples, which assigns the [Desktop Virtualization User](rbac.md#desktop-virtualization-user) RBAC role. You can also assign the Desktop Virtualization User RBAC role to your groups or users using the [New-AzRoleAssignment](../role-based-access-control/role-assignments-powershell.md) cmdlet.
395+
1. Once you have the object IDs of the users or groups, you can add them to or remove them from the application by using one of the following examples, which assigns the [Desktop Virtualization User](rbac.md#desktop-virtualization-user) RBAC role.
396396
397-
1. To add the groups or users to the application, run the following command:
397+
1. To add the groups or users to the application, run the following commands:
398398
399399
```azurepowershell
400400
$parameters = @{
401-
Name = '<AppName>'
402-
ResourceGroupName = '<ResourceGroupName>'
403-
Location = '<AzureRegion>'
404-
PermissionsToAdd = $Ids
401+
Name = '<AppName>'
402+
ResourceGroupName = '<ResourceGroupName>'
403+
}
404+
405+
$appAttachPackage = Get-AzWvdAppAttachPackage @parameters
406+
407+
foreach ($userId in $userIds) {
408+
New-AzRoleAssignment -ObjectId $userId -RoleDefinitionName "Desktop Virtualization User" -Scope $appAttachPackage.Id
405409
}
406-
407-
Update-AzWvdAppAttachPackage @parameters
408410
```
409411
410-
1. To remove the groups or users to the application, run the following command:
412+
1. To remove the groups or users to the application, run the following commands:
411413
412414
```azurepowershell
413415
$parameters = @{
414-
Name = '<AppName>'
415-
ResourceGroupName = '<ResourceGroupName>'
416-
Location = '<AzureRegion>'
417-
PermissionsToRemove = $objectIds
416+
Name = '<AppName>'
417+
ResourceGroupName = '<ResourceGroupName>'
418+
}
419+
420+
$appAttachPackage = Get-AzWvdAppAttachPackage @parameters
421+
422+
foreach ($userId in $userIds) {
423+
Remove-AzRoleAssignment -ObjectId $userId -RoleDefinitionName "Desktop Virtualization User" -Scope $appAttachPackage.Id
418424
}
419-
420-
Update-AzWvdAppAttachPackage @parameters
421425
```
422426
423427
---
@@ -451,8 +455,7 @@ Here's how to change a package's registration type and state using the [Az.Deskt
451455
452456
```azurepowershell
453457
$parameters = @{
454-
FullName = '<FullName>'
455-
HostPoolName = '<HostPoolName>'
458+
Name = '<Name>'
456459
ResourceGroupName = '<ResourceGroupName>'
457460
Location = '<AzureRegion>'
458461
IsRegularRegistration = $true
@@ -466,7 +469,6 @@ Here's how to change a package's registration type and state using the [Az.Deskt
466469
```azurepowershell
467470
$parameters = @{
468471
Name = '<Name>'
469-
HostPoolName = '<HostPoolName>'
470472
ResourceGroupName = '<ResourceGroupName>'
471473
Location = '<AzureRegion>'
472474
IsActive = $true
@@ -516,7 +518,7 @@ Here's how to add an application from the package you added in this article to a
516518
517519
Here's how to add an application from the package you added in this article to a RemoteApp application group using the [Az.DesktopVirtualization](/powershell/module/az.desktopvirtualization/) PowerShell module.
518520
519-
1. In the same PowerShell session, if there are multiple applications in the package, you need to get the application ID of the application you want to add from the package by running the following command:
521+
1. In the same PowerShell session, if there are multiple applications in the package, you need to get the application ID of the application you want to add from the package by running the following commands:
520522
521523
```azurepowershell
522524
Write-Host "These are the application IDs available in the package. Many packages only contain one application." -ForegroundColor Yellow
@@ -539,7 +541,7 @@ Here's how to add an application from the package you added in this article to a
539541
New-AzWvdApplication @parameters
540542
```
541543

542-
1. Verify the list of applications in the application group by running the following command:
544+
1. Verify the list of applications in the application group by running the following commands:
543545

544546
```azurepowershell
545547
$parameters = @{
@@ -584,7 +586,7 @@ Here's how to update an existing package using the Azure portal:
584586

585587
Here's how to update an existing package using the [Az.DesktopVirtualization](/powershell/module/az.desktopvirtualization/) PowerShell module.
586588

587-
1. In the same PowerShell session, get the properties of the updated application and store them in a variable by running the following command:
589+
1. In the same PowerShell session, get the properties of the updated application and store them in a variable by running the following commands:
588590

589591
```azurepowershell
590592
# Get the properties of the application
@@ -597,13 +599,13 @@ Here's how to update an existing package using the [Az.DesktopVirtualization](/p
597599
$app = Import-AzWvdAppAttachPackageInfo @parameters
598600
```
599601

600-
1. Check you only have one object in the application properties by running the following command:
602+
1. Check you only have one object in the application properties by running the following commands:
601603

602604
```azurepowershell
603605
$app | FL *
604606
```
605607

606-
If you have more than one object in the output, for example an x64 and an x86 version of the same application, you can use the parameter `PackageFullName` to specify which one you want to add by running the following command:
608+
If you have more than one object in the output, for example an x64 and an x86 version of the same application, you can use the parameter `PackageFullName` to specify which one you want to add by running the following commands:
607609

608610
```azurepowershell
609611
# Specify the package full name
@@ -707,7 +709,7 @@ Here's how to add an MSIX package using the [Az.DesktopVirtualization](/powershe
707709
708710
[!INCLUDE [include-cloud-shell-local-powershell](includes/include-cloud-shell-local-powershell.md)]
709711

710-
2. Get the properties of the application in the MSIX image you want to add and store them in a variable by running the following command:
712+
2. Get the properties of the application in the MSIX image you want to add and store them in a variable by running the following commands:
711713

712714
```azurepowershell
713715
# Get the properties of the MSIX image
@@ -728,13 +730,13 @@ Here's how to add an MSIX package using the [Az.DesktopVirtualization](/powershe
728730
hp01/expandmsiximage
729731
```
730732

731-
3. Check you only have one object in the application properties by running the following command:
733+
3. Check you only have one object in the application properties by running the following commands:
732734

733735
```azurepowershell
734736
$app | FL *
735737
```
736738

737-
If you have more than one object in the output, for example an x64 and an x86 version of the same application, you can use the parameter `PackageFullName` to specify which one you want to add by running the following command:
739+
If you have more than one object in the output, for example an x64 and an x86 version of the same application, you can use the parameter `PackageFullName` to specify which one you want to add by running the following commands:
738740

739741
```azurepowershell
740742
# Specify the package full name
@@ -767,7 +769,7 @@ Here's how to add an MSIX package using the [Az.DesktopVirtualization](/powershe
767769

768770
There's no output when the MSIX package is added successfully.
769771

770-
5. You can verify the MSIX package is added by running the following command:
772+
5. You can verify the MSIX package is added by running the following commands:
771773

772774
```azurepowershell
773775
$parameters = @{
@@ -827,7 +829,7 @@ Here's how to change a package's registration type and state using the Azure por
827829

828830
Here's how to change a package's registration type and state using the [Az.DesktopVirtualization](/powershell/module/az.desktopvirtualization/) PowerShell module.
829831

830-
1. In the same PowerShell session, get a list of MSIX packages on a host pool and their current registration type and state by running the following command:
832+
1. In the same PowerShell session, get a list of MSIX packages on a host pool and their current registration type and state by running the following commands:
831833

832834
```azurepowershell
833835
$parameters = @{
@@ -945,7 +947,7 @@ Here's how to add MSIX applications to an application group using the [Az.Deskto
945947
New-AzWvdApplication @parameters
946948
```
947949
948-
1. To add an MSIX application to a RemoteApp application group, if there are multiple applications in the package, you need to get the application ID of the application you want to add from the package by running the following command:
950+
1. To add an MSIX application to a RemoteApp application group, if there are multiple applications in the package, you need to get the application ID of the application you want to add from the package by running the following commands:
949951
950952
```azurepowershell
951953
Write-Host "These are the application IDs available in the package. Many packages only contain one application." -ForegroundColor Yellow
@@ -968,7 +970,7 @@ Here's how to add MSIX applications to an application group using the [Az.Deskto
968970
New-AzWvdApplication @parameters
969971
```
970972
971-
Verify the list of applications in the application group by running the following command:
973+
Verify the list of applications in the application group by running the following commands:
972974
973975
```azurepowershell
974976
$parameters = @{
@@ -1002,7 +1004,7 @@ Here's how to remove an MSIX package from your host pool using the Azure portal:
10021004
10031005
Here's how to remove applications using the [Az.DesktopVirtualization](/powershell/module/az.desktopvirtualization/) PowerShell module.
10041006
1005-
1. In the same PowerShell session, get a list of MSIX packages on a host pool by running the following command:
1007+
1. In the same PowerShell session, get a list of MSIX packages on a host pool by running the following commands:
10061008
10071009
```azurepowershell
10081010
$parameters = @{
@@ -1021,7 +1023,7 @@ Here's how to remove applications using the [Az.DesktopVirtualization](/powershe
10211023
My App \\fileshare\Apps\MyApp\MyApp.cim hp01/MyApp_1.0.0.0_neutral__abcdef123ghij 1.0.0.0
10221024
```
10231025

1024-
1. Find the package you want to remove and use the value for the `Name` parameter, but remove the **host pool name** and `/` from the start. For example, `hp01/MyApp_1.0.0.0_neutral__abcdef123ghij` becomes `MyApp_1.0.0.0_neutral__abcdef123ghij`. Then remove the package by running the following command:
1026+
1. Find the package you want to remove and use the value for the `Name` parameter, but remove the **host pool name** and `/` from the start. For example, `hp01/MyApp_1.0.0.0_neutral__abcdef123ghij` becomes `MyApp_1.0.0.0_neutral__abcdef123ghij`. Then remove the package by running the following commands:
10251027

10261028
```azurepowershell
10271029
$parameters = @{

0 commit comments

Comments
 (0)