Skip to content

[Identity] Update AzureCliCredential executable search - #41806

Merged
Paul Van Eck (pvaneck) merged 1 commit into
Azure:mainfrom
pvaneck:identity-cli-az
Jun 30, 2025
Merged

Paul Van Eck (pvaneck) merged 1 commit into
Azure:mainfrom
pvaneck:identity-cli-az

Conversation

@pvaneck

Copy link
Copy Markdown
Member

Closes: #41789

Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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
Paul Van Eck (pvaneck) merged commit 159fa17 into Azure:main Jun 30, 2025
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Azure Identity SDK Improvements Jun 30, 2025
@pvaneck
Paul Van Eck (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