Get-AzureStorageBlob
Lists blobs in a container.
Important
You've reached a webpage for an outdated version of Azure PowerShell. All versions of the AzureRM PowerShell module are outdated, but not out of support. The Az PowerShell module is now the recommended PowerShell module for interacting with Azure. To get started with the Az PowerShell module, see Install Azure PowerShell. To learn how to migrate to the Az PowerShell module, see Migrate Azure PowerShell from AzureRM to Az.
Syntax
Get-AzureStorageBlob
[[-Blob] <String>]
[-Container] <String>
[-MaxCount <Int32>]
[-ContinuationToken <BlobContinuationToken>]
[-Context <IStorageContext>]
[-ServerTimeoutPerRequest <Int32>]
[-ClientTimeoutPerRequest <Int32>]
[-ConcurrentTaskCount <Int32>]
[<CommonParameters>]
Get-AzureStorageBlob
[-Prefix <String>]
[-Container] <String>
[-MaxCount <Int32>]
[-ContinuationToken <BlobContinuationToken>]
[-Context <IStorageContext>]
[-ServerTimeoutPerRequest <Int32>]
[-ClientTimeoutPerRequest <Int32>]
[-ConcurrentTaskCount <Int32>]
[<CommonParameters>]
Description
The Get-AzureStorageBlob cmdlet lists blobs in the specified container in an Azure storage account.
Examples
Example 1: Get a blob by blob name
PS C:\>Get-AzureStorageBlob -Container "ContainerName" -Blob blob*
This command uses a blob name and wildcard to get a blob.
Example 2: Get a blob by using the pipeline
PS C:\>Get-AzureStorageContainer -Name container* | Get-AzureStorageBlob
This command uses the pipeline to get a blob.
Example 3: Get a blob by name prefix
PS C:\>Get-AzureStorageBlob -Container "ContainerName" -Prefix "blob"
This command uses a name prefix to get a blob.
Example 4: List blobs in multiple batches
PS C:\>$MaxReturn = 10000
PS C:\> $ContainerName = "abc"
PS C:\> $Total = 0
PS C:\> $Token = $Null
PS C:\> do
{
$Blobs = Get-AzureStorageBlob -Container $ContainerName -MaxCount $MaxReturn -ContinuationToken $Token
$Total += $Blobs.Count
if($Blobs.Length -le 0) { Break;}
$Token = $Blobs[$blobs.Count -1].ContinuationToken;
}
While ($Token -ne $Null)
PS C:\> Echo "Total $Total blobs in container $ContainerName"
This example uses the MaxCount and ContinuationToken parameters to list Azure Storage blobs in multiple batches. The first four commands assign values to variables to use in the example.
The fifth command specifies a Do-While statement that uses the Get-AzureStorageBlob cmdlet to get blobs.
The statement includes the continuation token stored in the $Token variable.
$Token changes value as the loop runs.
For more information, type Get-Help About_Do
.
The final command uses the Echo command to display the total.
Parameters
Specifies a name or name pattern, which can be used for a wildcard search. If no blob name is specified, the cmdlet lists all the blobs in the specified container. If a value is specified for this parameter, the cmdlet lists all blobs with names that match this parameter.
Type: | String |
Position: | 0 |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | True |
Specifies the client-side time-out interval, in seconds, for one service request. If the previous call fails in the specified interval, this cmdlet retries the request. If this cmdlet does not receive a successful response before the interval elapses, this cmdlet returns an error.
Type: | Int32 |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the maximum concurrent network calls. You can use this parameter to limit the concurrency to throttle local CPU and bandwidth usage by specifying the maximum number of concurrent network calls. The specified value is an absolute count and is not multiplied by the core count. This parameter can help reduce network connection problems in low bandwidth environments, such as 100 kilobits per second. The default value is 10.
Type: | Int32 |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the name of the container.
Type: | String |
Aliases: | N, Name |
Position: | 1 |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Specifies the Azure storage account from which you want to get a list of blobs. You can use the New-AzureStorageContext cmdlet to create a storage context.
Type: | IStorageContext |
Position: | Named |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Specifies a continuation token for the blob list. Use this parameter and the MaxCount parameter to list blobs in multiple batches.
Type: | BlobContinuationToken |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the maximum number of objects that this cmdlet returns.
Type: | Int32 |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies a prefix for the blob names that you want to get. This parameter does not support using regular expressions or wildcard characters to search. This means that if the container has only blobs named "My", "MyBlob1", and "MyBlob2" and you specify "-Prefix My*", the cmdlet returns no blobs. However, if you specify "-Prefix My", the cmdlet returns "My", "MyBlob1", and "MyBlob2".
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the service side time-out interval, in seconds, for a request. If the specified interval elapses before the service processes the request, the storage service returns an error.
Type: | Int32 |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
IStorageContext
Parameter 'Context' accepts value of type 'IStorageContext' from the pipeline
Outputs
AzureStorageBlob