[Identity] Allow policy override#46072
Merged
pvaneck merged 1 commit intoAzure:mainfrom Apr 24, 2026
Merged
Conversation
eed8524 to
5185c18
Compare
5185c18 to
ae758fd
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Enables azure-identity credentials to accept HTTP pipeline policy overrides (similar to azure.core clients), allowing callers to inject/replace built-in policies and insert custom per-call/per-retry policies.
Changes:
- Updated internal pipeline construction to accept policy instances via kwargs (e.g.,
headers_policy,per_call_policies,per_retry_policies,retry_policy). - Updated IMDS credentials (sync + async) to use a
retry_policyinstance override instead ofretry_policy_class. - Added tests and a changelog entry documenting policy overrides.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/identity/azure-identity/tests/test_pipeline_policy_overrides.py | Adds unit tests covering config/policy override behavior and pipeline assembly order. |
| sdk/identity/azure-identity/azure/identity/aio/_credentials/imds.py | Switches async IMDS to accept/provide a retry_policy instance. |
| sdk/identity/azure-identity/azure/identity/aio/_credentials/azure_arc.py | Updates arg name to per_retry_policies for policy injection. |
| sdk/identity/azure-identity/azure/identity/_internal/pipeline.py | Implements policy override wiring and per-call/per-retry insertion around retry. |
| sdk/identity/azure-identity/azure/identity/_credentials/imds.py | Switches sync IMDS to accept/provide a retry_policy instance. |
| sdk/identity/azure-identity/CHANGELOG.md | Documents the new override support. |
Similar to SDK clients, this allows credential pipelines to be customized at the policy level. Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>
ae758fd to
cbc280b
Compare
xiangyan99
approved these changes
Apr 24, 2026
fafhrd91
pushed a commit
to fafhrd91/azure-sdk-for-python
that referenced
this pull request
Apr 28, 2026
Similar to SDK clients, this allows credential pipelines to be customized at the policy level. Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Similar to SDK clients, this allows credential pipelines to be customized at the policy level.