Skip to content

Behavior difference: uploading a blob which has an active lease #2637

@tilman151

Description

@tilman151

Error description:

If I try to upload a blob that has an active lease on it, the behavior of Azurite differs from the real blob storage.
Azurite returns a BlobAlreadyExists while the real storage returns LeaseIdMissing.
Azurite returns LeaseIdMissing only if overwrite=True.
The behavior difference exists in the latest supported API version (2025-11-05) and in the latest API.

Reproduction (Python SDK v12.28.0):

Azurite no overwrite:

blob_service= BlobServiceClient.from_connection_string("UseDevelopmentStorage=true", api_version="2025-11-05")
blob_client = blob_service.get_blob_client("foo", "bar")
blob_client.upload_blob(b"")
blob_client.acquire_lease(90)
blob_client.upload_blob(b"foobar")  # --> raises ResourceExistsError    

Azurite overwrite:

blob_service= BlobServiceClient.from_connection_string("UseDevelopmentStorage=true", api_version="2025-11-05")
blob_client = blob_service.get_blob_client("foo", "bar")
blob_client.upload_blob(b"", overwrite=True)
blob_client.acquire_lease(90)
blob_client.upload_blob(b"foobar")  # --> raises LeaseIdMissing

Real storage no overwrite:

blob_service= BlobServiceClient.from_connection_string("<real_connection_string>", api_version="2025-11-05")
blob_client = blob_service.get_blob_client("foo", "bar")
blob_client.upload_blob(b"")
blob_client.acquire_lease(90)
blob_client.upload_blob(b"foobar")  # --> raises LeaseIdMissing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions