Az.Cli
Python azure.cli.core interface to execute az Azure CLI commands in python.
Prerequisites
- install python3
- install
REQUIREMENTS.txtusemake init - login to azure using
az login(this can also be done interactively using the library) see Sign in using a service principal - run
python3 src
Example
from az.cli import az
# AzResult = namedtuple('AzResult', ['exit_code', 'out', 'log'])
exit_code, result_dict, logs = az("group show -n test")
# On 0 (SUCCESS) print result_dict, otherwise get info from `logs`
if exit_code == 0:
print (result_dict)
else:
print(logs)
Interactive
You can run the command interactively to traverse the dictionary.
Navigate to src and run python3.
Import the library from az.cli import az and run any command by executing the method az("<my command>") to invoke Azure CLI.
# cd src
# python3
from az.cli import az
az("group list") # list return tuple (exitCode, resultSet)
az("group list")[1] # return resultSet content <dict>
az("group list")[1][0]['id'] # Enumerate id of first element in resultSet
# On Error
az("group show -n does-not-exsist") # list return tuple (exitCode, resultSet)
az("group show -n does-not-exsist")[0] # 3
az("group show -n does-not-exsist")[2] # Print the logs
Build
To build the image run the following in order.
# Runs docker build & create
make create
Run
make run
see interactive
Local Development
To develop locally make sure to install Python3. I recommend to use Python3 virtual environments:
sudo apt-get install python3-venv
Then run:
python3 -m venv env
make init
Known Bugs
az('login')https://github.com/MarkWarneke/Az.Cli/issues/1
Metadata
Release files for az.cli 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| az.cli-0.1.tar.gz | 3.5 kB | Without provenance | Details for az.cli-0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| az.cli-0.1-py3-none-any.whl | Python 3 | none | any | Details for az.cli-0.1-py3-none-any.whl |
Total release size: 8.0 kB
Release files / az.cli-0.1.tar.gz
| Download URL | az.cli-0.1.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
930dcde65ffeaa293015bee276133ab1760ccf47c135329d6054fd0713946cd3
|
|
BLAKE2b-256 checksum How to use checksums |
0b59cba82566e9880d9eb069513bd941c5990742416adb28a50f21e94ac38fc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3
|
Release files / az.cli-0.1-py3-none-any.whl
| Download URL | az.cli-0.1-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d1e732e7544ef93f7e66235e820585354dd87ef313d0fba32c4985a94bfb65d4
|
|
BLAKE2b-256 checksum How to use checksums |
a4e01d927aed8833a2bdc0f6628c54a8227d167f7001b5a0cad2f874ab93a1f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3
|
Security for az.cli 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.