Redigera

Dela via


Get-AzStorageBlobByTag

Lists blobs in a storage account across containers, with a blob tag filter sql expression.

Syntax

Get-AzStorageBlobByTag
   -TagFilterSqlExpression <String>
   [-MaxCount <Int32>]
   [-ContinuationToken <BlobContinuationToken>]
   [-GetBlobProperty]
   [-Container <String>]
   [-Context <IStorageContext>]
   [-ServerTimeoutPerRequest <Int32>]
   [-ClientTimeoutPerRequest <Int32>]
   [-DefaultProfile <IAzureContextContainer>]
   [-ConcurrentTaskCount <Int32>]
   [<CommonParameters>]

Description

The Get-AzStorageBlobByTag cmdlet lists blobs in a storage account across containers, with a blob tag filter sql expression.

Examples

Example 1: List all blobs match a specific blob tag, across containers.

Get-AzStorageBlobByTag -TagFilterSqlExpression """tag1""='value1'" -Context $ctx

AccountName: storageaccountname, ContainerName: containername1

Name                 BlobType  Length          ContentType                    LastModified         AccessTier SnapshotTime                 IsDeleted  VersionId                     
----                 --------  ------          -----------                    ------------         ---------- ------------                 ---------  ---------                     
testblob                                                                                                                                   False                                    
testblob2                                                                                                                                  False                                    

   AccountName: storageaccountname, ContainerName: containername2

Name                 BlobType  Length          ContentType                    LastModified         AccessTier SnapshotTime                 IsDeleted  VersionId                     
----                 --------  ------          -----------                    ------------         ---------- ------------                 ---------  ---------                     
testblob3                                                                                                                                   False                                    
testblob4                                                                                                                                   False

This command lists all blobs in a storage account, which contains a tag with name "tag1" and value "value1".

Example 2: List blobs in a specific container and match a specific blob tag

Get-AzStorageBlobByTag -Container 'containername' -TagFilterSqlExpression """tag1""='value1'" -Context $ctx

AccountName: storageaccountname, ContainerName: containername

Name                 BlobType  Length          ContentType                    LastModified         AccessTier SnapshotTime                 IsDeleted  VersionId                     
----                 --------  ------          -----------                    ------------         ---------- ------------                 ---------  ---------                     
test1                                                                                                                                      False                                    
test2                                                                                                                                      False

This command lists blobs in a container and match a specific blob tag.

Example 3: List all blobs match a specific blob tag, across containers, and get the blob properties.

Get-AzStorageBlobByTag -TagFilterSqlExpression """tag1""='value1'" -GetBlobProperty

AccountName: storageaccountname, ContainerName: containername1

Name                 BlobType  Length          ContentType                    LastModified         AccessTier SnapshotTime                 IsDeleted  VersionId                     
----                 --------  ------          -----------                    ------------         ---------- ------------                 ---------  ---------                     
testblob             BlockBlob 2097152         application/octet-stream       2020-07-23 09:35:02Z Hot                                     False      2020-07-23T09:35:02.8527357Z *                                   
testblob2            BlockBlob 1048012         application/octet-stream       2020-07-23 09:35:05Z Hot                                     False      2020-07-23T09:35:05.2504530Z *                             

   AccountName: storageaccountname, ContainerName: containername2

Name                 BlobType  Length          ContentType                    LastModified         AccessTier SnapshotTime                 IsDeleted  VersionId                     
----                 --------  ------          -----------                    ------------         ---------- ------------                 ---------  ---------                     
testblob3            BlockBlob 100             application/octet-stream       2020-07-01 09:55:14Z Hot                                     False      2020-07-01T09:55:14.6507341Z *                      
testblob4            BlockBlob 2024            application/octet-stream       2020-07-01 09:42:11Z Hot                                     False      2020-07-01T09:42:11.4283807Z *

This command lists all blobs in a storage account, which contains a tag with name "tag1" and value "value1", and get the blob properties. Please note, to get blob properties with parameter -GetBlobProperty, each blob will need an addtional request, so the cmdlet runs show when there are many blobs.

Parameters

-ClientTimeoutPerRequest

The client side maximum execution time for each request in seconds.

Type:Nullable<T>[Int32]
Aliases:ClientTimeoutPerRequestInSeconds
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ConcurrentTaskCount

The total amount of concurrent async tasks. The default value is 10.

Type:Nullable<T>[Int32]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Container

Container name, specify this parameter to only return all blobs whose tags match a search expression in the container.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Context

Azure Storage Context Object

Type:IStorageContext
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ContinuationToken

Continuation Token.

Type:BlobContinuationToken
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-GetBlobProperty

As the blobs get by tag don't contain blob proeprties, specify tis parameter to get blob properties with an additional request on each blob.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-MaxCount

The max count of the blobs that can return.

Type:Nullable<T>[Int32]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ServerTimeoutPerRequest

The server time out for each request in seconds.

Type:Nullable<T>[Int32]
Aliases:ServerTimeoutPerRequestInSeconds
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TagFilterSqlExpression

Filters the result set to only include blobs whose tags match the specified expression. See details in https://learn.microsoft.com/en-us/rest/api/storageservices/find-blobs-by-tags#remarks.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

Inputs

IStorageContext

Outputs

AzureStorageBlob