Modules/businessdev.ALbuild.Containers/Public/Get-BcContainerAppInfo.ps1
|
function Get-BcContainerAppInfo { <# .SYNOPSIS Returns the apps installed/published in a Business Central container, with versions. .DESCRIPTION Runs Get-NAVAppInfo inside the container and returns the result as objects. The version information (including Microsoft first-party apps such as System Application and Base Application) is what the dependency resolver uses as the pinned baseline for a build. .PARAMETER Name Container name. .PARAMETER ServerInstance BC server instance inside the container. Default 'BC'. .PARAMETER Tenant Tenant to query for tenant-specific (installed) information. Default 'default'. .PARAMETER DockerExecutable The Docker executable to use (default 'docker'). .OUTPUTS PSCustomObject with Name, Publisher, Version, AppId, IsInstalled. #> [CmdletBinding()] [OutputType([PSCustomObject])] param( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [Alias('ContainerName')] [string] $Name, [string] $ServerInstance = 'BC', [string] $Tenant = 'default', [string] $DockerExecutable = 'docker' ) $script = { $apps = Get-NAVAppInfo -ServerInstance $ServerInstance -TenantSpecificProperties -Tenant $Tenant -ErrorAction Stop $apps | ForEach-Object { [PSCustomObject]@{ Name = "$($_.Name)" Publisher = "$($_.Publisher)" Version = "$($_.Version)" AppId = "$($_.AppId)" IsInstalled = [bool]$_.IsInstalled } } | ConvertTo-Json -Depth 5 } $json = Invoke-BcContainerCommand -ContainerName $Name -ScriptBlock $script -DockerExecutable $DockerExecutable -Variables @{ ServerInstance = $ServerInstance Tenant = $Tenant } if ([string]::IsNullOrWhiteSpace($json)) { return @() } $parsed = $json | ConvertFrom-Json return @($parsed) } |