Functions/Authentication/Get-RESTAuthorization.ps1

function Get-RESTAuthorization
    {
    [CmdletBinding()]
    Param
    (
        [Parameter(Mandatory=$true)]
        [pscredential]
        $Credential
    )
    $B64 = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(("$($credential.username):$([System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($Credential.Password)))")))
    "Basic $B64"
    }