Skip to content

Move DesktopVirtualization 2.0 from generation to master. #13472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
700 changes: 612 additions & 88 deletions src/DesktopVirtualization/Az.DesktopVirtualization.format.ps1xml

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions src/DesktopVirtualization/Az.DesktopVirtualization.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Microsoft Corporation
#
# Generated on: 2020-07-16
# Generated on: 2020-11-10
#

@{
Expand Down Expand Up @@ -69,21 +69,24 @@ FormatsToProcess = './Az.DesktopVirtualization.format.ps1xml'
# NestedModules = @()

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'Disconnect-AzWvdUserSession', 'Get-AzWvdApplication',
'Get-AzWvdApplicationGroup', 'Get-AzWvdDesktop', 'Get-AzWvdHostPool',
FunctionsToExport = 'Disconnect-AzWvdUserSession', 'Expand-AzWvdMsixImage',
'Get-AzWvdApplication', 'Get-AzWvdApplicationGroup',
'Get-AzWvdDesktop', 'Get-AzWvdHostPool', 'Get-AzWvdMsixPackage',
'Get-AzWvdRegistrationInfo', 'Get-AzWvdSessionHost',
'Get-AzWvdStartMenuItem', 'Get-AzWvdUserSession',
'Get-AzWvdWorkspace', 'New-AzWvdApplication',
'New-AzWvdApplicationGroup', 'New-AzWvdHostPool',
'New-AzWvdRegistrationInfo', 'New-AzWvdWorkspace',
'Register-AzWvdApplicationGroup', 'Remove-AzWvdApplication',
'Remove-AzWvdApplicationGroup', 'Remove-AzWvdHostPool',
'New-AzWvdMsixPackage', 'New-AzWvdRegistrationInfo',
'New-AzWvdWorkspace', 'Register-AzWvdApplicationGroup',
'Remove-AzWvdApplication', 'Remove-AzWvdApplicationGroup',
'Remove-AzWvdHostPool', 'Remove-AzWvdMsixPackage',
'Remove-AzWvdRegistrationInfo', 'Remove-AzWvdSessionHost',
'Remove-AzWvdUserSession', 'Remove-AzWvdWorkspace',
'Send-AzWvdUserSessionMessage', 'Unregister-AzWvdApplicationGroup',
'Update-AzWvdApplication', 'Update-AzWvdApplicationGroup',
'Update-AzWvdDesktop', 'Update-AzWvdHostPool',
'Update-AzWvdSessionHost', 'Update-AzWvdWorkspace'
'Update-AzWvdMsixPackage', 'Update-AzWvdSessionHost',
'Update-AzWvdWorkspace'

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()
Expand Down Expand Up @@ -121,10 +124,7 @@ PrivateData = @{
# IconUri = ''

# ReleaseNotes of this module
ReleaseNotes = '* Require Location property for creating top level arm objects.
* Made `ApplicationGroupType` required for `New-AzWvdApplicationGroup`.
* Made `HostPoolArmPath` required for `New-AzWvdApplicationGroup`.
* Added `PreferredAppGroupType` for `New-AzWvdHostPool`.'
ReleaseNotes = '* Added new MSIX Package cmdlets and Updated Applications cmdlets.'

# Prerelease string of this module
# Prerelease = ''
Expand Down
10 changes: 5 additions & 5 deletions src/DesktopVirtualization/Az.DesktopVirtualization.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@
}
}
if(-not $accountsModule) {
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'1.7.4' } | Measure-Object).Count -gt 0
$hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'1.8.1' } | Measure-Object).Count -gt 0
if($hasAdequateVersion) {
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 1.7.4 -Scope Global -PassThru
$accountsModule = Import-Module -Name $accountsName -MinimumVersion 1.8.1 -Scope Global -PassThru
}
}
}

if(-not $accountsModule) {
Write-Error "`nThis module requires $accountsName version 1.7.4 or greater. For installation instructions, please see: https://docs.microsoft.com/en-us/powershell/azure/install-az-ps" -ErrorAction Stop
} elseif (($accountsModule.Version -lt [System.Version]'1.7.4') -and (-not $localAccounts)) {
Write-Error "`nThis module requires $accountsName version 1.7.4 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to remove '.PSSharedModules' in your home directory. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop
Write-Error "`nThis module requires $accountsName version 1.8.1 or greater. For installation instructions, please see: https://docs.microsoft.com/en-us/powershell/azure/install-az-ps" -ErrorAction Stop
} elseif (($accountsModule.Version -lt [System.Version]'1.8.1') -and (-not $localAccounts)) {
Write-Error "`nThis module requires $accountsName version 1.8.1 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to remove '.PSSharedModules' in your home directory. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop
}
Write-Information "Loaded Module '$($accountsModule.Name)'"

