Modules/businessdev.ALbuild.Containers/Private/Resolve-BcContainerLicense.ps1

function Resolve-BcContainerLicense {
    <#
    .SYNOPSIS
        Resolves a license file into a value the container start script can read.
 
    .DESCRIPTION
        A local license path on the host (e.g. a OneDrive folder) is not visible inside the
        container, so the start script fails with 'License File not found'. This copies a local
        license into the bind-mounted host share and returns the in-container path
        ('C:\run\my\<file>'). A URL is returned unchanged for the container to download.
 
    .PARAMETER LicenseFile
        Local path or http(s) URL of the license file.
 
    .PARAMETER HostShare
        Host folder bind-mounted to C:\run\my in the container.
 
    .OUTPUTS
        [string] The licenseFile value to pass to the container.
    #>

    [CmdletBinding()]
    [OutputType([string])]
    param(
        [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string] $LicenseFile,
        [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string] $HostShare
    )

    if ($LicenseFile -match '^https?://') {
        return $LicenseFile
    }

    if (-not (Test-Path -LiteralPath $LicenseFile)) {
        throw "License file not found: $LicenseFile"
    }

    $licenseName = Split-Path -Path $LicenseFile -Leaf
    Copy-Item -LiteralPath $LicenseFile -Destination (Join-Path -Path $HostShare -ChildPath $licenseName) -Force
    return "C:\run\my\$licenseName"
}