Hello @Rohit Boddu ,
Thanks for the question and using MS Q&A platform.
As we understand the ask here is "how to install azure cli in databricks".
First, let me explain. Azure CLI is a "Command Line Interface." This means you run it from a command prompt. Databricks notebook isn't exactly a command prompt. I do not think it is possible to install Azure CLI on Databricks. If it is, the usage would be very roundabout, indirect, and awkward. More on that after the alternative below.
While Azure CLI inside Databricks might not work, there is another option. You can install the Python SDK's for the relevant module, and use that directly in a PySpark notebook. This would be more direct and in keeping with the coding experience. The Azure CLI is like the Azure Powershell commands but in a different flavor and OS. You wouldn't use Powershell inside databricks, would you?
Excerpt from Python SDK overview:
Because the Azure CLI is written in Python using the management libraries, anything you can do with Azure CLI commands you can also do from a Python script. That said, the CLI commands provide many helpful features such as performing multiple tasks together, automatically handling asynchronous operations, formatting output like connection strings, and so on...
List of Python libraries for Azure, by Microsoft
How to install libraries on a cluster.
Picture for installing library to a single cluster only:
If you are dead-set on invoking the CLI from inside PySpark, you will need the subprocess module. The learning curve for subprocess might outweigh the simplification Azure CLI brings, and that is if it works. I anticipate lots of path errors. You would need to download the Azure CLI and/or installer into the databricks storage, and run off that.
Please do let me if you have any queries.
Thanks
Martin
- 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