Skip to main content

llamazure.azgraph : Azure Resources Graph client

The llamazure.azgraph package provides a usable client for the Azure Resource Graph.

Benefits:

  • automatically queries all your subscriptions
  • no boilerplate
  • easily navigate paginated queries

azgraph

Usage

Create a Graph with the from_credential and any of the standard Azure credentials.

from azure.identity import DefaultAzureCredential

from llamazure.azgraph.azgraph import Graph

g = Graph.from_credential(DefaultAzureCredential())

Querying

Make a simple query with the q method, which will return your data directly:

>>> g.q("Resources | project id, name, type, location | limit 5")
[{'id': '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg0/providers/Microsoft.Storage/storageAccounts/sa0', 'name': 'sa0', 'type': 'microsoft.storage/storageaccounts', 'location': 'canadacentral'}]

Or specify options with the query method, which will return the full result object:

>>> from llamazure.azgraph.models import Req

>>> g.query(Req(query="Resources | project id, name, type, location | limit 1", subscriptions=g.subscriptions, options={"$skip": 1},))
Res(req=Req(query='Resources | project id, name, type, location | limit 1', subscriptions=('00000000-0000-0000-0000-000000000000',), facets=(), managementGroupId=None, options={'$skip': 1}), totalRecords=1, count=1, resultTruncated='false', facets=[], data=[{'id': '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/NetworkWatcherRG/providers/Microsoft.Network/networkWatchers/NetworkWatcher_canadacentral', 'name': 'NetworkWatcher_canadacentral', 'type': 'microsoft.network/networkwatchers', 'location': 'canadacentral'}], skipToken=None)

Retries

Every query can be automatically retried by the retry policy. You can modify this by setting the Graph.retry_policy attribute:

g.retry_policy = RetryPolicy(retries=10)

Pagination

Pagination is handled automatically. If you want to manually paginate, you can manually walk the pages:

req = Req(query="Resources | project id, name, type, location | limit 5", subscriptions=g.subscriptions)

res0 = g.query_single(req)
res1 = g.query_next(req, res0)
res2 = g.query_next(req, res1)

Metadata

Release files for llamazure.azgraph 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llamazure.azgraph 0.1.1
File Size Uploaded Provenance Actions
llamazure_azgraph-0.1.1.tar.gz 5.0 kB Without provenance Details for llamazure_azgraph-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llamazure.azgraph 0.1.1
File Interpreter ABI Platform Actions
llamazure_azgraph-0.1.1-py3-none-any.whl Python 3 none any Details for llamazure_azgraph-0.1.1-py3-none-any.whl

Total release size: 11.0 kB

Release files / llamazure_azgraph-0.1.1.tar.gz

Download URL llamazure_azgraph-0.1.1.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c38989cab85c3c34b409e6587c8ef9f8526e7332c22351f178a239679f7edb55
BLAKE2b-256 checksum
How to use checksums
a8ffa6dcc08c42ff08004e83d2da88dd372ad6540493b2a097ff96f1d0b8bdee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / llamazure_azgraph-0.1.1-py3-none-any.whl

Download URL llamazure_azgraph-0.1.1-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0975e28f208f033e297ed19b09fbe5afd6ab9821f5446757f7820ae2a740306
BLAKE2b-256 checksum
How to use checksums
d1a3b3a4cfdbf43087238800013015b5483b556e3062566b710e9335f313bba8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for llamazure.azgraph 0.1.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page