6

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
Alex Ott
  • 80,552
  • 8
  • 87
  • 132
user3023949
  • 121
  • 2
  • 8

4 Answers4

8

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
Alex Ott
  • 80,552
  • 8
  • 87
  • 132
4

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

CHEEKATLAPRADEEP
  • 12,191
  • 1
  • 19
  • 42
  • If it is useful for you, could you please [accept it as an answer](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work)? It may help more people who have similar issue. – CHEEKATLAPRADEEP Oct 05 '20 at 06:15
  • the first solution worked without any issue, si – alex3465 Aug 09 '22 at 09:59
4

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
0

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.

Le Poissons
  • 39
  • 1
  • 4