< Back

Get-AzureStorageBlob

Tue Jan 29, 2019 9:26 pm

NAME Get-AzureStorageBlob



SYNOPSIS

Lists blobs in a container.





SYNTAX

Get-AzureStorageBlob [[-Blob] <String>] [-Container] <String> [-ClientTimeoutPerRequest <Int32>] [-ConcurrentTaskCount <Int32>] [-Context

<IStorageContext>] [-ContinuationToken <BlobContinuationToken>] [-IncludeDeleted] [-MaxCount <Int32>] [-ServerTimeoutPerRequest <Int32>]

[<CommonParameters>]



Get-AzureStorageBlob [-Container] <String> [-ClientTimeoutPerRequest <Int32>] [-ConcurrentTaskCount <Int32>] [-Context <IStorageContext>]

[-ContinuationToken <BlobContinuationToken>] [-IncludeDeleted] [-MaxCount <Int32>] [-Prefix <String>] [-ServerTimeoutPerRequest <Int32>]

[<CommonParameters>]





DESCRIPTION

The Get-AzureStorageBlob cmdlet lists blobs in the specified container in an Azure storage account.





PARAMETERS

-Blob <String>

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.



Required? false

Position? 0

Default value None

Accept pipeline input? False

Accept wildcard characters? true



-ClientTimeoutPerRequest <Int32>

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.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ConcurrentTaskCount <Int32>

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.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Container <String>

Specifies the name of the container.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Context <IStorageContext>

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.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName, ByValue)

Accept wildcard characters? false



-ContinuationToken <BlobContinuationToken>

Specifies a continuation token for the blob list. Use this parameter and the MaxCount parameter to list blobs in multiple batches.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-IncludeDeleted [<SwitchParameter>]

Include Deleted Blob, by default get blob won't include deleted blob.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-MaxCount <Int32>

Specifies the maximum number of objects that this cmdlet returns.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Prefix <String>

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".



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ServerTimeoutPerRequest <Int32>

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.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

IStorageContext

Parameter 'Context' accepts value of type 'IStorageContext' from the pipeline





OUTPUTS

AzureStorageBlob







NOTES









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 blobs in a container by using the pipeline



PS C:\\>Get-AzureStorageContainer -Name container* | Get-AzureStorageBlob -IncludeDeleted



Container Uri: https://storageaccountname.blob.core.wi ... container1



Name BlobType Length ContentType LastModified AccessTier SnapshotTime IsDeleted

---- -------- ------ ----------- ------------ ---------- ------------ ---------

test1 BlockBlob 403116 application/octet-stream 2017-11-08 07:53:19Z 2017-11-08 08:19:32Z True

test1 BlockBlob 403116 application/octet-stream 2017-11-08 09:00:29Z True

test2 BlockBlob 403116 application/octet-stream 2017-11-08 07:53:00Z False



This command uses the pipeline to get all blobs (include blobs in Deleted status) in a container.





Example 3: Get blobs by name prefix



PS C:\\>Get-AzureStorageBlob -Container "ContainerName" -Prefix "blob"



This command uses a name prefix to get blobs.





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.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... torageblob

Get-AzureStorageBlobContent

Remove-AzureStorageBlob

Set-AzureStorageBlobContent