Describe the bug
AzureAD/microsoft-authentication-library-for-python#644 introduced a regression that msal_extensions.token_cache.PersistedTokenCache is bypassed by ConfidentialClientApplication.
To Reproduce
az login --service-principal --username ... --password ... --tenant ... --allow-no-subscriptions
az account get-access-token --scope https://management.azure.com//.default
...
"expiresOn": "2024-04-11 19:25:43.000000",
az account get-access-token --scope https://management.azure.com//.default
...
"expiresOn": "2024-04-11 19:26:03.000000",
Notice each time a new access token is retrieved, bypassing the token cache. Detailed analysis is provided at AzureAD/microsoft-authentication-library-for-python#644 (comment).
This causes a severe regression in OIDC authentication, so that no Azure CLI task can run longer than the OIDC token's 5-minute lifetime (Azure/azure-cli#28708 (comment)).
Expected behavior
Old access token from the token cache should be retrieved.
What you see instead
A new access token is retrieved.
The MSAL Python version you are using
1.28.0
Additional context
Add any other context about the problem here.