Use Databricks CLI from Azure Cloud Shell
Learn how to use the Databricks CLI from Azure Cloud Shell to perform operations on Databricks.
Prerequisites
An Azure Databricks workspace and cluster. For instructions, see Get started.
Set up a personal access token in Databricks. For instructions, see Token management.
Use the Azure Cloud Shell
Log in to the Azure portal.
From the top-right corner, click the Cloud Shell icon.
Make sure you select Bash for the Cloud Shell environment. You can select from the drop-down option, as shown in the following screenshot.
Create a virtual environment in which you can install the Databricks CLI. In the snippet below, you create a virtual environment called
databrickscli
. This virtual environment uses Python 3.9.virtualenv -p /usr/bin/python3.9 databrickscli
Switch to the virtual environment you created.
source databrickscli/bin/activate
Install the Databricks CLI.
pip install databricks-cli
Set up authentication with Databricks by using the access token that you must have created, listed as part of prerequisites. Use the following command:
databricks configure --token
You will receive the following prompts:
First, you are prompted to enter the Databricks host. Enter the value in the format
https://eastus2.azuredatabricks.net
. Here, East US 2 is the Azure region where you created your Azure Databricks workspace.Next, you are prompted to enter a token. Enter the token that you created earlier.
Once you complete these steps, you can start using Databricks CLI from Azure Cloud Shell.
Use Databricks CLI
You can now start using the Databricks CLI. For example, run the following command to list all the Databricks clusters that you have in your workspace.
databricks clusters list
You can also use the following command to access the Databricks filesystem (DBFS).
databricks fs ls
For a complete reference on commands, see Databricks CLI.
Next steps
- To learn more about Azure CLI, see Azure CLI overview
- To see a list of commands for Azure CLI, see Azure CLI reference
- To see a list of commands for Databricks CLI, see Databricks CLI
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for