extras.azure_storage — Azure Cloud Storage Emulation


A YellowService emulating Azure Cloud Storage. Runs the docker image of Azurite, Microsoft’s official emulator. You may use any client such as azure-storage-blob to connect to the service.

Note

Requires the azure extra. For more information, see our installation guide.

Note

Currently, the service only supports the default Azure Storage account.

class extras.azure_storage.AzuriteService(docker_client: DockerClient, image: str = 'mcr.microsoft.com/azure-storage/azurite:latest', *, container_create_kwargs: dict[str, Any] | None = None, **kwargs)[source]

A service that runs an Azurite server. Inherits from SingleContainerService. Usable with RunMixin and AsyncRunMixin.

Parameters:

Has the following additional methods:

client_port() int[source]

Returns the port to be used when connecting to Azurite from the docker host.

connection_string() str[source]

Returns a connection string to connect from host to container.

The connection string is formatted according to Microsoft’s specification.

Note

To connect from a different container over a network, see container_connection_string().

Note

To connect from a container through the docker host, see host_connection_string()

container_connection_string() str[source]

Returns a connection string to connect from containers in a common network with the Azurite service.

The connection string is formatted according to Microsoft’s specification.

Note

To connect from the local host, see connection_string().

Note

To connect from a container through the docker host, see host_connection_string()

host_connection_string() str[source]

Returns a connection string to connect from containers to the Azurite service, through the docker host.

The connection string is formatted according to Microsoft’s specification.

Note

To connect from the local host, see connection_string().

Note

To connect containers over a network, see container_connection_string().

endpoint_url() str[source]

Returns an endpoint HTTP URL to connect from docker host.

container_endpoint_url() str[source]

Returns an endpoint HTTP URL to connect to from containers in a common network with the Azurite service.

host_endpoint_url() str[source]

Returns an endpoint HTTP URL to connect to from containers to the Azurite service, through the docker host.

account_credentials() dict[source]

Returns a credential dict to connect to the service. The dict consists of 2 keys: "account_name" and "account_key", and can be used as credentials for the azure-storage-blob BlobServiceClient constructor.

account_name: str[source]

The account name, as registered in Azurite.

Note

Since BlobStorageService currently only supports the default azurite account, this attribute should not be changed.

account_key: str[source]

The account password, as registered in Azurite.

Note

Since BlobStorageService currently only supports the default azurite account, this attribute should not be changed.

class extras.azure_storage.BlobStorageService(...)[source]

A legacy alias of AzuriteService.