Hi I'm getting this error when running commands with a new cluster. When I run a script with the old cluster, I don't get any errors but when I use the new one, I get this error.. Have anyone faced the same issue? Should I run this az login in Azure CLI? Any help is greatly appreciated!
/databricks/python/lib/python3.8/site-packages/azure/keyvault/secrets/_shared/challenge_auth_policy.py in _handle_challenge(self, request, challenge)
135 # azure-identity credentials require an AADv2 scope but the challenge may specify an AADv1 resource
136 scope = challenge.get_scope() or challenge.get_resource() + "/.default"
--> 137 self._token = self._credential.get_token(scope)
138
139 # ignore mypy's warning because although self._token is Optional, get_token raises when it fails to get a token
/databricks/python/lib/python3.8/site-packages/azure/identity/_internal/decorators.py in wrapper(*args, **kwargs)
25 [0;32mdef wrapper(*args, **kwargs):
26 try:
---> 27 token = fn(*args, **kwargs)
28 _LOGGER.info("%s succeeded", qualified_name)
29 return token
/databricks/python/lib/python3.8/site-packages/azure/identity/_credentials/azure_cli.py in get_token(self, *scopes, **kwargs)
56 output, error = _run_command(COMMAND_LINE.format(resource))
57 if error:
---> 58 raise error
59
60 token = parse_token(output)
CredentialUnavailableError: Please run 'az login' to set up an account
CredentialUnavailableError: Please run 'az login' to set up an account.
As per the error you are not authenticated with the Azure. This issue is caused by Azure CLI method of authentication.
To resolve this, you need to execute following commands in the Databricks notebook:
%sh
pip install azure-cli
az login
az account set --subscription <Subscription Id>
It will first install azure CLI on the head node then az login
will login you in your specific azure account and az account set --subscription
will set the context to use specific subscription.
My execution: