TeamFoundation/Public/Get-TfsAccessTokenString.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function Get-TfsAccessTokenString
{
    [CmdletBinding()]
    [OutputType([String])]
    param
    (
        [Parameter(Mandatory = $True)]
        [String] $PersonalAccessToken
    )

    $tokenString = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f '',$PersonalAccessToken)))
    return ("Basic {0}" -f $tokenString)
}