Skip to content

Microsoft Azure

rustac.store.AzureStore

Interface to a Microsoft Azure Blob Storage container.

All constructors will check for environment variables. All environment variables starting with AZURE_ will be evaluated. Names must match keys from AzureConfig. Only upper-case environment variables are accepted.

Some examples of variables extracted from environment:

  • AZURE_STORAGE_ACCOUNT_NAME: storage account name
  • AZURE_STORAGE_ACCOUNT_KEY: storage account master key
  • AZURE_STORAGE_ACCESS_KEY: alias for AZURE_STORAGE_ACCOUNT_KEY
  • AZURE_STORAGE_CLIENT_ID -> client id for service principal authorization
  • AZURE_STORAGE_CLIENT_SECRET -> client secret for service principal authorization
  • AZURE_STORAGE_TENANT_ID -> tenant id used in oauth flows

client_options property

client_options: ClientConfig | None

Get the store's client configuration.

config property

config: AzureConfig

Get the underlying Azure config parameters.

prefix property

prefix: str | None

Get the prefix applied to all operations in this store, if any.

retry_config property

retry_config: RetryConfig | None

Get the store's retry configuration.

__init__

__init__(
    container: str | None = None,
    *,
    prefix: str | None = None,
    config: AzureConfig | AzureConfigInput | None = None,
    client_options: ClientConfig | None = None,
    retry_config: RetryConfig | None = None,
    credential_provider: AzureCredentialProvider | None = None,
    **kwargs: Unpack[AzureConfigInput],
) -> None

Construct a new AzureStore.

Parameters:

  • container (str | None, default: None ) –

    the name of the container.

Other Parameters:

  • prefix (str | None) –

    A prefix within the bucket to use for all operations.

  • config (AzureConfig | AzureConfigInput | None) –

    Azure Configuration. Values in this config will override values inferred from the url. Defaults to None.

  • client_options (ClientConfig | None) –

    HTTP Client options. Defaults to None.

  • retry_config (RetryConfig | None) –

    Retry configuration. Defaults to None.

  • credential_provider (AzureCredentialProvider | None) –

    A callback to provide custom Azure credentials.

  • kwargs (Unpack[AzureConfigInput]) –

    Azure configuration values. Supports the same values as config, but as named keyword args.

Returns:

  • None

    AzureStore

from_url classmethod

from_url(
    url: str,
    *,
    prefix: str | None = None,
    config: AzureConfig | AzureConfigInput | None = None,
    client_options: ClientConfig | None = None,
    retry_config: RetryConfig | None = None,
    credential_provider: AzureCredentialProvider | None = None,
    **kwargs: Unpack[AzureConfigInput],
) -> AzureStore

Construct a new AzureStore with values populated from a well-known storage URL.

The supported url schemes are:

  • abfs[s]://<container>/<path> (according to fsspec)
  • abfs[s]://<file_system>@<account_name>.dfs.core.windows.net/<path>
  • abfs[s]://<file_system>@<account_name>.dfs.fabric.microsoft.com/<path>
  • az://<container>/<path> (according to fsspec)
  • adl://<container>/<path> (according to fsspec)
  • azure://<container>/<path> (custom)
  • https://<account>.dfs.core.windows.net
  • https://<account>.blob.core.windows.net
  • https://<account>.blob.core.windows.net/<container>
  • https://<account>.dfs.fabric.microsoft.com
  • https://<account>.dfs.fabric.microsoft.com/<container>
  • https://<account>.blob.fabric.microsoft.com
  • https://<account>.blob.fabric.microsoft.com/<container>

Parameters:

  • url (str) –

    well-known storage URL.

Other Parameters:

  • prefix (str | None) –

    A prefix within the bucket to use for all operations.

  • config (AzureConfig | AzureConfigInput | None) –

    Azure Configuration. Values in this config will override values inferred from the url. Defaults to None.

  • client_options (ClientConfig | None) –

    HTTP Client options. Defaults to None.

  • retry_config (RetryConfig | None) –

    Retry configuration. Defaults to None.

  • credential_provider (AzureCredentialProvider | None) –

    A callback to provide custom Azure credentials.

  • kwargs (Unpack[AzureConfigInput]) –

    Azure configuration values. Supports the same values as config, but as named keyword args.

