API Reference
Refresh tokens and credentials
Find the az login refresh token, or sign in for one, and redeem it.
- refresh_token_from_az_cli()
-
The refresh token of the account the Azure CLI is signed in as.
- RefreshTokenInfo
-
A refresh token with the client ID and tenant it belongs to.
- SupportsRefreshToken
-
Anything that can hand over a refresh token with its client ID and tenant.
- AZURE_CLI_CLIENT_ID
-
The Azure CLI’s public client ID, to which
az loginrefresh tokens are issued. - RefreshTokenCredential
-
A
TokenCredentialthat redeems a refresh token for access tokens. - DeviceCodeCredential
-
azure.identity.DeviceCodeCredentialwith a persisted cache andget_refresh_token(). - InteractiveBrowserCredential
-
azure.identity.InteractiveBrowserCredentialwith a persisted cache andget_refresh_token().
Spark
Hadoop ABFS configuration for PySpark.
- spark_storage_conf()
-
Build the Hadoop
fs.azure.*keys that let Spark read ADLS Gen2. - SparkStorageConf
-
The
fs.azure.*keys ofspark_storage_conf(), as a plaindict[str, str].
REST client
A small httpx client for one Azure-protected REST API, and its credentials.
- ApiClient
-
A client for one REST API, meant to be subclassed once per API.
- app_credential()
-
The credential an API’s client uses, chosen from the environment now.
az CLI
Log the Azure CLI in and out, and read its current account.
- az_login()
-
Log the Azure CLI in with a device code, unless it already is.
- az_logout()
-
Log the Azure CLI out, by
az logout. - az_is_login()
-
Whether the Azure CLI is logged in, by
az account show. - az_account_show()
-
The Azure CLI’s current account, from
az account show --output json.
DuckDB
Azure secrets and settings for DuckDB, in dazapiz.duckdb (needs dazapiz[duckdb]).
- duckdb.set_credential_secret()
-
Register an access token from any
TokenCredentialas a DuckDB Azure secret. - duckdb.set_token_secret()
-
Register an access token as a DuckDB Azure secret.
- duckdb.set_sp_secret()
-
Register a service principal as a DuckDB Azure secret.
- duckdb.set_chain_secret()
-
Register a DuckDB credential-chain secret, which DuckDB resolves itself.
- duckdb.list_secrets()
-
The connection’s Azure secrets, as
quak::az_list_secrets(). - duckdb.azure_settings()
-
The connection’s Azure settings, as
quak::az_conn_settings(). - duckdb.tune()
-
Set the Azure read and transport settings, as
quak::az_tune(). - duckdb.STORAGE_SCOPE
-
The Azure Storage token scope,
set_credential_secret()’s defaultscope.
Testing
Test doubles for code built on dazapiz, in dazapiz.testing.
- testing.StaticTokenCredential
-
A credential that returns a fixed token and records what it was asked for.
Errors
Everything dazapiz raises derives from DazapizError.
- DazapizError
-
Base class of every error dazapiz raises.
- RefreshTokenNotFoundError
-
No refresh token was found where one was looked for.
- UnsupportedPlatformError
-
The operation is not available on this operating system.
- AzCliError
-
An
azcommand failed; the message carries whatazwrote to stderr. - AzCliNotFoundError
-
No
azon PATH. - AzCliNotLoggedInError
-
The Azure CLI is not logged in.
- AzCliNonInteractiveError
-
az_login()was called where nobody can answer the device-code prompt. - AzCliTimeoutError
-
An
azcommand did not finish within its timeout and was killed. - ApiError
-
An
ApiClientrequest ended in a non-2xx response, after any retries. - ResponseParseError
-
A successful response’s body could not be parsed or was rejected by
parse=.