- Added
subscription
parameter toAzureCliCredential
to specify the subscription to use when authenticating with the Azure CLI. (#37994)
- A bug in the error handling for AzureCliCredentials and AzureDeveloperCliCredential which would result in the unexpected error
'NoneType' object has no attribute 'startswith'
has been fixed (#39176)
AzureCliCredential
andAzureDeveloperCliCredential
will now call their corresponding executables directly instead of going through the shell. (#38606)
- Fixed the request sent in
AzurePipelinesCredential
so it doesn't result in a redirect response when an invalid system access token is provided. (#37510)
- Deprecated
AzureAuthorityHosts.AZURE_GERMANY
- All credentials now implement the
SupportsTokenInfo
orAsyncSupportsTokenInfo
protocol. Each credential now has aget_token_info
method which returns anAccessTokenInfo
object. Theget_token_info
method is an alternative method toget_token
that improves support for more complex authentication scenarios. (#36882)- Information on when a token should be refreshed is now saved in
AccessTokenInfo
(if available).
- Information on when a token should be refreshed is now saved in
- Added identity config validation to
ManagedIdentityCredential
to avoid non-deterministic states (e.g. bothresource_id
andobject_id
are specified). (#36950) - Additional validation was added for
ManagedIdentityCredential
in Azure Cloud Shell environments. (#36438) - Bumped minimum dependency on
azure-core
to>=1.31.0
.
- Added support of
send_certificate_chain
keyword argument when using certs with the synchronousOnBehalfOfCredential
. (#36810) AzurePowerShellCredential
now supports using secure strings when authenticating with PowerShell. (#36653)
- Fixed the issue that
SharedTokenCacheCredential
was not picklable.
- The synchronous
ManagedIdentityCredential
was updated to use MSAL (Microsoft Authentication Library) for handling most of the underlying managed identity implementations.
- Continue to attempt requesting token if the probing request receives non-json response. (#36184)
These changes do not impact the API of stable versions such as 1.16.0. Only code written against a beta version such as 1.17.0b1 is affected.
AzurePipelinesCredential
now has a required keyword argumentsystem_access_token
. (#35858)
- Allow credential chains to continue when an IMDS probe request returns a non-JSON response in
ManagedIdentityCredential
. (#36016)
OnBehalfOfCredential
now supports client assertion callbacks through theclient_assertion_func
keyword argument. This enables authenticating with client assertions such as federated credentials. (#35812)
- Managed identity bug fixes
- Managed identity bug fixes
- Added environment variable
AZURE_CLIENT_SEND_CERTIFICATE_CHAIN
support forEnvironmentCredential
. - Introduced a new credential,
AzurePipelinesCredential
, for supporting workload identity federation in Azure Pipelines with service connections (#35397).
- Fixed typing errors when certain credentials are used as context managers. (#35415)
- For IMDS requests in
ManagedIdentityCredential
, the retry backoff factor was reduced from 2 to 0.8 in order to avoid excessive retry delays and improve responsiveness. Users can customize this setting with theretry_backoff_factor
parameter:ManagedIdentityCredential(retry_backoff_factor=2)
. (#35070)
- Added pickling support. (#34134)
- Fixed an issue in
AzurePowerShellCredential
where ifpwsh
isn't available and the Command Prompt language is not English, it would not fall back topowershell
. (#34271)
- Fixed the bug that
ClientAssertionCredential
constructor fails if kwargs are provided. (#33673) ManagedIdentityCredential
is more lenient with the error message it matches when falling through to the next credential in the chain in the case that Docker Desktop returns a 403 response when attempting to access the IMDS endpoint. (#33928)
AzureCliCredential
utilizes the newexpires_on
property returned byaz
CLI versions >= 2.54.0 to determine token expiration. (#33947)- Azure-identity is supported on Python 3.8 or later.
- Added bearer token provider. (#32655)
- Fixed issue InteractiveBrowserCredential does not hand over to next credential in chain if no browser is supported.(#32276)
- Added
enable_support_logging
as a keyword argument to credentials using MSAL'sPublicClientApplication
. This allows additional support logging which may contain PII. (#32135)
These changes do not impact the API of stable versions such as 1.14.0. Only code written against a beta version such as 1.15.0b1 may be affected.
- Windows Web Account Manager (WAM) Brokered Authentication is moved into another package.
ManagedIdentityCredential
will now correctly retry when the instance metadata endpoint returns a 410 response. (#32200)
- Bug fixes for developer credentials
- Added Windows Web Account Manager (WAM) Brokered Authentication support.
- Added
enable_msa_passthrough
suppport forInteractiveBrowserCredential
. By defaultInteractiveBrowserCredential
only lists Microsoft Entra accounts. If you setenable_msa_passthrough
toTrue
, it lists both Microsoft Entra accounts and MSA outlook.com accounts that are logged in to Windows.
- Ensure
AzurePowershellCredential
calls PowerShell with the-NoProfile
flag to avoid loading user profiles for more consistent behavior. (#31682) - Fixed an issue with subprocess-based developer credentials (such as AzureCliCredential) where the process would sometimes hang waiting for user input. (#31534)
- Fixed an issue with
ClientAssertionCredential
not properly checking if CAE should be enabled. (#31544) ManagedIdentityCredential
will fall through to the next credential in the chain in the case that Docker Desktop returns a 403 response when attempting to access the IMDS endpoint. (#31824)
- Update typing of async credentials to match the
AsyncTokenCredential
protocol. - If within
DefaultAzureCredential
,EnvironmentCredential
will now use log level INFO instead of WARNING to inform users of an incomplete environment configuration. (#31814) - Strengthened
AzureCliCredential
andAzureDeveloperCliCredential
error checking when determining if a user is logged in or not. Now, if anAADSTS
error exists in the error, the full error message is propagated instead of a canned error message. (#30047) ManagedIdentityCredential
instances using IMDS will now be allowed to continue sending requests to the IMDS endpoint even after previous attempts failed. This is to prevent credential instances from potentially being permanently disabled after a temporary network failure.- IMDS endpoint probes in
ManagedIdentityCredential
will now only occur when inside a credential chain such asDefaultAzureCredential
. This probe request timeout has been increased to 1 second from 0.3 seconds to reduce the likelihood of false negatives.
- Continuous Access Evaluation (CAE) is now configurable per-request by setting the
enable_cae
keyword argument toTrue
inget_token
. This applies to user credentials and service principal credentials. (#30777)
- CP1 client capabilities for CAE is no longer always-on by default for user credentials. This capability will now be configured as-needed in each
get_token
request by each SDK. (#30777)- Suffixes are now appended to persistent cache names to indicate whether CAE or non-CAE tokens are stored in the cache. This is to prevent CAE and non-CAE tokens from being mixed/overwritten in the same cache. This could potentially cause issues if you are trying to share the same cache between applications that are using different versions of the Azure Identity library as each application would be reading from a different cache file.
- Since CAE is no longer always enabled for user-credentials, the
AZURE_IDENTITY_DISABLE_CP1
environment variable is no longer supported.
- Credential types correctly implement
azure-core
'sTokenCredential
protocol. (#25175)
- Added
workload_identity_tenant_id
support inDefaultAzureCredential
.
- Continue attempt next credential when finding an expired token from cached token credential in DefaultAzureCredential. (#30441)
- VisualStudioCodeCredential prints an informative error message when used (as it is currently broken) (#30385)
- Removed dependency on
six
. (#30613)
These changes do not impact the API of stable versions such as 1.12.0. Only code written against a beta version such as 1.13.0b4 may be affected.
- Windows Web Account Manager (WAM) Brokered Authentication is still in preview and not available in this release. It will be available in the next beta release.
- Additional Continuous Access Evaluation (CAE) support for service principal credentials is still in preview and not available in this release. It will be available in the next beta release.
- Renamed keyword argument
developer_credential_timeout
toprocess_timeout
inDefaultAzureCredential
to remain consistent with the other credentials that launch a subprocess to acquire tokens.
- Credentials that are implemented via launching a subprocess to acquire tokens now have configurable timeouts using the
process_timeout
keyword argument. This addresses scenarios where these proceses can take longer than the current default timeout values. The affected credentials areAzureCliCredential
,AzureDeveloperCliCredential
, andAzurePowerShellCredential
. (Note: ForDefaultAzureCredential
, thedeveloper_credential_timeout
keyword argument allows users to propagate this option toAzureCliCredential
,AzureDeveloperCliCredential
, andAzurePowerShellCredential
in the authentication chain.) (#28290)
- Changed parameter from
instance_discovery
todisable_instance_discovery
to make it more explicit. - Service principal credentials now enable support for Continuous Access Evaluation (CAE). This indicates to Microsoft Entra ID that your application can handle CAE claims challenges.
- Added
AzureDeveloperCredential
for Azure Developer CLI. (#27916) - Added
WorkloadIdentityCredential
for Workload Identity Federation on Kubernetes (#28536) - Added support to use "TryAutoDetect" as the value for
AZURE_REGIONAL_AUTHORITY_NAME
to enable auto detecting the appropriate authority (#526)
- Added Windows Web Account Manager (WAM) Brokered Authentication support. (#23687)
These changes do not impact the API of stable versions such as 1.12.0. Only code written against a beta version such as 1.12.0b1 may be affected.
- Replaced
validate_authority
withinstance_discovery
. Now instead of setting validate_authority=False to disable authority validation and instance discovery, you need to use instance_discovery=False.
- Fixed an issue where
AzureCliCredential
would return the wrong error message when the Azure CLI was not installed on non-English consoles. (#27965)
AzureCliCredential
now works even whenaz
prints warnings to stderr. (#26857) (thanks to @micromaomao for the contribution)- Fixed issue where user-supplied
TokenCachePersistenceOptions
weren't propagated when usingSharedTokenCacheCredential
(#26982)
- Excluded
VisualStudioCodeCredential
fromDefaultAzureCredential
token chain by default as SDK authentication via Visual Studio Code is broken due to issue #23249. TheVisualStudioCodeCredential
will be re-enabled in theDefaultAzureCredential
flow once a fix is in place. Issue #25713 tracks this. In the meantime Visual Studio Code users can authenticate their development environment using the Azure CLI.
- Added Python 3.11 support and stopped supporting Python 3.6.
1.12.0 release candidate
- Added ability to specify
tenant_id
forAzureCliCredential
&AzurePowerShellCredential
(thanks @tikicoder) (#25207) - Removed
VisualStudioCodeCredential
fromDefaultAzureCredential
token chain. (#23249) EnvironmentCredential
addedAZURE_CLIENT_CERTIFICATE_PASSWORD
support for the cert password (#24652)- Added
validate_authority
support for msal client (#22625)
- Added
additionally_allowed_tenants
to the following credential options to force explicit opt-in behavior for multi-tenant authentication:AuthorizationCodeCredential
AzureCliCredential
AzurePowerShellCredential
CertificateCredential
ClientAssertionCredential
ClientSecretCredential
DefaultAzureCredential
OnBehalfOfCredential
UsernamePasswordCredential
VisualStudioCodeCredential
- Credential types supporting multi-tenant authentication will now throw
ClientAuthenticationError
if the requested tenant ID doesn't match the credential's tenant ID, and is not included inadditionally_allowed_tenants
. Applications must now explicitly add additional tenants to theadditionally_allowed_tenants
list, or add '*' to list, to enable acquiring tokens from tenants other than the originally specified tenant ID.
More information on this change and the consideration behind it can be found here.
- These beta features in 1.11.0b3 have been removed from this release and will be added back in 1.12.0b1
tenant_id
forAzureCliCredential
- removed
VisualStudioCodeCredential
fromDefaultAzureCredential
token chain AZURE_CLIENT_CERTIFICATE_PASSWORD
support forEnvironmentCredential
validate_authority
support
Azure-identity is supported on Python 3.7 or later. For more details, please read our page on Azure SDK for Python version support policy.
- Added ability to specify
tenant_id
forAzureCliCredential
(thanks @tikicoder) (#25207)
- Removed
VisualStudioCodeCredential
fromDefaultAzureCredential
token chain. (#23249)
EnvironmentCredential
addedAZURE_CLIENT_CERTIFICATE_PASSWORD
support for the cert password (#24652)
- Fixed the issue that failed to parse PEM certificate if it does not start with "-----" (#24643)
- Added
validate_authority
support for msal client (#22625)
These changes do not impact the API of stable versions such as 1.9.0. Only code written against a beta version such as 1.10.0b1 may be affected.
validate_authority
support is not available in 1.10.0.
- Supported msal-extensions version 1.0.0 (#23927)
- Added
validate_authority
support for msal client (#22625)
- Added PII logging if logging.DEBUG is enabled. (#23203)
These changes do not impact the API of stable versions such as 1.8.0. Only code written against a beta version such as 1.9.0b1 may be affected.
validate_authority
support is not available in 1.9.0.
- Added check on
content
from msal response. (#23483) - Fixed the issue that async OBO credential does not refresh correctly. (#21981)
- Removed
resource_id
, please useidentity_config
instead. - Renamed argument name
get_assertion
tofunc
forClientAssertionCredential
.
- Added
validate_authority
support for msal client (#22625) - Added
resource_id
support for user-assigned managed identity (#22329) - Added
ClientAssertionCredential
support (#22328) - Updated App service API version to "2019-08-01" (#23034)
-
Handle injected "tenant_id" and "claims" (#23138)
"tenant_id" argument in get_token() method is only supported by:
AuthorizationCodeCredential
AzureCliCredential
AzurePowerShellCredential
InteractiveBrowserCredential
DeviceCodeCredential
EnvironmentCredential
UsernamePasswordCredential
it is ignored by other types of credentials.
- Python 2.7 is no longer supported. Please use Python version 3.6 or later.
- Fix multi-tenant auth using async AadClient (#21289)
These changes do not impact the API of stable versions such as 1.6.0. Only code written against a beta version such as 1.7.0b1 may be affected.
- The
allow_multitenant_authentication
argument has been removed and the default behavior is now as if it were true. The multitenant authentication feature can be totally disabled by setting the environment variableAZURE_IDENTITY_DISABLE_MULTITENANTAUTH
toTrue
. azure.identity.RegionalAuthority
is removed.regional_authority
argument is removed forCertificateCredential
andClientSecretCredential
.AzureApplicationCredential
is removed.client_credential
in the ctor ofOnBehalfOfCredential
is removed. Please useclient_secret
orclient_certificate
instead.- Make
user_assertion
in the ctor ofOnBehalfOfCredential
a keyword only argument.
CertificateCredential
accepts certificates in PKCS12 format (#13540)OnBehalfOfCredential
supports the on-behalf-of authentication flow for accessing resources on behalf of users (#19308)DefaultAzureCredential
allows specifying the client ID of interactive browser via keyword argumentinteractive_browser_client_id
(#20487)
- Added context manager methods and
close()
to credentials in theazure.identity
namespace. At the end of awith
block, or whenclose()
is called, these credentials close their underlying transport sessions. (#18798)
- Persistent cache implementations are now loaded on demand, enabling workarounds when importing transitive dependencies such as pywin32 fails (#19989)
These changes do not impact the API of stable versions such as 1.6.0. Only code written against a beta version such as 1.7.0b1 may be affected.
- Renamed
AZURE_POD_IDENTITY_TOKEN_URL
toAZURE_POD_IDENTITY_AUTHORITY_HOST
. The value should now be a host, for example "http://169.254.169.254" (the default).
- Fixed import of
azure.identity.aio.AzureApplicationCredential
(#19943)
- Added
CustomHookPolicy
to credential HTTP pipelines. This allows applications to initialize credentials withraw_request_hook
andraw_response_hook
keyword arguments. The value of these arguments should be a callback taking aPipelineRequest
andPipelineResponse
, respectively. For example:ManagedIdentityCredential(raw_request_hook=lambda request: print(request.http_request.url))
- Reduced redundant
ChainedTokenCredential
andDefaultAzureCredential
logging. On Python 3.7+, credentials invoked by these classes now log debug rather than info messages. (#18972) - Persistent cache implementations are now loaded on demand, enabling workarounds when importing transitive dependencies such as pywin32 fails (#19989)
InteractiveBrowserCredential
keyword argumentlogin_hint
enables pre-filling the username/email address field on the login page (#19225)AzureApplicationCredential
, a default credential chain for applications deployed to Azure (#19309)
azure.identity.aio.ManagedIdentityCredential
is an async context manager that closes its underlying transport session at the end of awith
block
- Most credentials can use tenant ID values returned from authentication
challenges, enabling them to request tokens from the correct tenant. This
behavior is optional and controlled by a new keyword argument,
allow_multitenant_authentication
. (#19300)- When
allow_multitenant_authentication
is False, which is the default, a credential will raiseClientAuthenticationError
when its configured tenant doesn't match the tenant specified for a token request. This may be a different exception than was raised by prior versions of the credential. To maintain the prior behavior, set environment variable AZURE_IDENTITY_ENABLE_LEGACY_TENANT_SELECTION to "True".
- When
CertificateCredential
andClientSecretCredential
support regional STS on Azure VMs by either keyword argumentregional_authority
or environment variableAZURE_REGIONAL_AUTHORITY_NAME
. Seeazure.identity.RegionalAuthority
for possible values. (#19301)- Upgraded minimum
azure-core
version to 1.11.0 and minimummsal
version to 1.12.0 - After IMDS authentication fails,
ManagedIdentityCredential
raises consistent error messages and usesraise from
to propagate inner exceptions (#19423)
Beginning with this release, this library requires Python 2.7 or 3.6+.
VisualStudioCodeCredential
gets its default tenant and authority configuration from VS Code user settings (#14808)
This is the last version to support Python 3.5. The next version will require Python 2.7 or 3.6+.
AzurePowerShellCredential
authenticates as the identity logged in to Azure PowerShell. This credential is part ofDefaultAzureCredential
by default but can be disabled by a keyword argument:DefaultAzureCredential(exclude_powershell_credential=True)
(#17341)
AzureCliCredential
raisesCredentialUnavailableError
when the CLI times out, and kills timed out subprocesses- Reduced retry delay for
ManagedIdentityCredential
on Azure VMs
These changes do not impact the API of stable versions such as 1.5.0. Only code written against a beta version such as 1.6.0b1 may be affected.
- Removed property
AuthenticationRequiredError.error_details
- Credentials consistently retry token requests after connection failures, or when instructed to by a Retry-After header
- ManagedIdentityCredential caches tokens correctly
InteractiveBrowserCredential
functions in more WSL environments (#17615)
These changes do not impact the API of stable versions such as 1.5.0. Only code written against a beta version such as 1.6.0b1 may be affected.
-
Renamed
CertificateCredential
keyword argumentcertificate_bytes
tocertificate_data
-
Credentials accepting keyword arguments
allow_unencrypted_cache
andenable_persistent_cache
to configure persistent caching accept acache_persistence_options
argument instead whose value should be an instance ofTokenCachePersistenceOptions
. For example:# before (e.g. in 1.6.0b1): DeviceCodeCredential(enable_persistent_cache=True, allow_unencrypted_cache=True) # after: cache_options = TokenCachePersistenceOptions(allow_unencrypted_storage=True) DeviceCodeCredential(cache_persistence_options=cache_options)
See the documentation and samples for more details.
- New class
TokenCachePersistenceOptions
configures persistent caching - The
AuthenticationRequiredError.claims
property provides any additional claims required by a user credential'sauthenticate()
method
- Raised minimum msal version to 1.7.0
- Raised minimum six version to 1.12.0
InteractiveBrowserCredential
uses PKCE internally to protect authorization codesCertificateCredential
can load a certificate from bytes instead of a file path. To provide a certificate as bytes, use the keyword argumentcertificate_bytes
instead ofcertificate_path
, for example:CertificateCredential(tenant_id, client_id, certificate_bytes=cert_bytes)
(#14055)- User credentials support Continuous Access Evaluation (CAE)
- Application authentication APIs from 1.5.0b2
ManagedIdentityCredential
correctly parses responses from the current (preview) version of Azure ML managed identity (#15361)
- Renamed optional
CertificateCredential
keyword argumentsend_certificate
(added in 1.5.0b1) tosend_certificate_chain
- Removed user authentication APIs added in prior betas. These will be
reintroduced in 1.6.0b1. Passing the keyword arguments below
generally won't cause a runtime error, but the arguments have no effect.
(#14601)
- Removed
authenticate
method fromDeviceCodeCredential
,InteractiveBrowserCredential
, andUsernamePasswordCredential
- Removed
allow_unencrypted_cache
andenable_persistent_cache
keyword arguments fromCertificateCredential
,ClientSecretCredential
,DeviceCodeCredential
,InteractiveBrowserCredential
, andUsernamePasswordCredential
- Removed
disable_automatic_authentication
keyword argument fromDeviceCodeCredential
andInteractiveBrowserCredential
- Removed
allow_unencrypted_cache
keyword argument fromSharedTokenCacheCredential
- Removed classes
AuthenticationRecord
andAuthenticationRequiredError
- Removed
- Removed
identity_config
keyword argument fromManagedIdentityCredential
(was added in 1.5.0b1)
DeviceCodeCredential
parameterclient_id
is now optional. When not provided, the credential will authenticate users to an Azure development application. (#14354)- Credentials raise
ValueError
when constructed with tenant IDs containing invalid characters (#14821) - Raised minimum msal version to 1.6.0
- Prevent
VisualStudioCodeCredential
using invalid authentication data when no user is signed in to Visual Studio Code (#14438) ManagedIdentityCredential
uses the API version supported by Azure Functions on Linux consumption hosting plans (#14670)InteractiveBrowserCredential.get_token()
raises a clearer error message when it times out waiting for a user to authenticate on Python 2.7 (#14773)
AzureCliCredential.get_token
correctly sets token expiration time, preventing clients from using expired tokens (#14345)
- Adopted msal-extensions 0.3.0 (#13107)
AzureCliCredential.get_token
correctly sets token expiration time, preventing clients from using expired tokens (#14345)
- Application authentication APIs from 1.4.0b7
ManagedIdentityCredential
supports the latest version of App Service (#11346)DefaultAzureCredential
allows specifying the client ID of a user-assigned managed identity via keyword argumentmanaged_identity_client_id
(#12991)CertificateCredential
supports Subject Name/Issuer authentication when created withsend_certificate=True
. The asyncCertificateCredential
(azure.identity.aio.CertificateCredential
) will support this in a future version. (#10816)- Credentials in
azure.identity
support ADFS authorities, exceptingVisualStudioCodeCredential
. To configure a credential for this, configure the credential withauthority
andtenant_id="adfs"
keyword arguments, for exampleClientSecretCredential(authority="<your ADFS URI>", tenant_id="adfs")
. Async credentials (those inazure.identity.aio
) will support ADFS in a future release. (#12696) InteractiveBrowserCredential
keyword argumentredirect_uri
enables authentication with a user-specified application having a custom redirect URI (#13344)
- Removed
authentication_record
keyword argument from the asyncSharedTokenCacheCredential
, i.e.azure.identity.aio.SharedTokenCacheCredential
DefaultAzureCredential
uses the value of environment variableAZURE_CLIENT_ID
to configure a user-assigned managed identity. (#10931)
- Renamed
VSCodeCredential
toVisualStudioCodeCredential
- Removed application authentication APIs added in 1.4.0 beta versions. These
will be reintroduced in 1.5.0b1. Passing the keyword arguments below
generally won't cause a runtime error, but the arguments have no effect.
- Removed
authenticate
method fromDeviceCodeCredential
,InteractiveBrowserCredential
, andUsernamePasswordCredential
- Removed
allow_unencrypted_cache
andenable_persistent_cache
keyword arguments fromCertificateCredential
,ClientSecretCredential
,DeviceCodeCredential
,InteractiveBrowserCredential
, andUsernamePasswordCredential
- Removed
disable_automatic_authentication
keyword argument fromDeviceCodeCredential
andInteractiveBrowserCredential
- Removed
allow_unencrypted_cache
keyword argument fromSharedTokenCacheCredential
- Removed classes
AuthenticationRecord
andAuthenticationRequiredError
- Removed
identity_config
keyword argument fromManagedIdentityCredential
- Removed
DefaultAzureCredential
has a new optional keyword argument,visual_studio_code_tenant_id
, which sets the tenant the credential should authenticate in when authenticating as the Azure user signed in to Visual Studio Code.- Renamed
AuthenticationRecord.deserialize
positional parameterjson_string
todata
.
AzureCliCredential
no longer raises an exception due to unexpected output from the CLI when run by PyCharm (thanks @NVolcz) (#11362)- Upgraded minimum
msal
version to 1.3.0 - The async
AzureCliCredential
correctly invokes/bin/sh
(#12048)
- Prevent an error on importing
AzureCliCredential
on Windows caused by a bug in old versions of Python 3.6 (this bug was fixed in Python 3.6.5). (#12014) SharedTokenCacheCredential.get_token
raisesValueError
instead ofClientAuthenticationError
when called with no scopes. (#11553)
ManagedIdentityCredential
can configure a user-assigned identity using any identifier supported by the current hosting environment. To specify an identity by its client ID, continue using theclient_id
argument. To specify an identity by any other ID, use theidentity_config
argument, for example:ManagedIdentityCredential(identity_config={"object_id": ".."})
(#10989)CertificateCredential
andClientSecretCredential
can optionally store access tokens they acquire in a persistent cache. To enable this, construct the credential withenable_persistent_cache=True
. On Linux, the persistent cache requires libsecret andpygobject
. If these are unavailable or unusable (e.g. in an SSH session), loading the persistent cache will raise an error. You may optionally configure the credential to fall back to an unencrypted cache by constructing it with keyword argumentallow_unencrypted_cache=True
. (#11347)AzureCliCredential
raisesCredentialUnavailableError
when no user is logged in to the Azure CLI. (#11819)AzureCliCredential
andVSCodeCredential
, which enable authenticating as the identity signed in to the Azure CLI and Visual Studio Code, respectively, can be imported fromazure.identity
andazure.identity.aio
.azure.identity.aio.AuthorizationCodeCredential.get_token()
no longer accepts optional keyword argumentsexecutor
orloop
. Prior versions of the method didn't use these correctly, provoking exceptions, and internal changes in this version have made them obsolete.InteractiveBrowserCredential
raisesCredentialUnavailableError
when it can't start an HTTP server onlocalhost
. (#11665)- When constructing
DefaultAzureCredential
, you can now configure a tenant ID forInteractiveBrowserCredential
. When none is specified, the credential authenticates users in their home tenants. To specify a different tenant, use the keyword argumentinteractive_browser_tenant_id
, or set the environment variableAZURE_TENANT_ID
. (#11548) SharedTokenCacheCredential
can be initialized with anAuthenticationRecord
provided by a user credential. (#11448)- The user authentication API added to
DeviceCodeCredential
andInteractiveBrowserCredential
in 1.4.0b3 is available onUsernamePasswordCredential
as well. (#11449) - The optional persistent cache for
DeviceCodeCredential
andInteractiveBrowserCredential
added in 1.4.0b3 is now available on Linux and macOS as well as Windows. (#11134)- On Linux, the persistent cache requires libsecret and
pygobject
. If these are unavailable, or libsecret is unusable (e.g. in an SSH session), loading the persistent cache will raise an error. You may optionally configure the credential to fall back to an unencrypted cache by constructing it with keyword argumentallow_unencrypted_cache=True
.
- On Linux, the persistent cache requires libsecret and
EnvironmentCredential
correctly initializesUsernamePasswordCredential
with the value ofAZURE_TENANT_ID
(#11127)- Values for the constructor keyword argument
authority
andAZURE_AUTHORITY_HOST
may optionally specify an "https" scheme. For example, "https://login.microsoftonline.us" and "login.microsoftonline.us" are both valid. (#10819) - First preview of new API for authenticating users with
DeviceCodeCredential
andInteractiveBrowserCredential
(#10612)- new method
authenticate
interactively authenticates a user, returns a serializableAuthenticationRecord
- new constructor keyword arguments
authentication_record
enables initializing a credential with anAuthenticationRecord
from a prior authenticationdisable_automatic_authentication=True
configures the credential to raiseAuthenticationRequiredError
when interactive authentication is necessary to acquire a token rather than immediately begin that authenticationenable_persistent_cache=True
configures these credentials to use a persistent cache on supported platforms (in this release, Windows only). By default they cache in memory only.
- new method
- Now
DefaultAzureCredential
can authenticate with the identity signed in to Visual Studio Code's Azure extension. (#10472)
- After an instance of
DefaultAzureCredential
successfully authenticates, it uses the same authentication method for every subsequent token request. This makes subsequent requests more efficient, and prevents unexpected changes of authentication method. (#10349) - All
get_token
methods consistently require at least one scope argument, raising an error when none is passed. Althoughget_token()
may sometimes have succeeded in prior versions, it couldn't do so consistently because its behavior was undefined, and dependened on the credential's type and internal state. (#10243) SharedTokenCacheCredential
raisesCredentialUnavailableError
when the cache is available but contains ambiguous or insufficient information. This causesChainedTokenCredential
to correctly try the next credential in the chain. (#10631)- The host of the Active Directory endpoint credentials should use can be set
in the environment variable
AZURE_AUTHORITY_HOST
. Seeazure.identity.KnownAuthorities
for a list of common values. (#8094)
ManagedIdentityCredential
raisesCredentialUnavailableError
when no identity is configured for an IMDS endpoint. This causesChainedTokenCredential
to correctly try the next credential in the chain. (#10488)
DefaultAzureCredential
can now authenticate using the identity logged in to the Azure CLI, unless explicitly disabled with a keyword argument:DefaultAzureCredential(exclude_cli_credential=True)
(#10092)
- Correctly parse token expiration time on Windows App Service (#9393)
- Credentials raise
CredentialUnavailableError
when they can't attempt to authenticate due to missing data or state (#9372) CertificateCredential
supports password-protected private keys (#9434)
- All credential pipelines include
ProxyPolicy
(#8945) - Async credentials are async context managers and have an async
close
method (#9090)
- Constructing
DefaultAzureCredential
no longer raisesImportError
on Python 3.8 on Windows (8294) InteractiveBrowserCredential
raises when unable to open a web browser (8465)InteractiveBrowserCredential
prompts for account selection (8470)- The credentials composing
DefaultAzureCredential
are configurable by keyword arguments (8514) SharedTokenCacheCredential
accepts an optionaltenant_id
keyword argument (8689)
ClientCertificateCredential
uses application and tenant IDs correctly (8315)InteractiveBrowserCredential
properly caches tokens (8352)- Adopted msal 1.0.0 and msal-extensions 0.1.3 (8359)
- Async credentials now default to
aiohttp
for transport but the library does not require it as a dependency because the async API is optional. To use async credentials, please installaiohttp
or see azure-core documentation for information about customizing the transport. - Renamed
ClientSecretCredential
parameter "secret
" to "client_secret
" - All credentials with
tenant_id
andclient_id
positional parameters now accept them in that order - Changes to
InteractiveBrowserCredential
parameters- positional parameter
client_id
is now an optional keyword argument. If no value is provided, the Azure CLI's client ID will be used. - Optional keyword argument
tenant
renamedtenant_id
- positional parameter
- Changes to
DeviceCodeCredential
- optional positional parameter
prompt_callback
is now a keyword argument prompt_callback
's third argument is now adatetime
representing the expiration time of the device code- optional keyword argument
tenant
renamedtenant_id
- optional positional parameter
- Changes to
ManagedIdentityCredential
- now accepts no positional arguments, and only one keyword argument:
client_id
- transport configuration is now done through keyword arguments as
described in
azure-core
documentation
- now accepts no positional arguments, and only one keyword argument:
- Authenticating with a single sign-on shared with other Microsoft applications only requires a username when multiple users have signed in (#8095)
DefaultAzureCredential
accepts anauthority
keyword argument, enabling its use in national clouds (#8154)
- Adopted
msal_extensions
0.1.2 - Constrained
msal
requirement to >=0.4.1, <1.0.0
AuthorizationCodeCredential
authenticates with a previously obtained authorization code. See Microsoft Entra's authorization code documentation for more information about this authentication flow.- Multi-cloud support: client credentials accept the authority of an Azure Active
Directory authentication endpoint as an
authority
keyword argument. Known authorities are defined inazure.identity.KnownAuthorities
. The default authority is for Azure Public Cloud,login.microsoftonline.com
(KnownAuthorities.AZURE_PUBLIC_CLOUD
). An application running in Azure Government would useKnownAuthorities.AZURE_GOVERNMENT
instead:
from azure.identity import DefaultAzureCredential, KnownAuthorities credential = DefaultAzureCredential(authority=KnownAuthorities.AZURE_GOVERNMENT)
- Removed
client_secret
parameter fromInteractiveBrowserCredential
UsernamePasswordCredential
correctly handles environment configuration with no tenant information (#7260)- user realm discovery requests are sent through credential pipelines (#7260)
SharedTokenCacheCredential
authenticates with tokens stored in a local cache shared by Microsoft applications. This enables Azure SDK clients to authenticate silently after you've signed in to Visual Studio 2019, for example.DefaultAzureCredential
includesSharedTokenCacheCredential
when the shared cache is available, and environment variableAZURE_USERNAME
is set. See the README for more information.
- New dependency:
msal-extensions
0.1.1
- Removed
azure.core.Configuration
from the public API in preparation for a revamped configuration API. Staticcreate_config
methods have been renamed_create_config
, and will be removed in a future release.
- Adopted azure-core 1.0.0b2
- If you later want to revert to a version requiring azure-core 1.0.0b1,
of this or another Azure SDK library, you must explicitly install azure-core
1.0.0b1 as well. For example:
pip install azure-core==1.0.0b1 azure-identity==1.0.0b1
- If you later want to revert to a version requiring azure-core 1.0.0b1,
of this or another Azure SDK library, you must explicitly install azure-core
1.0.0b1 as well. For example:
- Adopted MSAL 0.4.1
- New dependency for Python 2.7: mock
- Added credentials for authenticating users:
DeviceCodeCredential
InteractiveBrowserCredential
UsernamePasswordCredential
- async versions of these credentials will be added in a future release
Version 1.0.0b1 is the first preview of our efforts to create a user-friendly and Pythonic authentication API for Azure SDK client libraries. For more information about preview releases of other Azure SDK libraries, please visit https://aka.ms/azure-sdk-preview1-python.
This release supports service principal and managed identity authentication. See the documentation for more details. User authentication will be added in an upcoming preview release.
This release supports only global Microsoft Entra tenants, i.e. those using the https://login.microsoftonline.com authentication endpoint.