Here is the code I am using.
Connect-AzAccount -AccessToken $Session.AccessToken -AccoundId $User
Hi @azurefanboy,
Is the access token avaliablie through the admin-terminal?
@azurefanboy
Can you show me the auth method ?
$AuthenticationMethod = New-UDAuthenticationMethod -ResponseType ‘id_token token’ -ClientSecret ‘’ -ClientId ‘’ -Authority ‘https://login.microsoftonline.com/738ae3fd-64a9-42db-b01a-f49ac7edacff’ -Resource ‘https://management.azure.com/’ -PassThru
I removed my clientid and secret.
I opened a GitHub issue for this back when 2.8.2 was released.
Make sure to use the -SaveTokens
switch parameter.
That worked! Thanks Adam!
Is this still an issue for you? Sorry for not following up on that. I dropped the ball there.
yeah its still an issue - I don’t know why this is obviously is working for others…
Looking at your issue again. I noticed you are using $Session:AccessToken
. What happens when you try to access it like $Session.AccessToken
?
So it looks like the access token expires but does’t refresh after expiration? Is it suppose to refresh?
Ok so the token is refreshing but the variable in the endpoint is not refreshing. Doing some more digging.
Hey @adam - Yeah I had it working with $Session.AccessToken back in 2.8.1 but since switching to 2.8.2 I have lost the $Session Var.
But if I call the $Session.AccessToken from an Endpoint loaded in the dashboard.ps1 file I can store it in another Session Var… its soooo strange. So what I did was create a $Session:AccessToken = $Session.AccessToken variable from within a Function I created that loads my entire side navigation.
$Navigation = New-UDSideNav -Id 'v3sidenav' -Endpoint {
Get-KSAPSideNav
} -Fixed
New-UDDashboard -Navigation $Navigation
And within the Get-KSAPSideNav Function, I have $Session:AccessToken = $Session.AccessToken
But something else I find strange is that the admin terminal does not return any loaded $Session: variables including the $Session, even though I can see the variables under the users Session in the Diagnostics