Skip to main content

blob

Creates, updates, deletes, gets or lists a blob resource.

Overview

Nameblob
TypeResource
Idazure.storage_blob.blob

Fields

The following fields are returned by SELECT queries:

SELECT not supported for this resource, use SHOW METHODS to view available operations for the resource.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
deletedeletex-ms-version, accountsnapshot, versionid, timeout, x-ms-lease-id, x-ms-delete-snapshots, If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match, x-ms-if-tags, x-ms-client-request-id, deletetype, x-ms-access-tier-if-modified-since, x-ms-access-tier-if-unmodified-sinceIf the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, it is marked for deletion and becomes inaccessible immediately. However, the blob service retains the blob or snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until it is permanently removed. Use the List Blobs API and specify the "include=deleted" query parameter to discover which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP status code of 404 (ResourceNotFound).
get_propertiesexecx-ms-version, accountsnapshot, versionid, timeout, x-ms-lease-id, x-ms-encryption-key, x-ms-encryption-key-sha256, x-ms-encryption-algorithm, If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match, x-ms-if-tags, x-ms-client-request-idThe Get Properties operation returns all user-defined metadata, standard HTTP properties, and system properties for the blob. It does not return the content of the blob.
get_account_infoexecx-ms-version, accounttimeout, x-ms-client-request-idReturns the sku name and account kind.
queryexecx-ms-version, accountsnapshot, timeout, x-ms-lease-id, x-ms-encryption-key, x-ms-encryption-key-sha256, x-ms-encryption-algorithm, If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match, x-ms-if-tags, x-ms-client-request-idThe Query operation enables users to select/project on blob data by providing simple query expressions.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
accountstringStorage account name. (default: )
x-ms-versionstring
If-Matchstring
If-Modified-Sincestring
If-None-Matchstring
If-Unmodified-Sincestring
deletetypestringOptional. Only possible value is 'permanent', which specifies to permanently delete a blob if blob soft delete is enabled. Known values are "Permanent" and None. Default value is "Permanent".
snapshotstringThe snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see Creating a Snapshot of a Blob.. Default value is None.
timeoutintegerThe timeout parameter is expressed in seconds. For more information, see
versionidstringThe version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 and newer. Default value is None.
x-ms-access-tier-if-modified-sincestringSpecify this header value to operate only on a blob if the access-tier has been modified since the specified date/time. Default value is None.
x-ms-access-tier-if-unmodified-sincestringSpecify this header value to operate only on a blob if the access-tier has not been modified since the specified date/time. Default value is None.
x-ms-client-request-idstringProvides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None.
x-ms-delete-snapshotsstringRequired if the blob has associated snapshots. Specify one of the following two options: include: Delete the base blob and all of its snapshots. only: Delete only the blob's snapshots and not the blob itself. Known values are: "include" and "only". Default value is None.
x-ms-encryption-algorithmstring
x-ms-encryption-keystring
x-ms-encryption-key-sha256string
x-ms-if-tagsstring
x-ms-lease-idstring

DELETE examples

If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, it is marked for deletion and becomes inaccessible immediately. However, the blob service retains the blob or snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until it is permanently removed. Use the List Blobs API and specify the "include=deleted" query parameter to discover which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP status code of 404 (ResourceNotFound).

DELETE FROM azure.storage_blob.blob
WHERE x-ms-version = '{{ x-ms-version }}' --required
AND account = '{{ account }}' --required
AND snapshot = '{{ snapshot }}'
AND versionid = '{{ versionid }}'
AND timeout = '{{ timeout }}'
AND x-ms-lease-id = '{{ x-ms-lease-id }}'
AND x-ms-delete-snapshots = '{{ x-ms-delete-snapshots }}'
AND If-Modified-Since = '{{ If-Modified-Since }}'
AND If-Unmodified-Since = '{{ If-Unmodified-Since }}'
AND If-Match = '{{ If-Match }}'
AND If-None-Match = '{{ If-None-Match }}'
AND x-ms-if-tags = '{{ x-ms-if-tags }}'
AND x-ms-client-request-id = '{{ x-ms-client-request-id }}'
AND deletetype = '{{ deletetype }}'
AND x-ms-access-tier-if-modified-since = '{{ x-ms-access-tier-if-modified-since }}'
AND x-ms-access-tier-if-unmodified-since = '{{ x-ms-access-tier-if-unmodified-since }}'
;

Lifecycle Methods

The Get Properties operation returns all user-defined metadata, standard HTTP properties, and system properties for the blob. It does not return the content of the blob.

EXEC azure.storage_blob.blob.get_properties 
@x-ms-version='{{ x-ms-version }}' --required,
@account='{{ account }}' --required,
@snapshot='{{ snapshot }}',
@versionid='{{ versionid }}',
@timeout='{{ timeout }}',
@x-ms-lease-id='{{ x-ms-lease-id }}',
@x-ms-encryption-key='{{ x-ms-encryption-key }}',
@x-ms-encryption-key-sha256='{{ x-ms-encryption-key-sha256 }}',
@x-ms-encryption-algorithm='{{ x-ms-encryption-algorithm }}',
@If-Modified-Since='{{ If-Modified-Since }}',
@If-Unmodified-Since='{{ If-Unmodified-Since }}',
@If-Match='{{ If-Match }}',
@If-None-Match='{{ If-None-Match }}',
@x-ms-if-tags='{{ x-ms-if-tags }}',
@x-ms-client-request-id='{{ x-ms-client-request-id }}'
@@json=
'{
"leaseId": "{{ leaseId }}"
}'
;