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.
| VBA Version | API Version | Supported |
|---|---|---|
| 8.1 | 8.1 | ✅ |
| < 8.1 | < 8.1 | ❌ |
- Download the OpenAPI schema into openapi_schemas
- Install the openapi-python-client package
- Run
python fix_openapi_schema.py .\openapi_schemas\vbaz_rest_{version}.json .\openapi_schemas\vbaz_rest_{version}_fixed.json - Run
openapi-python-client generate --path ".\openapi_schemas\vbaz_rest_{version}_fixed.json" --output-path ".\veeam_az" --overwrite - Fix any warnings/errors
- Rename the folder to match the API version (i.e.,
v8_1) - Add the version mapping to versions.py
- Write pytest tests
- If an older API has been deprecated, delete its folder, json, and version.py entry, then update the supported versions section of the readme
pip install veeam-az
Clone the repository and install dependencies:
git clone https://github.com/Cenvora/veeam-az.git
cd veeam-az
pip install -e .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.
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()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.
policies = await vc.call(
vc.api("policy").policy_get_policies
)Operations map directly to the OpenAPI layout. Each tag becomes a namespace folder and each operation becomes a module:
api/
└── policy/
└── policy_get_policies.pyCall 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>",
)List endpoints accept offset and limit:
result = await vc.call(
vc.api("policy").policy_get_policies,
limit=50,
offset=0,
)await vc.close()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.
This project is made possible thanks to the efforts of our core contributors:
We’re grateful for their continued support and contributions.
