Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure CLI vs Python SDK

Is there a recommended approach in terms of using either Azure CLI or the Azure Python SDK?

The CLI seems to be better documented but since it's built on Python, I would assume it will eventually share a lot of the functionality of the Azure Python SDK.

Any thoughts? Is one more supported over the other?

For reference we are building an app built on Linux with both python and the occasional shell script. So we could use either, though we have found the CLI to be easier since it has better documentation.

like image 390
vonec Avatar asked Apr 24 '18 06:04

vonec


Video Answer


2 Answers

The Azure CLI v2.0 is written in Python, and then depends on the Azure Python SDK. In order for a feature to go in the CLI, the SDK is required to be released first. So you have 100% equivalent features in both. SDK might be in advance sometimes, waiting for the CLI commands to be written. In addition, this is the same team with the same manager, support is equivalent.

SDK is more oriented for a RestAPI experience, and will usually be closer to a direct Rest call, but in a Pythonic way. CLI is more oriented "user friendly", enabling basic scenarios to be simple with a lot of default parameters. Also, CLI can also provide some complete scenario in one command (i.e. "create a KV account") where SDK might take several calls to do the same (under the hood that's the same calls). At the end of the day, if your need is complex, both will be complex anyway. So it's a matter of what you prefer to write.

(full disclosure, I'm the lead dev in the Azure SDK for Python at Microsoft.)

like image 114
Laurent Mazuel Avatar answered Oct 06 '22 16:10

Laurent Mazuel


There is no real answer to this. I was working on a project where we used both Azure CLI (node one) and Python SDK. I find working with SDK better as this is more native experience than calling shell commands. But, again, this isnt a rule or a law.

like image 3
4c74356b41 Avatar answered Oct 06 '22 16:10

4c74356b41