I’m trying to run a script in IDLE to get a token for connection to company Azure resource. The line token = AzureCliCredential().get_token(scope).token
throws the error: azure.identity._exceptions.CredentialUnavailableError: Azure CLI not found on path
I am certain that Azure Cli is installed on machine and is on path. az login
works from the terminal. az --version
returns the following:
az --version
azure-cli 2.63.0
core 2.63.0
telemetry 1.1.0
Dependencies:
msal 1.30.0
azure-mgmt-resource 23.1.1
Python location '/opt/homebrew/Cellar/azure-cli/2.63.0/libexec/bin/python'
Extensions directory '/Users/*******/.azure/cliextensions'
Python (Darwin) 3.11.9 (main, Apr 2 2024, 08:25:04) [Clang 15.0.0 (clang-1500.3.9.4)]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
This is the contents of /etc/paths:
/usr/local/bin
/System/Cryptexes/App/usr/bin
/usr/bin
/bin
/usr/sbin
/sbin
When I ran the same script on my Windows machine previously, it would take my Azure CLI credentials from running az login
and retrieve a bearer token for an http request to my azure function, authenticating the connection. I’ve recently changed over to a mac workstation (macOS Sonoma Version 14.6, M2 Pro chip) and I’ve had issues with getting Azure and python to play together nicely. I’m new to the mac environment, so I’m struggling to do things that are straight forward to me in Windows. I suspect that the issue has to do with the IDLE/Python version since the az –version lists Python 3.11.9 and IDLE version is 3.12.4, but I’m not sure.
Cory Knoll is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.