Azure Databricks - Workspace Name

Gopinath Rajee 656 Reputation points
2022-06-09T05:02:51.837+00:00

All,

How do I get the Azure Databricks Workspace name in the databricks CLI. I have workspaces defined for various environments and I want to get the workspace name while running secretscope to ensure that the current session is indeed pointing to the correct workspace.

**

databricks secrets list-scopes --profile Dev

**

Scope Backend KeyVault URL


DataEngKV-Dev-secretscope AZURE_KEYVAULT https://DataEngKV-dev.vault.azure.net/

Thanks,
grajee

Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,517 questions
{count} votes

Accepted answer
  1. PRADEEPCHEEKATLA 90,641 Reputation points Moderator
    2022-06-09T14:54:37.183+00:00

    Hello @Gopinath Rajee ,

    Thanks for the question and using MS Q&A platform.

    Unfortunately, it is not possible to get the workspace name using CLI or APIs.

    I found this solution, which is not very elegant, but the owner of the post had to go through the Azure Resource API and parse the results to get the Workspace Name. The good news is that this can be executed from a Notebook: http://www.riveriq.com/blogs/2020/01/azure-databricks-notebook---how-to-get-current-workspace-name

    Do you have profiles configured for each environment? just add --profile <PROFILE> to your command and it will run in that workspace.

    When you create a profile for each workspace https://learn.microsoft.com/en-us/azure/databricks/dev-tools/cli/#--connection-profiles and then call databricks secret put X Y --profile my_ws_profile_name

    If you don't supply a profile argument, it will always use the default (whatever is marked [DEFAULT] in the .databrickscfg file / stored in your environment variables)

    If there is no default (eg first time running CLI) it will prompt you and create one.

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.