โ02-15-2023 11:22 AM
Hello everyone, I am trying to setup Databricks CLI by referring to the Databricks CLI documentation. When I setup using the Personal Access Token, it works fine and I am able to access the workspace and fetch the results from the same workspace in Databricks notebook %sh mode.
But when I try to configure using AAD-TOKEN, it shows me the below message -
I have the AAD TOKEN value and I tried to add it to the env variable using the below command -
%sh
export DATABRICKS_AAD_TOKEN=<token_value>
But for some reason it doesn't show up in the env variable file.
Am I missing here something?
The Databricks documentation also doesn't provide much information on how to configure Databricks CLI using AAD-TOKEN. Is this correct way?
โ03-06-2023 03:57 AM
Hi @Juned Malaโ,
I was having exactly the same problem using Azure Databricks. I agree the documentation on setting up Databricks CLI is so inadequate, and others agree.
I'm using Azure Databricks on a Windows machine, with the Anaconda build for Python (authenticating using Anaconda PowerShell Prompt).
I think the problem for me first arose when running
databricks configure --aad-token
before I had set the Environment variable.
We need to make sure the Environment Variable is set before running the above command. I think you have done this part, but for the benefit of other readers I'll post it here. To set the Environment Variable, go to Control Panel, search for Environment Variables and click 'New' to enter a new (User) environment variable:
Variable name = DATABRICKS_AAD_TOKEN
Variable value= <your AD token>
Close down PowerShell and open it again. Run the command
databricks configure --aad-token
again. Enter your Databricks host URL when prompted, e.g.
https://adb-<workspace-id>.<random-number>.azuredatabricks.net
This should update the .databrickscfg file under your User directory (C:\Users\<user.id>) to include the Host and the AAD Token that you entered as the new Environment Variable.
Then try running
databricks workspace list /Users
and hopefully the Users in your Workspace Path will be listed, if authentication has succeeded.
โ02-16-2023 06:35 AM
Hi, have you already tried it with AAD token configuration , https://learn.microsoft.com/en-us/azure/databricks/dev-tools/cli/#--set-up-authentication-using-an-a...
โ02-16-2023 09:57 AM
Yes, I already tried all the steps in this document for the AAD token configuration but it shows the message in the screenshot above. I tried to add DATABRICKS_AAD_TOKEN to env but not working.
โ03-06-2023 03:57 AM
Hi @Juned Malaโ,
I was having exactly the same problem using Azure Databricks. I agree the documentation on setting up Databricks CLI is so inadequate, and others agree.
I'm using Azure Databricks on a Windows machine, with the Anaconda build for Python (authenticating using Anaconda PowerShell Prompt).
I think the problem for me first arose when running
databricks configure --aad-token
before I had set the Environment variable.
We need to make sure the Environment Variable is set before running the above command. I think you have done this part, but for the benefit of other readers I'll post it here. To set the Environment Variable, go to Control Panel, search for Environment Variables and click 'New' to enter a new (User) environment variable:
Variable name = DATABRICKS_AAD_TOKEN
Variable value= <your AD token>
Close down PowerShell and open it again. Run the command
databricks configure --aad-token
again. Enter your Databricks host URL when prompted, e.g.
https://adb-<workspace-id>.<random-number>.azuredatabricks.net
This should update the .databrickscfg file under your User directory (C:\Users\<user.id>) to include the Host and the AAD Token that you entered as the new Environment Variable.
Then try running
databricks workspace list /Users
and hopefully the Users in your Workspace Path will be listed, if authentication has succeeded.
โ03-10-2023 07:33 PM
Hi @Juned Malaโ
Hope all is well! Just wanted to check in if you were able to resolve your issue and would you be happy to share the solution or mark an answer as best? Else please let us know if you need more help.
We'd love to hear from you.
Thanks!
Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโt want to miss the chance to attend and share knowledge.
If there isnโt a group near you, start one and help create a community that brings people together.
Request a New Group