This document provides a step-by-step guide to setting up the Databricks CLI on a Linux system. The Databricks CLI enables interaction with Databricks using the command-line interface.

Prerequisites

Before you begin, ensure the following prerequisites are met:

  • Python and pip should be installed on your Linux system.

Step-by-step guide

Step 1: Install Databricks-CLI Module

  1. Open a terminal on your Linux machine.
  2. Run the following command to install the Databricks-CLI module using pip:
    pip install databricks-cli
 Step 2: Configure Databricks CLI
  1. In the terminal, run the following command to configure the Databricks CLI:
    databricks configure
  2. Enter the required details when prompted:
    1. Databricks Host: Enter the Databricks host URL (e.g., {+}https://adb-68686xxxxxxxxxxx.7.azuredatabricks.net+).
    2. Username: Enter your username (e.g., sample@example.com).
    3. Password: Enter your Databricks access token. Repeat for confirmation: Re-enter your Databricks access token.
  3. After providing the required details, the Databricks CLI will be configured.

Step 3: Check Databricks Configuration

  1. To verify the configuration, run the following command in the terminal:
    This command checks if the authentication is working properly. If no error is thrown, it indicates a successful configuration.
    databricks workspace ls /Users/sample@example.com
  2. Additionally, retrieve information about a specific cluster using the following command:
    databricks clusters get --cluster-id 1209-xxxxx-xxxxxxx
Replace 1209-xxxxx-xxxxxxx with the actual cluster ID. This command fetches details about the specified cluster, ensuring the CLI is properly connected to Databricks.

Conclusion

You have now successfully installed and configured the Databricks CLI on Linux. Utilize the CLI to interact with Databricks and perform various operations from the command line.