blob
Creates, updates, deletes, gets or lists a blob resource.
Overview
| Name | blob |
| Type | Resource |
| Id | azure.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:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
delete | delete | x-ms-version, account | snapshot, 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-since | 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). |
get_properties | exec | x-ms-version, account | snapshot, 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-id | 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. |
get_account_info | exec | x-ms-version, account | timeout, x-ms-client-request-id | Returns the sku name and account kind. |
query | exec | x-ms-version, account | snapshot, 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-id | The 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.
| Name | Datatype | Description |
|---|---|---|
account | string | Storage account name. (default: ) |
x-ms-version | string | |
If-Match | string | |
If-Modified-Since | string | |
If-None-Match | string | |
If-Unmodified-Since | string | |
deletetype | string | Optional. 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". |
snapshot | string | The 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. |
timeout | integer | The timeout parameter is expressed in seconds. For more information, see |
versionid | string | The 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-since | string | Specify 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-since | string | Specify 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-id | string | Provides 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-snapshots | string | Required 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-algorithm | string | |
x-ms-encryption-key | string | |
x-ms-encryption-key-sha256 | string | |
x-ms-if-tags | string | |
x-ms-lease-id | string |
DELETE examples
- delete
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
- get_properties
- get_account_info
- query
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 }}"
}'
;
Returns the sku name and account kind.
EXEC azure.storage_blob.blob.get_account_info
@x-ms-version='{{ x-ms-version }}' --required,
@account='{{ account }}' --required,
@timeout='{{ timeout }}',
@x-ms-client-request-id='{{ x-ms-client-request-id }}'
;
The Query operation enables users to select/project on blob data by providing simple query expressions.
EXEC azure.storage_blob.blob.query
@x-ms-version='{{ x-ms-version }}' --required,
@account='{{ account }}' --required,
@snapshot='{{ snapshot }}',
@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 }}"
}'
;