|
| 1 | +Invoke-LiveTestScenario -Name "Create a Windows virtual desktop" -Description "Test creating a Windows virtual desktop" -ScenarioScript ` |
| 2 | +{ |
| 3 | + param ($rg) |
| 4 | + |
| 5 | + $rgName = $rg.ResourceGroupName |
| 6 | + $location = "westus" |
| 7 | + $poolName = New-LiveTestResourceName |
| 8 | + $poolFriName = New-LiveTestRandomName -Option AllLetters |
| 9 | + $groupName = New-LiveTestResourceName |
| 10 | + $groupFriName = New-LiveTestRandomName -Option AllLetters |
| 11 | + $appName = New-LiveTestResourceName |
| 12 | + $appFriName = New-LiveTestRandomName -Option AllLetters |
| 13 | + |
| 14 | + $pool = New-AzWvdHostPool -ResourceGroupName $rgName -Name $poolName -Location $location -FriendlyName $poolFriName -HostPoolType 'Pooled' -LoadBalancerType 'DepthFirst' -PreferredAppGroupType 'RailApplications' -ExpirationTime (Get-Date).ToUniversalTime().AddDays(1) -MaxSessionLimit 5 |
| 15 | + New-AzWvdApplicationGroup -ResourceGroupName $rgName -Name $groupName -Location $location -FriendlyName $groupFriName -HostPoolArmPath $pool.Id -ApplicationGroupType 'RemoteApp' |
| 16 | + New-AzWvdApplication -ResourceGroupName $rgName -Name $appName -GroupName $groupName -FriendlyName $appFriName -FilePath "C:\Windows\System32\mspaint.exe" -IconIndex 0 -IconPath "C:\Windows\System32\mspaint.exe" -CommandLineSetting Allow -ShowInPortal:$true |
| 17 | + |
| 18 | + $actual = Get-AzWvdApplication -Name $appName -ResourceGroupName $rgName -GroupName $groupName |
| 19 | + Assert-NotNull $actual |
| 20 | + Assert-AreEqual "$groupName/$appName" $actual.Name |
| 21 | + Assert-AreEqual $appFriName $actual.FriendlyName |
| 22 | + Assert-True { $actual.FilePath -like "*mspaint*" } |
| 23 | +} |
| 24 | + |
| 25 | +Invoke-LiveTestScenario -Name "Update a Windows virtual desktop" -Description "Test updating an existing Windows virtual desktop" -ScenarioScript ` |
| 26 | +{ |
| 27 | + param ($rg) |
| 28 | + |
| 29 | + $rgName = $rg.ResourceGroupName |
| 30 | + $location = "westus" |
| 31 | + $poolName = New-LiveTestResourceName |
| 32 | + $poolFriName = New-LiveTestRandomName -Option AllLetters |
| 33 | + $groupName = New-LiveTestResourceName |
| 34 | + $groupFriName = New-LiveTestRandomName -Option AllLetters |
| 35 | + $appName = New-LiveTestResourceName |
| 36 | + $appFriName = New-LiveTestRandomName -Option AllLetters |
| 37 | + $appFriNameNew = New-LiveTestRandomName -Option AllLetters -MaxLength 9 |
| 38 | + |
| 39 | + $pool = New-AzWvdHostPool -ResourceGroupName $rgName -Name $poolName -Location $location -FriendlyName $poolFriName -HostPoolType 'Pooled' -LoadBalancerType 'DepthFirst' -PreferredAppGroupType 'RailApplications' -ExpirationTime (Get-Date).ToUniversalTime().AddDays(1) -MaxSessionLimit 5 |
| 40 | + New-AzWvdApplicationGroup -ResourceGroupName $rgName -Name $groupName -Location $location -FriendlyName $groupFriName -HostPoolArmPath $pool.Id -ApplicationGroupType 'RemoteApp' |
| 41 | + New-AzWvdApplication -ResourceGroupName $rgName -Name $appName -GroupName $groupName -FriendlyName $appFriName -FilePath "C:\Windows\System32\mspaint.exe" -IconIndex 0 -IconPath "C:\Windows\System32\mspaint.exe" -CommandLineSetting Allow -ShowInPortal:$true |
| 42 | + |
| 43 | + $app = Get-AzWvdApplication -Name $appName -ResourceGroupName $rgName -GroupName $groupName |
| 44 | + $app | Update-AzWvdApplication -FilePath 'C:\Windows\System32\WindowsPowerShell\v1. 0\powershell.exe' |
| 45 | + |
| 46 | + Update-AzWvdApplication -Name $appName -ResourceGroupName $rgName -GroupName $groupName -FriendlyName $appFriNameNew |
| 47 | + |
| 48 | + $actual = Get-AzWvdApplication -Name $appName -ResourceGroupName $rgName -GroupName $groupName |
| 49 | + Assert-NotNull $actual |
| 50 | + Assert-AreEqual "$groupName/$appName" $actual.Name |
| 51 | + Assert-AreEqual $appFriNameNew $actual.FriendlyName |
| 52 | + Assert-True { $actual.FilePath -like "*powershell*" } |
| 53 | +} |
| 54 | + |
| 55 | +Invoke-LiveTestScenario -Name "Delete a Windows virtual desktop" -Description "Test deleting a Windows virtual desktop" -ScenarioScript ` |
| 56 | +{ |
| 57 | + param ($rg) |
| 58 | + |
| 59 | + $rgName = $rg.ResourceGroupName |
| 60 | + $location = "westus" |
| 61 | + $poolName = New-LiveTestResourceName |
| 62 | + $poolFriName = New-LiveTestRandomName -Option AllLetters |
| 63 | + $groupName = New-LiveTestResourceName |
| 64 | + $groupFriName = New-LiveTestRandomName -Option AllLetters |
| 65 | + $appName = New-LiveTestResourceName |
| 66 | + $appFriName = New-LiveTestRandomName -Option AllLetters |
| 67 | + |
| 68 | + $pool = New-AzWvdHostPool -ResourceGroupName $rgName -Name $poolName -Location $location -FriendlyName $poolFriName -HostPoolType 'Pooled' -LoadBalancerType 'DepthFirst' -PreferredAppGroupType 'RailApplications' -ExpirationTime (Get-Date).ToUniversalTime().AddDays(1) -MaxSessionLimit 5 |
| 69 | + New-AzWvdApplicationGroup -ResourceGroupName $rgName -Name $groupName -Location $location -FriendlyName $groupFriName -HostPoolArmPath $pool.Id -ApplicationGroupType 'RemoteApp' |
| 70 | + New-AzWvdApplication -ResourceGroupName $rgName -Name $appName -GroupName $groupName -FriendlyName $appFriName -FilePath "C:\Windows\System32\mspaint.exe" -IconIndex 0 -IconPath "C:\Windows\System32\mspaint.exe" -CommandLineSetting Allow -ShowInPortal:$true |
| 71 | + Remove-AzWvdApplication -ResourceGroupName $rgName -Name $appName -GroupName $groupName |
| 72 | + |
| 73 | + $actual = Get-AzWvdApplication -Name $appName -ResourceGroupName $rgName -GroupName $groupName -ErrorAction SilentlyContinue |
| 74 | + Assert-Null $actual |
| 75 | +} |
0 commit comments