diff --git a/sdk/identity/azure-identity/CHANGELOG.md b/sdk/identity/azure-identity/CHANGELOG.md index 97653d07925a..9c27ce83b075 100644 --- a/sdk/identity/azure-identity/CHANGELOG.md +++ b/sdk/identity/azure-identity/CHANGELOG.md @@ -4,6 +4,8 @@ ### Features Added +- Continue attempt next credential when finding an expired token from cached token credential in DefaultAzureCredential. ([#30441](https://github.com/Azure/azure-sdk-for-python/pull/30441)) + ### Breaking Changes ### Bugs Fixed diff --git a/sdk/identity/azure-identity/azure/identity/_credentials/silent.py b/sdk/identity/azure-identity/azure/identity/_credentials/silent.py index a0a31b9b1f6c..beac88d06fac 100644 --- a/sdk/identity/azure-identity/azure/identity/_credentials/silent.py +++ b/sdk/identity/azure-identity/azure/identity/_credentials/silent.py @@ -10,7 +10,6 @@ from msal import PublicClientApplication from azure.core.credentials import AccessToken -from azure.core.exceptions import ClientAuthenticationError from .. import CredentialUnavailableError from .._internal import resolve_tenant, validate_tenant_id @@ -125,7 +124,7 @@ def _acquire_token_silent(self, *scopes: str, **kwargs: Any) -> AccessToken: details = result.get("error_description") or result.get("error") if details: message += ": {}".format(details) - raise ClientAuthenticationError(message=message) + raise CredentialUnavailableError(message=message) # cache doesn't contain a matching refresh (or access) token raise CredentialUnavailableError(message=NO_TOKEN.format(self._auth_record.username))