Use Databricks CLI from Azure Cloud Shell
Learn how to use the Databricks CLI from Azure Cloud Shell to perform operations on Databricks.
An Azure Databricks workspace and cluster. For instructions, see Get started with Azure Databricks.
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
virtualenv -p /usr/bin/python2.7 databrickscli
Switch to the virtual environment you created.
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.