Base/Use-FGExistingAccessTokenString.ps1

function Use-FGExistingAccessTokenString {
    [alias("Use-ExistingAccessTokenString")]
    Param(
        [Parameter(Mandatory = $True)]
        $AccessTokenString            
    )

    #Example
    #$AccessToken = 'eyJ0eXAiOiJKV1QiLCJub25jZSI6IjB5ZFdqVVZ0MjVZVnhweWlQb09lVU4zcXhBWU9XTVJ5c3ppRlNvbkRSZ3ciLCJhbGciOiJSUzI1NiIsIng1dCI6Ii1LSTNROW5OUjdiUm9meG1lWm9YcWJIWkdldyIsImtpZCI6Ii1LSTNROW5OUjdiUm9meG1lWm9YcWJIWkdldyJ9.eyJhdWQiOiJodHRwczovL2dyYXBoLm1pY3Jvc29mdC5jb20iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC8wNGY3NjFhOC1iMDBhLTRiOTAtYWM0MS0yYzU0YzEyMWZjYzgvIiwiaWF0IjoxNjgwMTg0MTQ3LCJuYmYiOjE2ODAxODQxNDcsImV4cCI6MTY4MDE4ODU1NiwiYWNjdCI6MCwiYWNyIjoiMSIsImFpbyI6IkUyWUFncU5ma3E3elRIdy9lMHJ6L2htMkc0WFphaVpJMUI4SWw3RFVtS2EvNFA3a0tnQT0iLCJhbXIiOlsicHdkIl0sImFwcF9kaXNwbGF5bmFtZSI6IldpbSBaaWpuIEVuZ2UgQXBwIiwiYXBwaWQiOiIxNDBhNzg4Zi0yMmIzLTRjNjAtOThiYi05ZmM4YWY4NDhjNzkiLCJhcHBpZGFjciI6IjEiLCJmYW1pbHlfbmFtZSI6IlZhbmNlIiwiZ2l2ZW5fbmFtZSI6IkFkZWxlIiwiaWR0eXAiOiJ1c2VyIiwiaXBhZGRyIjoiODkuMjA1LjEzOC4xNDIiLCJuYW1lIjoiQWRlbGUgVmFuY2UiLCJvaWQiOiI0MTEzOGM3MC0yYmVlLTQ5ZjctODFjYy1jNzQ4N2VjNzJkYTgiLCJwbGF0ZiI6IjMiLCJwdWlkIjoiMTAwMzIwMDIxRTI4QUY3QyIs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istingAccessTokenString -AccessTokenString $AccessToken

    $global:AccessToken = $AccessTokenString
    $AccessTokenDetail = Get-FGAccessTokenDetail
    $global:TenantId = $AccessTokenDetail.tid
    $global:ClientId = $AccessTokenDetail.appid    
}