-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Identity] azure.identity.aio.AzureCliCredential unusable due to malformed command line #12048
Comments
Thanks for reporting this! It will be fixed in the next release.
Yes: to search the path for |
Hi @chlowell, thanks for the speedy response! The fix (#12056) seems to only address *nix, but I wonder if the bug exists on Windows too. Do you have the ability to test there? The synchronous client builds the args consistently for both platforms: azure-sdk-for-python/sdk/identity/azure-identity/azure/identity/_credentials/azure_cli.py Lines 100 to 103 in 485ee38
...but they're different in the async client (since your PR's merge): azure-sdk-for-python/sdk/identity/azure-identity/azure/identity/aio/_credentials/azure_cli.py Lines 62 to 65 in 485ee38
Note
Aha, so on *nix, that's not a concern; to execute something not in PATH, you must specify the filesystem path, e.g. |
Yes, it works on Windows.
I agree it would be better to be consistent with the sync version, if only so no one else wonders whether it works on Windows 😊
I haven't tested this behavior of |
Thanks for the detailed clarification :) |
The fix is available now in azure-identity 1.4.0b6. Thanks again for opening this issue. |
Describe the bug
The async flavor of AzureCliCredential doesn't properly construct the args for its
az account get-access-token
call, so/bin/sh
(bash on my system) barfs:It looks like this is the culprit:
azure-sdk-for-python/sdk/identity/azure-identity/azure/identity/aio/_credentials/azure_cli.py
Lines 61 to 65 in a7ac22a
I'm not intimately familiar with how Windows parses CLAs but that's definitely wrong on *nix, it should be
args = ("/bin/sh", "-c", command)
. Changing to that fixes the problem for me.Side note, it seems odd to use the shell at all. Is there a particular reason for that, as opposed to just giving the
az
command line directly, e.g.args = ('az', 'account', 'get-access-token', '--output', 'json', '--resource' 'https://vault.azure.net')
? This would also remove the need for the platform-specific code.To Reproduce
Change the vault name and secret name below, and run it on Mac. Linux probably suffers as well, but I'm not sure if Windows is affected:
Observe
azure.core.exceptions.ClientAuthenticationError: /bin/sh: - : invalid option
Expected behavior
The above should print the name and value for the secret.
The text was updated successfully, but these errors were encountered: