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
{{ message }}
Repository navigation
Add support for MSAL Token Cache persistence with Azure authentication #1895
Presently, ActiveDirectoryAuthenticationProvider implements all authentication modes but MSAL Cache location is not customizable and is in-memory by default. Cache persistence is useful for system apps that want to cache access token to file system using MSAL/Azure.Identity's cache options.
Proposed solution:
Expose API/type to enable cache persistence in OS with user options, such as:
Cache file name
Cache file location
Cache encryption (enabled/disabled)
Cache Key format
and so on..
These options can be extended based on what underlying libraries support, and most common options can be supported. Because underlying libraries are not same for all auth modes, exposing a SqlClient specific API will ensure this support continues to be available across all authentication modes that support silent authentication.
Alternatives
The only alternative solution as of now is to implement the SqlAuthenticationProvider abstract class to be able to customize cache location and enable persistence.
I still need to solidify API design proposal but putting out this feature request to exchange thoughts :)
None found (no open issue specifically requests MSAL/Azure.Identity token cache persistence to disk; related but distinct closed issues exist around AAD token refresh/expiry, e.g. #989 "Authentication provider for 'Active Directory Interactive' should maintain access token cache globally")
Regression
Not indicated (feature request, no prior working behavior claimed)
Analysis
This is a feature request to expose configurable MSAL/Azure.Identity token cache persistence (file location, name, encryption, key format) for ActiveDirectoryAuthenticationProvider, which currently only supports an in-memory cache. This affects all Azure AD authentication modes that route through MSAL/Azure.Identity silent auth (e.g. ActiveDirectoryIntegrated, ActiveDirectoryServicePrincipal, ActiveDirectoryManagedIdentity, ActiveDirectoryDefault). It would primarily touch ActiveDirectoryAuthenticationProvider.cs and potentially require new connection string keywords or a new public API surface (requiring ref/ updates per API design guidelines). Severity/priority: P3 (enhancement, no functional break, but would reduce repeated token acquisition/auth server round-trips for long-running system apps).
Next Steps
API design work is needed before implementation: decide whether persistence options are exposed via new connection string keywords, a new SqlAuthenticationProviderConfiguration-style options object, or by documenting the existing SqlAuthenticationProvider extensibility point as the supported workaround (noted by the reporter as the current alternative).
Recommend a maintainer (e.g. @cheenamalhotra, who filed this) confirm current priority and whether this is still desired, since the issue has been open since Jan 2023 with only one acknowledgment comment.
If greenlit, an implementation plan should cover: cache file naming, location, encryption, and key format options, using MSAL's Microsoft.Identity.Client.Extensions.Msal cache persistence APIs (already a common pattern for Azure.Identity/MSAL cross-platform token caching) and add corresponding tests plus doc/samples/ examples.
No duplicates require closing at this time.
Note: This triage summary is auto-generated by an AI agent. The analysis and suggestions above have not been verified by a human maintainer. Please treat as preliminary guidance only.
Activity
lcheunglci commentedon Jan 24, 2023
Thanks @cheenamalhotra for the suggestion
priyankatiwari08 commentedon Sep 17, 2026
/triage
github-actions commentedon Sep 17, 2026
🔍 Triage Summary (on-demand re-triage)
Area\Azure ConnectivityAnalysis
This is a feature request to expose configurable MSAL/Azure.Identity token cache persistence (file location, name, encryption, key format) for
ActiveDirectoryAuthenticationProvider, which currently only supports an in-memory cache. This affects all Azure AD authentication modes that route through MSAL/Azure.Identity silent auth (e.g.ActiveDirectoryIntegrated,ActiveDirectoryServicePrincipal,ActiveDirectoryManagedIdentity,ActiveDirectoryDefault). It would primarily touchActiveDirectoryAuthenticationProvider.csand potentially require new connection string keywords or a new public API surface (requiringref/updates per API design guidelines). Severity/priority: P3 (enhancement, no functional break, but would reduce repeated token acquisition/auth server round-trips for long-running system apps).Next Steps
SqlAuthenticationProviderConfiguration-style options object, or by documenting the existingSqlAuthenticationProviderextensibility point as the supported workaround (noted by the reporter as the current alternative).Microsoft.Identity.Client.Extensions.Msalcache persistence APIs (already a common pattern for Azure.Identity/MSAL cross-platform token caching) and add corresponding tests plusdoc/samples/examples.