-
Notifications
You must be signed in to change notification settings - Fork 60
Unable to get a new refreshToken running from Azure functions .IdentityService and msal.cache missing #327
Comments
@IsaiahWilliams I have the same issue. My script is a little different but works outside of Azure Functions. The Microsoft.Store.PartnerCenter.PowerShell.Models.Authentication.AuthResult object returned from New-PartnerAccessToken has a NULL refreshtoken attribute.
$token.refreshtoken is NULL |
@penicaudm and @xlZeroAccesslx this is an issue that you will see when using Azure Functions. Fortunately, you can resolve it by leveraging the Register-PartnerTokenCache command to change from a persistent token cache to an in-memory token cache. Note you will need to make sure the in-memory token cache is invoked at least once before using the New-PartnerAccessToken command. Let us know if you have any other issues. |
Thanks @IsaiahWilliams . I invoked
|
@IsaiahWilliams @xlZeroAccesslx Thanks, I added the command Register-PartnerTokenCache -InMemory at the start of my UpdateRefreshToken script and it works. Running latest Az and PartnerCenter modules. |
Steps to reproduce
Running a PowerShell Function in Azure functions. Similar to #234 the refreshtoken is always null because the msal.cache seems to be missing. Using the exact same values, I can get a new refreshToken from Azure Automation Runbooks or my local PowerShell console. Script can be found below
Expected behavior
New-PartnerAccessToken should return a new Refreshtoken using the given parameters.
Actual behavior
the returned object has no refreshToken. JSON sample below:
"RefreshToken": null,
Diagnostic logs
Script
Environment
Azure Functions
FUNCTION_WORKER_RUNTIME = Powershell
FUNCTION_EXTENSION_VERSION = 3
Requirements.psd1
The text was updated successfully, but these errors were encountered: