Search code examples
c#azureazure-active-directoryazure-functionsaccess-token

Token Cache with Timer-Triggered Azure Functions


I am working on a timer-triggered Azure Functions and it runs every hour. The function retrieves Token using ADAL. I want to know, is it possible to do TokenCache with Timer-Triggered Azure Functions. Is there a way to do this?


Solution

  • If your function uses client credentials to authenticate, there is no point in making a custom token cache. Your credentials can get a new token anytime a new one is needed. If your function runs more often than once an hour, it can be good to use an in-memory cache to keep the current access token.

    If you use refresh token, then it's another story. In that case you would definitely need a persistent token cache, e.g. in table storage.