You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
└─ POST to login.microsoftonline.com/{tenantid}/oauth2/v2.0/token
45
45
│
46
-
└─ Cache result in $script:AccessTokens with expires_on
46
+
└─ Cache result via [CIPP.CIPPTokenCache]::Store(key, json, expiresOn)
47
47
```
48
48
49
49
The `-tenantid` parameter **drives token acquisition**, not just filtering. It determines which customer tenant the token is issued for.
@@ -116,10 +116,11 @@ Customer provides their own refresh token, stored in Key Vault per-tenant (keyed
116
116
117
117
## Token caching
118
118
119
-
Tokens are cached in `$script:AccessTokens` — a synchronized hashtable keyed by `{tenantid}-{scope}-{asApp}`.
119
+
Tokens are cached in `[CIPP.CIPPTokenCache]` — a process-wide `ConcurrentDictionary` backed by a static .NET class in `Shared/CIPPHttp/CIPPHttpClient.cs`.
120
120
121
-
-**Per-runspace**: Not shared across Azure Functions instances
122
-
-**Expiry-aware**: Checks `expires_on` (Unix timestamp) before returning cached token
121
+
-**Process-wide**: Shared across all runspaces in the worker process (unlike the old `$script:AccessTokens` which was per-runspace)
122
+
-**Cache key**: Built via `[CIPP.CIPPTokenCache]::BuildKey($tenantid, $scope, $asApp, $clientId, $grantType)`
123
+
-**Expiry-aware**: `Lookup()` accepts a buffer (seconds) and returns `$false` for expired or soon-to-expire tokens
0 commit comments