Blob storage leases - az storage blob lease

Manage storage blob leases.

Commands

az storage blob lease acquire Requests a new lease.
az storage blob lease break Breaks the lease, if the blob has an active lease.
az storage blob lease change Changes the lease ID of an active lease.
az storage blob lease release Releases the lease.
az storage blob lease renew Renews the lease.

az storage blob lease acquire

If the blob does not have an active lease, the Blob service creates a lease on the blob and returns a new lease ID.

az storage blob lease acquire --blob-name
--container-name
[--account-key]
[--account-name]
[--connection-string]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--lease-duration]
[--proposed-lease-id]
[--sas-token]
[--timeout]

Required Parameters

--blob-name -b

The blob name.

--container-name -c

The container name.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_KEY.

--account-name

Storage account name. Must be used in conjunction with either storage account key or a SAS token. Environment variable: AZURE_STORAGE_ACCOUNT.

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--if-match

An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.

--if-modified-since

Alter only if modified since supplied UTC datetime (Y-m-d'T'H:M'Z').

--if-none-match

An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist.

--if-unmodified-since

Alter only if unmodified since supplied UTC datetime (Y-m-d'T'H:M'Z').

--lease-duration

Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or change. Default is -1 (infinite lease).

default value: -1
--proposed-lease-id

Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format.

--sas-token

A Shared Access Signature (SAS). Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_SAS_TOKEN.

--timeout

Request timeout in seconds. Applies to each call to the service.

az storage blob lease break

Once a lease is broken, it cannot be renewed. Any authorized request can break the lease; the request is not required to specify a matching lease ID. When a lease is broken, the lease break period is allowed to elapse, during which time no lease operation except break and release can be performed on the blob. When a lease is successfully broken, the response indicates the interval in seconds until a new lease can be acquired. A lease that has been broken can also be released, in which case another client may immediately acquire the lease on the blob.

az storage blob lease break --blob-name
--container-name
[--account-key]
[--account-name]
[--connection-string]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--lease-break-period]
[--sas-token]
[--timeout]

Required Parameters

--blob-name -b

The blob name.

--container-name -c

The container name.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_KEY.

--account-name

Storage account name. Must be used in conjunction with either storage account key or a SAS token. Environment variable: AZURE_STORAGE_ACCOUNT.

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--if-match

An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.

--if-modified-since

Alter only if modified since supplied UTC datetime (Y-m-d'T'H:M'Z').

--if-none-match

An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist.

--if-unmodified-since

Alter only if unmodified since supplied UTC datetime (Y-m-d'T'H:M'Z').

--lease-break-period

For a break operation, this is the proposed duration of seconds that the lease should continue before it is broken, between 0 and 60 seconds. This break period is only used if it is shorter than the time remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be available before the break period has expired, but the lease may be held for longer than the break period. If this header does not appear with a break operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks immediately.

--sas-token

A Shared Access Signature (SAS). Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_SAS_TOKEN.

--timeout

Request timeout in seconds. Applies to each call to the service.

az storage blob lease change

A change must include the current lease ID and a new lease ID.

az storage blob lease change --blob-name
--container-name
--lease-id
--proposed-lease-id
[--account-key]
[--account-name]
[--connection-string]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--sas-token]
[--timeout]

Required Parameters

--blob-name -b

The blob name.

--container-name -c

The container name.

--lease-id

Required if the blob has an active lease.

--proposed-lease-id

Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_KEY.

--account-name

Storage account name. Must be used in conjunction with either storage account key or a SAS token. Environment variable: AZURE_STORAGE_ACCOUNT.

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--if-match

An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.

--if-modified-since

Alter only if modified since supplied UTC datetime (Y-m-d'T'H:M'Z').

--if-none-match

An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist.

--if-unmodified-since

Alter only if unmodified since supplied UTC datetime (Y-m-d'T'H:M'Z').

--sas-token

A Shared Access Signature (SAS). Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_SAS_TOKEN.

--timeout

Request timeout in seconds. Applies to each call to the service.

az storage blob lease release

The lease may be released if the lease ID specified on the request matches that associated with the blob. Releasing the lease allows another client to immediately acquire the lease for the blob as soon as the release is complete.

az storage blob lease release --blob-name
--container-name
--lease-id
[--account-key]
[--account-name]
[--connection-string]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--sas-token]
[--timeout]

Required Parameters

--blob-name -b

The blob name.

--container-name -c

The container name.

--lease-id

Lease ID for active lease.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_KEY.

--account-name

Storage account name. Must be used in conjunction with either storage account key or a SAS token. Environment variable: AZURE_STORAGE_ACCOUNT.

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--if-match

An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.

--if-modified-since

Alter only if modified since supplied UTC datetime (Y-m-d'T'H:M'Z').

--if-none-match

An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist.

--if-unmodified-since

Alter only if unmodified since supplied UTC datetime (Y-m-d'T'H:M'Z').

--sas-token

A Shared Access Signature (SAS). Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_SAS_TOKEN.

--timeout

Request timeout in seconds. Applies to each call to the service.

az storage blob lease renew

The lease can be renewed if the lease ID specified on the request matches that associated with the blob. Note that the lease may be renewed even if it has expired as long as the blob has not been modified or leased again since the expiration of that lease. When you renew a lease, the lease duration clock resets.

az storage blob lease renew --blob-name
--container-name
--lease-id
[--account-key]
[--account-name]
[--connection-string]
[--if-match]
[--if-modified-since]
[--if-none-match]
[--if-unmodified-since]
[--sas-token]
[--timeout]

Required Parameters

--blob-name -b

The blob name.

--container-name -c

The container name.

--lease-id

Lease ID for active lease.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_KEY.

--account-name

Storage account name. Must be used in conjunction with either storage account key or a SAS token. Environment variable: AZURE_STORAGE_ACCOUNT.

--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--if-match

An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified.

--if-modified-since

Alter only if modified since supplied UTC datetime (Y-m-d'T'H:M'Z').

--if-none-match

An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist.

--if-unmodified-since

Alter only if unmodified since supplied UTC datetime (Y-m-d'T'H:M'Z').

--sas-token

A Shared Access Signature (SAS). Must be used in conjunction with storage account name. Environment variable: AZURE_STORAGE_SAS_TOKEN.

--timeout

Request timeout in seconds. Applies to each call to the service.