functions/Set-PipelineVariable.ps1

function Set-PipelineVariable {
    param(
        [Parameter(Mandatory = $true)]
        [string]$Name,
        
        [Parameter(Mandatory = $true)]
        [AllowEmptyString()]
        [string]$Value
    )

    Write-Output "##vso[task.setvariable variable=$Name]$Value"
}