Azure CLI vs Python SDK
Asked Answered
H

3

6

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.

Henni answered 24/4, 2018 at 6:0 Comment(0)
S
26

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.)

Segalman answered 24/4, 2018 at 15:33 Comment(0)
H
3

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.

Howsoever answered 24/4, 2018 at 6:5 Comment(2)
what is node one?Washboard
github.com/Azure/azure-sdk-for-nodeHowsoever
W
0

This is a segment of text from an Azure Storage tutorial.

Storage accounts are typically based on an analysis of your data, so they tend to be relatively stable. As a result, storage-account creation is usually a one-time operation done at the start of a project. For one-time activities, the portal is the most common choice.

In the rare cases where you need automation, the decision is between a programmatic API or a scripting solution. Scripts are typically faster to create and less work to maintain because there's no need for an IDE, NuGet packages, or build steps. If you have an existing client application, the management libraries might be an attractive choice; otherwise, scripts are a better option.

Washboard answered 29/4 at 21:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.