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 withRunMixin
andAsyncRunMixin
.- Parameters:
docker_client – The docker client to used to pull and create the Azurite container.
image – The image name to create a container of.
container_create_kwargs – Additional keyword arguments passed to
docker.models.containers.ContainerCollection.create()
.**kwargs – Additional keyword arguments passed to
SingleContainerService
.
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()
.
- 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 ascredentials
for the azure-storage-blob BlobServiceClient constructor.
- class extras.azure_storage.BlobStorageService(...)[source]¶
A legacy alias of
AzuriteService
.