Expand Down
1 change: 1 addition & 0 deletions src/DesktopVirtualization/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Added new MSIX Package cmdlets and updated Applications cmdlets.

## Version 2.0.0
* Require Location property for creating top level arm objects.
Expand Down
10 changes: 6 additions & 4 deletions src/DesktopVirtualization/check-dependencies.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ if(-not $Isolated) {
return
}

function DownloadModule ([bool]$predicate, [string]$path, [string]$moduleName, [string]$versionMinimum) {
function DownloadModule ([bool]$predicate, [string]$path, [string]$moduleName, [string]$versionMinimum, [string]$requiredVersion) {
if($predicate) {
$module = Get-Module -ListAvailable -Name $moduleName
if((-not $module) -or ($versionMinimum -and ($module | ForEach-Object { $_.Version } | Where-Object { $_ -ge [System.Version]$versionMinimum } | Measure-Object).Count -eq 0)) {
$null = New-Item -ItemType Directory -Force -Path $path
Write-Host -ForegroundColor Green "Installing local $moduleName module into '$path'..."
if($versionMinimum) {
if ($requiredVersion) {
Find-Module -Name $moduleName -RequiredVersion $requiredVersion -Repository PSGallery | Save-Module -Path $path
}elseif($versionMinimum) {
Find-Module -Name $moduleName -MinimumVersion $versionMinimum -Repository PSGallery | Save-Module -Path $path
} else {
Find-Module -Name $moduleName -Repository PSGallery | Save-Module -Path $path
Expand All @@ -44,8 +46,8 @@ if(Test-Path -Path $localModulesPath) {
$env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath"
}

DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '1.7.4'
DownloadModule -predicate ($all -or $Pester) -path $localModulesPath -moduleName 'Pester' -versionMinimum ''
DownloadModule -predicate ($all -or $Accounts) -path $localModulesPath -moduleName 'Az.Accounts' -versionMinimum '1.8.1'
DownloadModule -predicate ($all -or $Pester) -path $localModulesPath -moduleName 'Pester' -requiredVersion '4.10.1'

$tools = Join-Path $PSScriptRoot 'tools'
$resourceDir = Join-Path $tools 'Resources'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Get the Windows virtual desktop registration info.
Get the Windows virtual desktop registration info.
#>
function Get-AzWvdRegistrationInfo {
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Models.Api20191210Preview.RegistrationInfo')]
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Models.Api20201019Preview.RegistrationInfo')]
[CmdletBinding(PositionalBinding=$false)]
param(
[Parameter()]
Expand Down Expand Up @@ -89,7 +89,7 @@ function Get-AzWvdRegistrationInfo {

process {
$hostpool = Az.DesktopVirtualization\Get-AzWvdHostPool @PSBoundParameters
New-Object -TypeName 'Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Models.Api20191210Preview.RegistrationInfo' `
New-Object -TypeName 'Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Models.Api20201019Preview.RegistrationInfo' `
-Property @{ `
ExpirationTime = $hostpool.RegistrationInfoExpirationTime; `
RegistrationTokenOperation = $hostpool.RegistrationInfoRegistrationTokenOperation; `
Expand Down
158 changes: 158 additions & 0 deletions src/DesktopVirtualization/custom/New-AzWvdMsixpackage_PackageAlias.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
function New-AzWvdMsixPackage_PackageAlias {

[OutputType('Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Models.Api20201019Preview.IMsixPackage')]
[CmdletBinding( PositionalBinding = $false, ConfirmImpact = 'Medium')]
param(
[Parameter()]
[Alias('AzureRMContext', 'AzureCredential')]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Category('Azure')]
[System.Management.Automation.PSObject]
# The credentials, account, tenant, and subscription used for communication with Azure.
${DefaultProfile},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Wait for .NET debugger to attach
${Break},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Category('Runtime')]
[Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Runtime.SendAsyncStep[]]
# SendAsync Pipeline Steps to be appended to the front of the pipeline
${HttpPipelineAppend},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Category('Runtime')]
[Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Runtime.SendAsyncStep[]]
# SendAsync Pipeline Steps to be prepended to the front of the pipeline
${HttpPipelinePrepend},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Category('Runtime')]
[System.Uri]
# The URI for the proxy server to use
${Proxy},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Category('Runtime')]
[System.Management.Automation.PSCredential]
# Credentials for a proxy server to use for the remote call
${ProxyCredential},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Use the default credentials for the proxy
${ProxyUseDefaultCredentials},

# Required to run the command with a specified alias
[Parameter(Mandatory, HelpMessage = 'Subscription Id')]
[Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')]
[System.String]
${SubscriptionId},

[Parameter(Mandatory, HelpMessage = 'Resource Group Name')]
[Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Category('Path')]
[System.String]
${ResourceGroupName},

[Parameter(Mandatory, HelpMessage = 'HostPool Name')]
[Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Category('Path')]
[System.String]
${HostPoolName},

[Parameter(Mandatory, HelpMessage = 'Package Alias from extract MSIX Image')]
[Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Category('Path')]
[System.String]
${PackageAlias},

[Parameter(HelpMessage = 'Is Active')]
[Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Category('Path')]
[System.Management.Automation.SwitchParameter]
${IsActive},

[Parameter(HelpMessage = 'Is Regular Registration')]
[Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Category('Path')]
[System.Management.Automation.SwitchParameter]
${IsRegularRegistration},

[Parameter(HelpMessage = 'Package Display Name')]
[Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Category('Path')]
[System.String]
${DisplayName},

# needed to run Expand MSIX Image
[Parameter(HelpMessage = 'Image Path to CIM/VHD')]
[Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Category('Path')]
[System.String]
${ImagePath}
)

process {
$saveHostPoolName = $null
if ($PSBoundParameters.ContainsKey("HostPoolName")) {
$saveHostPoolName = $PSBoundParameters["HostPoolName"]
}
$saveResourceGroupName = $null
if ($PSBoundParameters.ContainsKey("ResourceGroupName")) {
$saveResourceGroupName = $PSBoundParameters["ResourceGroupName"]
}
$saveSubscriptionId = $null
if ($PSBoundParameters.ContainsKey("SubscriptionId")) {
$saveSubscriptionId = $PSBoundParameters["SubscriptionId"]
}
$savePackageAlias = $null
if ($PSBoundParameters.ContainsKey("PackageAlias")) {
$savePackageAlias = $PSBoundParameters["PackageAlias"]
}
$saveImagePath = $null
if ($PSBoundParameters.ContainsKey("ImagePath")) {
$saveImagePath = $PSBoundParameters["ImagePath"]
}

$saveDisplayName = $null
if ($PSBoundParameters.ContainsKey("DisplayName")) {
$saveDisplayName = $PSBoundParameters["DisplayName"]
}

# clear
$null = $PSBoundParameters.Remove("HostPoolName")
$null = $PSBoundParameters.Remove("ResourceGroupName")
$null = $PSBoundParameters.Remove("SubscriptionId")
$null = $PSBoundParameters.Remove("ImagePath")
$null = $PSBoundParameters.Remove("PackageAlias")
$null = $PSBoundParameters.Remove("DisplayName")
$null = $PSBoundParameters.Remove("IsActive")
$null = $PSBoundParameters.Remove("IsRegularRegistration")

$extractPackage = Az.DesktopVirtualization\Expand-AzWvdMsixImage @PSBoundParameters -HostPoolName $saveHostPoolName `
-ResourceGroupName $saveResourceGroupName `
-SubscriptionId $saveSubscriptionId `
-Uri $saveImagePath `
| Where-Object { $_.PackageAlias -eq $savePackageAlias }

$null = $PSBoundParameters.Add("ResourceGroupName", $saveResourceGroupName)
$null = $PSBoundParameters.Add("SubscriptionId", $saveSubscriptionId)
$null = $PSBoundParameters.Add('FullName', $extractPackage.PackageFullName)
$null = $PSBoundParameters.Add("IsActive", $IsActive)
$null = $PSBoundParameters.Add("IsRegularRegistration", $IsRegularRegistration)

$package = New-AzWvdMsixPackage @PSBoundParameters -HostPoolName $saveHostPoolName `
-ImagePath $extractPackage.ImagePath `
-PackageName $extractPackage.PackageName `
-PackageFamilyName $extractPackage.PackageFamilyName `
-PackageRelativePath $extractPackage.PackageRelativePath `
-PackageDependency $extractPackage.PackageDependencies `
-Version $extractPackage.Version `
-LastUpdated $extractPackage.LastUpdated `
-PackageApplication $extractPackage.PackageApplication `
-DisplayName $saveDisplayName `

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Create Windows virtual desktop registration info.
Create Windows virtual desktop registration info.
#>
function New-AzWvdRegistrationInfo {
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Models.Api20191210Preview.IRegistrationInfo')]
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Models.Api20201019Preview.IRegistrationInfo')]
[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter()]
Expand Down Expand Up @@ -111,7 +111,7 @@ function New-AzWvdRegistrationInfo {
-Ring $hostpool.Ring `
-ValidationEnvironment:$hostpool.ValidationEnvironment `
-PreferredAppGroupType $hostpool.PreferredAppGroupType
New-Object -TypeName 'Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Models.Api20191210Preview.RegistrationInfo' `
New-Object -TypeName 'Microsoft.Azure.PowerShell.Cmdlets.DesktopVirtualization.Models.Api20201019Preview.RegistrationInfo' `
-Property @{ `
ExpirationTime = $hostpool.RegistrationInfoExpirationTime; `
RegistrationTokenOperation = $hostpool.RegistrationInfoRegistrationTokenOperation; `
Expand Down
14 changes: 14 additions & 0 deletions src/DesktopVirtualization/examples/Expand-AzWvdMsixImage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
### Example 1: Expands specified Image Path and retrieves Package metadata found in AppxManifest.xml
```powershell
PS C:\> Expand-AzWvdMsixImage -HostPoolName HostPoolName `
-ResourceGroupName resourceGroupName `
-SubscriptionId SubscriptionId `
-Uri ImagePathURI

Name Type
---- ----
HostPoolName/extractmsiximage Microsoft.DesktopVirtualization/hostpools/extractmsiximage
```

This command returns Metadata of MSIX Package found in the given Image Path.

24 changes: 24 additions & 0 deletions src/DesktopVirtualization/examples/Get-AzWvdMsixPackage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
### Example 1: Get a MSIX Package by Name
```powershell
PS C:\> Get-AzWvdMsixPackage -HostPoolName HostPoolName -ResourceGroupName ResourceGroupName -SubscriptionId SubscriptionId -FullName PackageFullName

Name Type
---- ----
HostPoolName/MSIXPackage_FullName Microsoft.DesktopVirtualization/hostpools/msixpackages
```

This command gets a MSIX Package in a HostPool.

### Example 2: List MSIX Packages
```powershell
PS C:\> Get-AzWvdMsixPackage -HostPoolName HostPoolName -ResourceGroupName ResourceGroupName -SubscriptionId SubscriptionId

Name Type
---- ----
HostPoolName/MSIXPackage_FullName1 Microsoft.DesktopVirtualization/hostpools/msixpackages
HostPoolName/MSIXPackage_FullName2 Microsoft.DesktopVirtualization/hostpools/msixpackages
HostPoolName/MSIXPackage_FullName3 Microsoft.DesktopVirtualization/hostpools/msixpackages
```

This command Lists MSIX Packages in a HostPool.

6 changes: 3 additions & 3 deletions src/DesktopVirtualization/examples/Get-AzWvdWorkspace.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### Example 1: Get a Windows Virtual Desktop Worksapce by name
### Example 1: Get a Windows Virtual Desktop Workspace by name
```powershell
PS C:\> Get-AzWvdWorksapce -ResourceGroupName ResourceGroupName -Name WorkspaceName
PS C:\> Get-AzWvdWorkspace -ResourceGroupName ResourceGroupName -Name WorkspaceName

Location Name Type
-------- ---- ----
Expand All @@ -11,7 +11,7 @@ This command gets a Windows Virtual Desktop Workspace in a Resource Group.

### Example 2: List Windows Virtual Desktop Workspaces
```powershell
PS C:\> Get-AzWvdWorksapce -ResourceGroupName ResourceGroupName
PS C:\> Get-AzWvdWorkspace -ResourceGroupName ResourceGroupName

Location Name Type
-------- ---- ----
Expand Down
Loading