Bearbeiten

Freigeben über


Get-AzRmStorageShare

Gets or lists Storage file shares.

Syntax

Get-AzRmStorageShare
   [-ResourceGroupName] <String>
   [-StorageAccountName] <String>
   [-Name <String>]
   [-SnapshotTime <DateTime>]
   [-GetShareUsage]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzRmStorageShare
   [-ResourceGroupName] <String>
   [-StorageAccountName] <String>
   [-IncludeDeleted]
   [-IncludeSnapshot]
   [-Filter <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzRmStorageShare
   -StorageAccount <PSStorageAccount>
   -Name <String>
   [-SnapshotTime <DateTime>]
   [-GetShareUsage]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzRmStorageShare
   -StorageAccount <PSStorageAccount>
   [-IncludeDeleted]
   [-IncludeSnapshot]
   [-Filter <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzRmStorageShare
   [-ResourceId] <String>
   [-GetShareUsage]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The Get-AzRmStorageShare cmdlet gets or lists Storage file shares.

Examples

Example 1: Get a Storage file share with Storage account name and share name

Get-AzRmStorageShare -ResourceGroupName "myresourcegroup" -StorageAccountName "mystorageaccount" -Name "myshare"

ResourceGroupName: myresourcegroup, StorageAccountName: mystorageaccount

Name     QuotaGiB EnabledProtocols AccessTier Deleted Version ShareUsageBytes
----     -------- ---------------- ---------- ------- ------- ---------------
myshare  5120

This command gets a Storage file share with Storage account name and share name.

Example 2: List all Storage file shares of a Storage account

Get-AzRmStorageShare -ResourceGroupName "myresourcegroup" -StorageAccountName "mystorageaccount"

ResourceGroupName: myresourcegroup, StorageAccountName: mystorageaccount

Name     QuotaGiB EnabledProtocols AccessTier           Deleted Version ShareUsageBytes
----     -------- ---------------- ----------           ------- ------- ---------------
share1   5120                     TransactionOptimized
share2   5120                     TransactionOptimized

This command lists all Storage file shares of a Storage account with Storage account name.

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

Get-AzStorageAccount -ResourceGroupName "myresourcegroup" -StorageAccountName "mystorageaccount" | Get-AzRmStorageShare -Name "myshare"

ResourceGroupName: myresourcegroup, StorageAccountName: mystorageaccount

Name     QuotaGiB EnabledProtocols AccessTier Deleted Version ShareUsageBytes
----     -------- ---------------- ---------- ------- ------- ---------------
myshare  5120

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

Example 4: Get a Storage file share with the share usage in bytes

Get-AzRmStorageShare -ResourceGroupName "myresourcegroup" -StorageAccountName "mystorageaccount" -Name "myshare" -GetShareUsage

ResourceGroupName: myresourcegroup, StorageAccountName: mystorageaccount

Name     QuotaGiB EnabledProtocols AccessTier Deleted Version ShareUsageBytes
----     -------- ---------------- ---------- ------- ------- ---------------
myshare  5120                                                2097152

This command gets a Storage file share with Storage account name and share name, and include the share usage in bytes.

Example 5: List all Storage file shares of a Storage account, include the deleted shares, include the share snapshots

Get-AzRmStorageShare -ResourceGroupName "myresourcegroup" -StorageAccountName "mystorageaccount" -IncludeDeleted -IncludeSnapshot

ResourceGroupName: myresourcegroup, StorageAccountName: mystorageaccount

Name       QuotaGiB EnabledProtocols AccessTier           Deleted Version          ShareUsageBytes snapshotTime       
----       -------- ---------------- ----------           ------- -------          --------------- ------------       
testshare1 5120                     TransactionOptimized                                          2021-05-10T08:04:08Z
testshare1 5120                     TransactionOptimized                                                      
share1     100                      TransactionOptimized True    01D61FD1FC5498B6

This command lists all Storage file shares include the deleted shares and share snapshots.

Example 6: Get a single share snapshot

Get-AzRmStorageShare -ResourceGroupName "myresourcegroup" -StorageAccountName "mystorageaccount" -Name "testshare1" -SnapshotTime "2021-05-10T08:04:08Z"

ResourceGroupName: myresourcegroup, StorageAccountName: mystorageaccount

Name       QuotaGiB EnabledProtocols AccessTier           Deleted Version ShareUsageBytes snapshotTime       
----       -------- ---------------- ----------           ------- ------- --------------- ------------       
testshare1 5120                     TransactionOptimized                                 2021-05-10T08:04:08Z

This command gets a single file share snapshot with share name and snapshot time.

Example 7: List Storage file shares of a Storage account with a filter

Get-AzRmStorageShare -ResourceGroupName "myresourcegroup" -StorageAccountName "mystorageaccount" -Filter "startswith(name, test)"

ResourceGroupName: myresourcegroup, StorageAccountName: mystorageaccount

Name       QuotaGiB EnabledProtocols AccessTier           Deleted Version ShareUsageBytes snapshotTime
----       -------- ---------------- ----------           ------- ------- --------------- ------------
testshare1 5120     SMB              TransactionOptimized
testshare2 5120     SMB              TransactionOptimized

This command lists all Storage file shares with names that begin with "test".

Parameters

-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

-Filter

The filter of share name. When specified, only share names starting with the filter will be listed. The filter must be in format: startswith(name, <prefix>)

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

-GetShareUsage

Specify this parameter to get the Share Usage in Bytes.

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

-IncludeDeleted

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

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

-IncludeSnapshot

Include share snapshots, by default list shares won't include share snapshots.

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

-Name

Share Name

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

-ResourceGroupName

Resource Group Name.

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

-ResourceId

Input a File Share Resource Id.

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

-SnapshotTime

Share SnapshotTime

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

Inputs

PSStorageAccount

String

Outputs

PSShare