Returns:

rustac.store.AzureAccessKey

Bases: TypedDict

A shared Azure Storage Account Key.

https://learn.microsoft.com/en-us/rest/api/storageservices/authorize-with-shared-key

access_key instance-attribute

access_key: str

Access key value.

expires_at instance-attribute

expires_at: datetime | None

Expiry datetime of credential. The datetime should have time zone set.

If None, the credential will never expire.

rustac.store.AzureConfig

Bases: TypedDict

Configuration parameters returned from AzureStore.config.

Note that this is a strict subset of the keys allowed for input into the store, see [AzureConfigInput][obstore.store.AzureConfigInput].

azure_container_name instance-attribute

azure_container_name: str

Container name

azure_disable_tagging instance-attribute

azure_disable_tagging: bool

Disables tagging objects

azure_federated_token_file instance-attribute

azure_federated_token_file: str

File containing token for Azure AD workload identity federation

azure_msi_endpoint instance-attribute

azure_msi_endpoint: str

Endpoint to request a imds managed identity token

azure_msi_resource_id instance-attribute

azure_msi_resource_id: str

Msi resource id for use with managed identity authentication

azure_object_id instance-attribute

azure_object_id: str

Object id for use with managed identity authentication

azure_skip_signature instance-attribute

azure_skip_signature: bool

Skip signing requests

azure_storage_account_key instance-attribute

azure_storage_account_key: str

Master key for accessing storage account

azure_storage_account_name instance-attribute

azure_storage_account_name: str

The name of the azure storage account

azure_storage_client_id instance-attribute

azure_storage_client_id: str

Service principal client id for authorizing requests

azure_storage_client_secret instance-attribute

azure_storage_client_secret: str

Service principal client secret for authorizing requests

azure_storage_endpoint instance-attribute

azure_storage_endpoint: str

Override the endpoint used to communicate with blob storage

azure_storage_sas_key instance-attribute

azure_storage_sas_key: str

Shared access signature.

The signature is expected to be percent-encoded, muchlike they are provided in the azure storage explorer or azure portal.

azure_storage_tenant_id instance-attribute

azure_storage_tenant_id: str

Tenant id used in oauth flows

azure_storage_token instance-attribute

azure_storage_token: str

Bearer token

azure_storage_use_emulator instance-attribute

azure_storage_use_emulator: bool

Use object store with azurite storage emulator

azure_use_azure_cli instance-attribute

azure_use_azure_cli: bool

Use azure cli for acquiring access token

azure_use_fabric_endpoint instance-attribute

azure_use_fabric_endpoint: bool

Use object store with url scheme account.dfs.fabric.microsoft.com

rustac.store.AzureSASToken

Bases: TypedDict

A shared access signature.

https://learn.microsoft.com/en-us/rest/api/storageservices/delegate-access-with-shared-access-signature

expires_at instance-attribute

expires_at: datetime | None

Expiry datetime of credential. The datetime should have time zone set.

If None, the credential will never expire.

sas_token instance-attribute

sas_token: str | list[tuple[str, str]]

SAS token.

rustac.store.AzureBearerToken

Bases: TypedDict

An authorization token.

https://learn.microsoft.com/en-us/rest/api/storageservices/authorize-with-azure-active-directory

expires_at instance-attribute

expires_at: datetime | None

Expiry datetime of credential. The datetime should have time zone set.

If None, the credential will never expire.

token instance-attribute

token: str

Bearer token.

rustac.store.AzureCredential module-attribute

AzureCredential: TypeAlias = AzureAccessKey | AzureSASToken | AzureBearerToken

A type alias for supported azure credentials to be returned from AzureCredentialProvider.

rustac.store.AzureCredentialProvider

Bases: Protocol

A type hint for a synchronous or asynchronous callback to provide custom Azure credentials.

This should be passed into the credential_provider parameter of AzureStore.

__call__ staticmethod

__call__() -> AzureCredential | Coroutine[Any, Any, AzureCredential]

Return an AzureCredential.