Edit

Share via


Get-AzStorageContainer

Lists the storage containers.

Syntax

ContainerName (Default)

Get-AzStorageContainer
    [[-Name] <String>]
    [-MaxCount <Int32>]
    [-ContinuationToken <BlobContinuationToken>]
    [-IncludeDeleted]
    [-Context <IStorageContext>]
    [-ServerTimeoutPerRequest <Int32>]
    [-ClientTimeoutPerRequest <Int32>]
    [-DefaultProfile <IAzureContextContainer>]
    [-ConcurrentTaskCount <Int32>]
    [<CommonParameters>]

ContainerPrefix

Get-AzStorageContainer
    -Prefix <String>
    [-MaxCount <Int32>]
    [-ContinuationToken <BlobContinuationToken>]
    [-IncludeDeleted]
    [-Context <IStorageContext>]
    [-ServerTimeoutPerRequest <Int32>]
    [-ClientTimeoutPerRequest <Int32>]
    [-DefaultProfile <IAzureContextContainer>]
    [-ConcurrentTaskCount <Int32>]
    [<CommonParameters>]

Description

The Get-AzStorageContainer cmdlet lists the storage containers associated with the storage account in Azure.

Examples

Example 1: Get Azure Storage container by name

Get-AzStorageContainer -Name container*

This example uses a wildcard character to return a list of all containers with a name that starts with container.

Example 2: Get Azure Storage container by container name prefix

Get-AzStorageContainer -Prefix "container"

This example uses the Prefix parameter to return a list of all containers with a name that starts with container.

Example 3: List Azure Storage container, include deleted containers

$containers =  Get-AzStorageContainer -IncludeDeleted -Context $ctx

$containers

   Storage Account Name: storageaccountname

Name                 PublicAccess         LastModified                   IsDeleted  VersionId
----                 ------------         ------------                   ---------  ---------
testcon              Off                  8/28/2020 10:18:13 AM +00:00
testcon2                                  9/4/2020 12:52:37 PM +00:00    True       01D67D248986B6DA

$c[1].BlobContainerProperties

LastModified                   : 9/4/2020 12:52:37 PM +00:00
LeaseStatus                    : Unlocked
LeaseState                     : Expired
LeaseDuration                  :
PublicAccess                   :
HasImmutabilityPolicy          : False
HasLegalHold                   : False
DefaultEncryptionScope         : $account-encryption-key
PreventEncryptionScopeOverride : False
DeletedOn                      : 9/8/2020 4:29:59 AM +00:00
RemainingRetentionDays         : 299
ETag                           : "0x8D850D167059285"
Metadata                       : {}

This example lists all containers of a storage account, include deleted containers. Then show the deleted container properties, include : DeletedOn, RemainingRetentionDays. Deleted containers will only exist after enabled Container softdelete with Enable-AzStorageBlobDeleteRetentionPolicy.

Parameters

-ClientTimeoutPerRequest

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.

Parameter properties

Type:

Nullable<T>[Int32]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:ClientTimeoutPerRequestInSeconds

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ConcurrentTaskCount

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.

Parameter properties

Type:

Nullable<T>[Int32]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Context

Specifies the storage context. To create it, you can use the New-AzStorageContext cmdlet. The container permissions won't be retrieved when you use a storage context created from SAS Token, because query container permissions requires Storage account key permission.

Parameter properties

Type:IStorageContext
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-ContinuationToken

Specifies a continuation token for the blob list.

Parameter properties

Type:BlobContinuationToken
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

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

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IncludeDeleted

Include deleted containers, by default list containers won't include deleted containers

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MaxCount

Specifies the maximum number of objects that this cmdlet returns.

Parameter properties

Type:

Nullable<T>[Int32]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

Specifies the container name. If container name is empty, the cmdlet lists all the containers. Otherwise, it lists all containers that match the specified name or the regular name pattern.

Parameter properties

Type:String
Default value:None
Supports wildcards:True
DontShow:False
Aliases:N, Container

Parameter sets

ContainerName
Position:0
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-Prefix

Specifies a prefix used in the name of the container or containers you want to get. You can use this to find all containers that start with the same string, such as "my" or "test".

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ContainerPrefix
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ServerTimeoutPerRequest

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.

Parameter properties

Type:

Nullable<T>[Int32]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:ServerTimeoutPerRequestInSeconds

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

String

IStorageContext

Outputs

AzureStorageContainer