Upravit

Sdílet prostřednictvím


Get-AzStorageContainer

Lists the storage containers.

Syntax

Get-AzStorageContainer
   [[-Name] <String>]
   [-MaxCount <Int32>]
   [-ContinuationToken <BlobContinuationToken>]
   [-IncludeDeleted]
   [-Context <IStorageContext>]
   [-ServerTimeoutPerRequest <Int32>]
   [-ClientTimeoutPerRequest <Int32>]
   [-DefaultProfile <IAzureContextContainer>]
   [-ConcurrentTaskCount <Int32>]
   [<CommonParameters>]
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.

Type:Nullable<T>[Int32]
Aliases:ClientTimeoutPerRequestInSeconds
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

Type:Nullable<T>[Int32]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

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

-ContinuationToken

Specifies a continuation token for the blob list.

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

-IncludeDeleted

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

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

-MaxCount

Specifies the maximum number of objects that this cmdlet returns.

Type:Nullable<T>[Int32]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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.

Type:String
Aliases:N, Container
Position:0
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:True

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

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters: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.

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

Inputs

String

IStorageContext

Outputs

AzureStorageContainer