Skip to main content


Veeam Logo

Veeam Backup for Azure Python API Wrapper

Python package for interacting with the Veeam Backup for Azure REST API

This project is an independent, open source Python client for the Veeam Backup for Azure REST API. It is not affiliated with, endorsed by, or sponsored by Veeam Software.

Supported Versions

VBA Version API Version Supported
8.1 8.1
< 8.1 < 8.1

How to support new API versions

  1. Download the OpenAPI schema into openapi_schemas
  2. Install the openapi-python-client package
  3. Run python fix_openapi_schema.py .\openapi_schemas\vbaz_rest_{version}.json .\openapi_schemas\vbaz_rest_{version}_fixed.json
  4. Run openapi-python-client generate --path ".\openapi_schemas\vbaz_rest_{version}_fixed.json" --output-path ".\veeam_az" --overwrite
  5. Fix any warnings/errors
  6. Rename the folder to match the API version (i.e., v8_1)
  7. Add the version mapping to versions.py
  8. Write pytest tests
  9. If an older API has been deprecated, delete its folder, json, and version.py entry, then update the supported versions section of the readme

Install

From PyPi

pip install veeam-az

From Source

Clone the repository and install dependencies:

git clone https://github.com/Cenvora/veeam-az.git
cd veeam-az
pip install -e .

Usage

Recommended Usage (Smart Client)

The VeeamClient handles:

  • API version routing
  • Authentication (username/password or bearer token)
  • Token refresh (password-based auth automatically re-authenticates on expiry)
  • Async calls
  • Operation discovery

Each packaged version can be called independently through separate imports, but this is the recommended way to use this library.

Create a client and connect

import asyncio
from veeam_az import VeeamClient

async def main():
    vc = VeeamClient(
        host="https://vbaz.example.com",
        username="administrator",
        password="SuperSecretPassword",
        api_version="8.1",
        verify_ssl=False,
    )

    await vc.connect()

    # use the client...

    await vc.close()

asyncio.run(main())

You can also authenticate with a pre-existing bearer token instead of a username/password. Token-based clients skip the login call and are never refreshed automatically:

vc = VeeamClient(
    host="https://vbaz.example.com",
    token="eyJhbGciOi...",
    api_version="8.1",
    verify_ssl=False,
)
await vc.connect()

Detect the API version an appliance serves

The REST API has no endpoint that reports its supported versions, and nothing negotiates one for you — the version is part of every path, so a client picks one up front. That path is also what makes detection possible: /api/v{version}/system/about requires a token, so an anonymous probe gets 401 where the version is served and 404 where it is not. detect_api_version returns the newest version that both the appliance serves and this library can speak:

import asyncio
from veeam_az import VeeamClient
from veeam_az.discovery import detect_api_version

async def main():
    base_url = "https://vbaz.example.com"

    api_version = await detect_api_version(base_url, verify_ssl=False)
    if api_version is None:
        # The appliance may be unreachable or behind a proxy — choose your own default
        api_version = "8.1"

    vc = VeeamClient(
        host=base_url,
        username="administrator",
        password="SuperSecretPassword",
        api_version=api_version,
        verify_ssl=False,
    )
    await vc.connect()

asyncio.run(main())

Detection needs no credentials, so it can run before you have any. Probes are concurrent, so it costs roughly one round trip regardless of how many versions this library supports.

If the appliance is not on the usual HTTPS port, detect_rest_api finds the port and the version at once:

from veeam_az.discovery import detect_rest_api

endpoint = await detect_rest_api("vbaz.example.com", ports=(443, 8443), verify_ssl=False)
if endpoint:
    print(endpoint.port, endpoint.api_version)  # e.g. 443 8.1
    base_url = f"https://vbaz.example.com{endpoint.base_url_suffix}"

Resolve it once and store the result rather than detecting on every start: an appliance upgrade would otherwise silently move you onto a newer version, and versions rename enum values and add required fields.

Call an API endpoint (async)

policies = await vc.call(
    vc.api("policy").policy_get_policies
)

Call any endpoint

Operations map directly to the OpenAPI layout. Each tag becomes a namespace folder and each operation becomes a module:

api/
└── policy/
    └── policy_get_policies.py

Call it via the namespace:

await vc.call(
    vc.api("policy").policy_get_policies
)

Or explicitly, with the operation on the same line:

await vc.call(
    vc.api("policy.policy_get_policies")
)

Pass endpoint arguments as keyword arguments to call:

repo = await vc.call(
    vc.api("repository").repository_get_repository,
    repository_id="<repository-id>",
)

Pagination example

List endpoints accept offset and limit:

result = await vc.call(
    vc.api("policy").policy_get_policies,
    limit=50,
    offset=0,
)

Close the client

await vc.close()

Contributing

Contributions are welcome! To contribute:

  • Fork the repository
  • Create a feature branch
  • Make your changes and add tests
  • Submit a pull request with a clear description

Please follow PEP8 style and include docstrings for new functions/classes.

🤝 Core Contributors

This project is made possible thanks to the efforts of our core contributors:

We’re grateful for their continued support and contributions.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

veeam_az-0.2.0.tar.gz (884.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

veeam_az-0.2.0-py3-none-any.whl (1.9 MB view details)

Uploaded Python 3

File details

Details for the file veeam_az-0.2.0.tar.gz.

File metadata

  • Download URL: veeam_az-0.2.0.tar.gz
  • Upload date:
  • Size: 884.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for veeam_az-0.2.0.tar.gz
Algorithm Hash digest
SHA256 49ce9e0ed935b5a2bdb6d2c13426211bf2b031713bc37d57021a5f944ce04c27
MD5 4fae6b387adafa34697ca198187d4d69
BLAKE2b-256 72312bf872486300cd8d104c0849891cca7cd8e017e5144f15783e7a66acf606

See more details on using hashes here.

Provenance

The following attestation bundles were made for veeam_az-0.2.0.tar.gz:

Publisher: publish-on-release.yml on Cenvora/veeam-az

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file veeam_az-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: veeam_az-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for veeam_az-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7afe65bce29d6ec567f85e0ed7ab03b65e43d5820df19e8205bfb825687fda11
MD5 eb4bc5b61e590b17e4acd513ff9f1f73
BLAKE2b-256 6655a5d8088a66312404159101984b1fb3330bd59ea1e533129237a4a729dd34

See more details on using hashes here.

Provenance

The following attestation bundles were made for veeam_az-0.2.0-py3-none-any.whl:

Publisher: publish-on-release.yml on Cenvora/veeam-az

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page