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
or upvote
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