AL/Get-LaunchKeyValue.ps1

function Get-LaunchKeyValue {
    Param(
        # path of the AL source to read the value from .\vscode\launch.json
        [Parameter(Mandatory=$false)]
        [string]
        $Path = (Get-Location),
        # name of the key to read from the specified configuration
        [Parameter(Mandatory=$true)]
        [string]
        $KeyName,
        # configuration name to use
        [Parameter(Mandatory=$false)]
        [string]
        $ConfigurationName = ''
    )

    $LaunchJson = ConvertFrom-Json (Get-Content (Join-Path (Join-Path $Path '.vscode') 'launch.json') -Raw)
    foreach ($Config in $LaunchJson.configurations) {
        if (($Config.name -eq $ConfigurationName) -or ($ConfigurationName -eq '')) {
            if ($null -ne $Config.PSObject.Properties.Item($KeyName).Value) {
                return $Config.PSObject.Properties.Item($KeyName).Value
            }
        }
    }

    return ''
}

Export-ModuleMember -Function Get-LaunchKeyValue