Containers/Get-VSCodeExtensionFromContainer.ps1

function Get-VSCodeExtensionFromContainer {
    Param(
        [Parameter(Mandatory=$false)]
        [string]$ContainerName = (Get-ContainerFromLaunchJson)
    )

    try { 
        $Logs = docker logs $ContainerName 
        $VsixUrl = $Logs.item($Logs.indexOf('Files:') + 1)

        $Inspect = docker inspect $ContainerName | ConvertFrom-Json
        $VsixName = $Inspect.Config.Labels.version
    }
    catch{
        throw "An error has occurred retrieving VSCode extension"
    }
    
    $VsixPath = Join-Path (Split-Path (Get-TFSConfigPath) -Parent) $VsixName
    $VsixFile = (Join-Path -Path $VsixPath -ChildPath $VsixName) + '.vsix'
    if(!(Test-Path $VsixPath)){
        New-Item -Path $VsixPath -ItemType Directory | Out-Null
        try {
            Download-File -sourceUrl $VsixUrl -destinationFile $VsixFile | Out-Null 
        } 
        catch {
            Remove-Item $VsixPath -Recurse -Force
            throw "Unable to download VSCode extension $VsixUrl" 
        }
    }

    $VsixFile 
}

Export-ModuleMember -Function Get-VSCodeExtensionFromContainer