'databricks configure --token' hangs for input

7.3k views Asked by At

I run following task in Azure DevOps, it always hangs for input? Why wasn't my bash automatic supply working?

databricksUrl=https://...
databricksToken=*****

databricks configure --token << EOF
$(databricksUrl)
$(databricksToken)
EOF
4

There are 4 answers

3
chicken soup On

I have the same problem. My release pipeline worked fine in the past and now it got stuck at authentication step even though no changes were made.

UPDATTE: The problem was caused by the new version of databricks-cli (0.12.0). Using version 0.11.0 will solve the problem:

python -m pip install --upgrade pip setuptools wheel databricks-cli==0.11.0
2
CHEEKATLAPRADEEP On

You try the below Inline bash script to authenticate with Azure Databricks without variables.

databricks configure --token <<EOF
https://centralus.azuredatabricks.net
dapXXXXXXXXXXXXXXXXXXXXXX467
EOF

enter image description here

You try the below Inline bash script to authenticate with Azure Databricks with variables.

adburl="https://centralus.azuredatabricks.net"
token=dapXXXXXXXXXXXXXXXXXXXXXXXXX467
databricks configure --token <<EOF
$adburl
$token
EOF

enter image description here

Successfully authenticated with Azure Databricks:

enter image description here

OR

You can use DevOps for Azure Databricks extension.

This extension brings a set of tasks for you to operationalize build, test and deployment of Databricks Jobs and Notebooks.

Once DevOps for Azure Databricks extension installed, you can directly use Configure Databricks CLI by clicking on the Add tasks.

enter image description here

2
Alex Ott On

There are two solutions for Databricks CLI > 0.11.0:

  • Generate ~/.databricks.cfg directly in form:
echo "[DEFAULT]                                                               
host = $url
token = $token" > ~/.databricks.cfg
  • Use new options --host & --token-file to specify host & token:
echo $token > token-file
databricks configure --host $url --token-file token-file
rm -f token-file
0
Le Poissons On

I struggled with this for days. Two things I've seen is that when you have your token-file (in my Windows case %user%/.databrickscfg) in place and you execute

databricks configure --host https://centralus.azuredatabricks.net --token-file .databrickscfg

repacing https://centralus.azuredatabricks.net with your actual URL

  1. It doesn't give a success status message.

  2. It actually changes the file contents of your token-file. It replaces the token = dapi.... with token = [DEFAULT]. I'm deploying my solution in Azure Batch on remote nodes with a Start Task. So what I had to do (using application packages) is zip the .databrickscfg file and let Batch install it on the nodes. Then run

    databricks configure --host https://centralus.azuredatabricks.net --token-file .databrickscfg

then xcopy /Y the .databrickscfg file from the %AZ_BATCH_APP_PACKAGE_% location to the named user working directory %USERPROFILE%. Then run any databricks commands.