Get-AzStorageBlob

Updated: October 26, 2023

The Get-AzStorageBlob cmdlet gets a blob or blobs in a container.

Syntax


Get-AzStorageBlob [-Container <String>]
    [-Blob <String>]
    [-Force]
    [-Prefix <String>]
    [-Tag <Hashtable>]
    [-Query <String>]
    [-Context <IStorageContext>]
    [-ServerTimeoutPerRequest <Int32>]
    [-ClientTimeoutPerRequest <Int32>]
    [-DefaultProfile <AzureRmProfile>]
    [-InformationAction <ActionPreference>]
    [-InformationVariable <String>]
                

Parameters

Name Description Type Required
-Container Specifies the name of the container that contains the blobs. String Yes
-Blob Specifies the name of the blob. This cmdlet gets the blob that matches the specified name. String No
-Force Forces the command to run without asking for user confirmation. Switch No
-Prefix Specifies a string prefix. This cmdlet gets all blobs that start with the specified prefix. String No
-Tag Specifies a hash table of blob tags. This cmdlet gets blobs that match the specified tags. Hashtable No
-Query Specifies a query string for filtering blobs. String No
-Context Specifies the storage account context. IStorageContext No
-ServerTimeoutPerRequest Specifies the time out for a single server request, in seconds. Int32 No
-ClientTimeoutPerRequest Specifies the time out for a single client request, in seconds. Int32 No
-DefaultProfile The default Azure profile for the cmdlet. AzureRmProfile No
-InformationAction Specifies how to handle information requests. ActionPreference No
-InformationVariable Specifies a variable in which to store information responses. String No

Examples

Example 1: Get all blobs in a container


PS C:\> Get-AzStorageBlob -Container "MyContainer"
                

This command gets all blobs in the container named "MyContainer".

Example 2: Get a specific blob


PS C:\> Get-AzStorageBlob -Container "MyContainer" -Blob "MyBlob.txt"
                

This command gets the blob named "MyBlob.txt" from the "MyContainer" container.

Example 3: Get blobs with a specific prefix


PS C:\> Get-AzStorageBlob -Container "MyContainer" -Prefix "logs/"
                

This command gets all blobs in "MyContainer" that start with "logs/".

Example 4: Get blobs with tags


PS C:\> $tags = @{"Project"="Alpha"; "Status"="Active"}
PS C:\> Get-AzStorageBlob -Container "MyContainer" -Tag $tags
                

This command gets all blobs in "MyContainer" that have the tags "Project=Alpha" and "Status=Active".

Related Links