Skip to content

[Identity] Update AzureCliCredential executable search#41806

Merged
pvaneck merged 1 commit intoAzure:mainfrom
pvaneck:identity-cli-az
Jun 30, 2025
Merged

[Identity] Update AzureCliCredential executable search#41806
pvaneck merged 1 commit intoAzure:mainfrom
pvaneck:identity-cli-az

Conversation

@pvaneck
Copy link
Member

@pvaneck pvaneck commented Jun 27, 2025

Closes: #41789

Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>
@pvaneck pvaneck marked this pull request as ready for review June 30, 2025 18:16
Copilot AI review requested due to automatic review settings June 30, 2025 18:16
@pvaneck pvaneck requested review from a team and xiangyan99 as code owners June 30, 2025 18:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_path assignment is not indented under the else block, so on Windows the earlier check for az.cmd is always overwritten. Indent this line to be inside the else.
        az_path = shutil.which(EXECUTABLE_NAME)

sdk/identity/azure-identity/azure/identity/_credentials/azure_cli.py:241

  • The default az_path assignment should be inside the else block. Currently it executes unconditionally, overriding the Windows-specific path. Please adjust indentation.
        az_path = shutil.which(EXECUTABLE_NAME)

@github-project-automation github-project-automation bot moved this from Untriaged to In Progress in Azure Identity SDK Improvements Jun 30, 2025
@pvaneck pvaneck merged commit 159fa17 into Azure:main Jun 30, 2025
29 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Azure Identity SDK Improvements Jun 30, 2025
@pvaneck pvaneck deleted the identity-cli-az branch June 30, 2025 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

Error using AzureCliCredential with Python 3.12.0 - 3.12.7 on Windows: "Failed to execute 'c:\Program Files\Microsoft SDKs\Azure\CLI2\wbin\az'"

3 participants