[Identity] Update AzureCliCredential executable search#41806
Merged
pvaneck merged 1 commit intoAzure:mainfrom Jun 30, 2025
Merged
[Identity] Update AzureCliCredential executable search#41806pvaneck merged 1 commit intoAzure:mainfrom
pvaneck merged 1 commit intoAzure:mainfrom
Conversation
Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances AzureCliCredential to correctly detect the az executable on Windows by checking for az.cmd before falling back to az.
- Add platform-specific search logic in both async and sync implementations.
- Update changelog to document the fix.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| azure/identity/aio/_credentials/azure_cli.py | Added Windows-specific az.cmd fallback logic in _run_command. |
| azure/identity/_credentials/azure_cli.py | Added Windows-specific az.cmd fallback logic in _run_command. |
| CHANGELOG.md | Documented the bug fix for AzureCliCredential on Windows. |
Comments suppressed due to low confidence (2)
sdk/identity/azure-identity/azure/identity/aio/_credentials/azure_cli.py:191
- The default
az_pathassignment is not indented under theelseblock, so on Windows the earlier check foraz.cmdis always overwritten. Indent this line to be inside theelse.
az_path = shutil.which(EXECUTABLE_NAME)
sdk/identity/azure-identity/azure/identity/_credentials/azure_cli.py:241
- The default
az_pathassignment should be inside theelseblock. Currently it executes unconditionally, overriding the Windows-specific path. Please adjust indentation.
az_path = shutil.which(EXECUTABLE_NAME)
xiangyan99
approved these changes
Jun 30, 2025
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.
Closes: #41789