How to authenticate Databrics API using .netrc file

2.5k Views Asked by At

I have created ".netrc " file on my machine and trying below databricks rest api call. But it always giving an unauthorized error. How to create .netrc file in Databricks?

curl -n -X GET https:///api/2.0/token/list

How to use .netrc file with databricks api?

2

There are 2 best solutions below

9
On

My .netrc file looks like this:

machine northeurope.azuredatabricks.net
login token
password dapicxxxxxxxxxxxxxxxxxxxxx

Machine should be the region where your workspace is deployed, login is always token and the password the token created for your user.

See Databricks documentation how to create the token.

0
On

Easier way to configure databricks cli is to install databricks-cli package using the below command

pip install --upgrade databricks-cli

Then:

databricks configure --token (enter hostname/auth-token at prompt)

Instructions are available at https://pypi.org/project/databricks-cli/