Redigera

Dela via


Get-AzRmStorageContainer

Gets or lists Storage blob containers

Syntax

Get-AzRmStorageContainer
   [-ResourceGroupName] <String>
   [-StorageAccountName] <String>
   [-Name <String>]
   [-IncludeDeleted]
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzRmStorageContainer
   -StorageAccount <PSStorageAccount>
   [-Name <String>]
   [-IncludeDeleted]
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The Get-AzRmStorageContainer cmdlet gets or lists Storage blob containers

Examples

Example 1: Get a Storage blob container with Storage account name and container name

Get-AzRmStorageContainer -ResourceGroupName "myResourceGroup" -AccountName "myStorageAccount" -ContainerName "myContainer"

This command gets a Storage blob container with Storage account name and container name.

Example 2: List all Storage blob containers of a Storage account

Get-AzRmStorageContainer -ResourceGroupName "myResourceGroup" -AccountName "myStorageAccount"

This command lists all Storage blob containers of a Storage account with Storage account name.

Example 3: Get a Storage blob container with Storage account object and container name.

$accountObject = Get-AzStorageAccount -ResourceGroupName "myResourceGroup" -AccountName "myStorageAccount"
Get-AzRmStorageContainer -StorageAccount $accountObject -ContainerName "myContainer"

This command gets a Storage blob container with Storage account object and container name.

Example 4: List Storage blob container of a Storage account, include deleted containers.

Get-AzRmStorageContainer -ResourceGroupName "myResourceGroup" -AccountName "myStorageAccount" -IncludeDeleted

ResourceGroupName: myResourceGroup, StorageAccountName: myStorageAccount

Name         PublicAccess LastModified         HasLegalHold HasImmutabilityPolicy Deleted VersionId  
----         ------------ ------------         ------------ --------------------- ------- ---------  
testcon      None         2020-08-28 10:18:13Z False        False                 False   01D685BC91A88F22
testcon2     None         2020-09-04 12:52:37Z False        False                 True    01D67D248986B6DA

This example lists all containers of a storage account, include deleted containers. Deleted containers will only exist after enabled Container softdelete with Enable-AzStorageBlobDeleteRetentionPolicy.

Parameters

-AsJob

Run cmdlet in the background

Type:SwitchParameter
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:AzContext, 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

-Name

Container Name

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

-ResourceGroupName

Resource Group Name.

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

-StorageAccount

Storage account object

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

-StorageAccountName

Storage Account Name.

Type:String
Aliases:AccountName
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Inputs

String

PSStorageAccount

Outputs

PSContainer