databrickssecret-key

How to fix 'command not found' error in Databricks when creating a secret scope


I am trying to create a secret scope in a Databricks notebook. The notebook is running using a cluster created by my company's admin - I don't have access to create or edit clusters. I'm following the instructions in the Databricks user notebooks (https://docs.databricks.com/user-guide/secrets/example-secret-workflow.html#example-secret-workflow) but get an error:

/bin/bash: databricks: command not found

Below is the code I've tried that returns the error:

%sh -e
databricks secrets create-scope --scope scopename

sh% is used so I can run the command line language in the notebook. I've tried using

%sh

and also

%sh -e

no luck.

I should be able to create a secret scope using this code but have had no luck. Any suggestions on the cause of this? Has anyone else had the same issue?


Solution

  • I've not heard of running the CLI from the cluster before. Even if it is installed I doubt it is configured. You can download the CLI and run it from your local machine: https://docs.databricks.com/user-guide/dev-tools/databricks-cli.html

    You will need to be running Python locally. If you prefer there is also a PowerShell command-line (disclaimer I produced this): https://github.com/DataThirstLtd/azure.databricks.cicd.tools