I am trying to use databricks-cli in a devops pipeline on azure. For that I need to create a profile, using:
databricks configure --profile Profile --token
The problem is that when I run that command, it asks me for host and token which breaks my pipeline waiting for user input. I would like to know if it is possible to do this without passing the arguments.
I already tried this:
echo "configuring databrick-cli authentication"
declare DATABRICKS_URL="https://westeurope.azuredatabricks.net"
declare DATABRICKS_ACCESS_TOKEN="authentication_token_generated_from_databricks_ux"
declare dbconfig=$(<~/.databrickscfg)
if [[ $dbconfig = *"host = "* && $dbconfig = *"token = "* ]]; then
echo "file [~/.databrickscfg] is already configured"
else
if [[ -z "$DATABRICKS_URL" || -z "$DATABRICKS_ACCESS_TOKEN" ]]; then
echo "file [~/.databrickscfg] is not configured, but [DATABRICKS_URL],[DATABRICKS_ACCESS_TOKEN] env vars are not set"
else
echo "populating [~/.databrickscfg]"
> ~/.databrickscfg
echo "[DEFAULT]" >> ~/.databrickscfg
echo "host = $DATABRICKS_URL" >> ~/.databrickscfg
echo "token = $DATABRICKS_ACCESS_TOKEN" >> ~/.databrickscfg
echo "" >> ~/.databrickscfg
fi
fi
I am trying to put host and token in databrickscfg
but it just hangs in there, I guess it is waiting for the user input again
What am I doing wrong?