Azure CLI login with an Azure Databricks user account
Follow these steps to use the Azure CLI to log in to Azure Databricks with an Azure Databricks user account. For information about Azure Databricks user accounts, see Manage users.
Get the correct Azure subscription ID for your user account, if you do not already know this ID, by doing one of the following:
In your Azure Databricks workspace’s top navigation bar, click your username and then click Azure Portal. On the Azure Databricks workspace resource page that appears, click Overview in the sidebar. Then look for the Subscription ID field, which contains the subscription ID.
Use the Azure CLI to run the az databricks workspace list command, using the
--query
and-o
or--output
options to narrow down the results. Replaceadb-0000000000000000.0.azuredatabricks.net
with the name of your workspace instance, not including thehttps://
. In this example, the00000000-0000-0000-0000-000000000000
after/subscriptions/
in the output is the subscription ID.az databricks workspace list --query "[?workspaceUrl==\`adb-0000000000000000.0.azuredatabricks.net\`].{id:id}" -o tsv # /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-rg/providers/Microsoft.Databricks/workspaces/my-ws
If the following message displays, you are signed in to the wrong tenant:
The subscription of '<subscription-id>' doesn't exist in cloud 'AzureCloud'.
To sign in to the correct tenant, you must run theaz login
command again, using the-t
or--tenant
option to specify the correct tenant ID.You can get the tenant ID for an Azure Databricks workspace by running the command
curl -v <per-workspace-URL>/aad/auth
and looking in the output< location: https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000
, where00000000-0000-0000-0000-000000000000
is the tenant ID. See also Get subscription and tenant IDs in the Azure portal.az login -t <tenant-id>
After you have the correct Azure subscription ID for your user account, begin signing in to Azure by using the Azure CLI to run the az login command. After you run this command, follow the on-screen instructions to finish signing in with your account.
az login
Confirm that you are signed in to the correct subscription for your signed-in user. To do this, run the az account set command, using the
-s
or--subscription
option to specify the correct subscription ID.az account set -s <subscription-id>