Edit

Share via


Get-AzRmStorageShare

Gets or lists Storage file shares.

Syntax

AccountNameSingle (Default)

Get-AzRmStorageShare
    [-ResourceGroupName] <String>
    [-StorageAccountName] <String>
    [-Name <String>]
    [-SnapshotTime <DateTime>]
    [-GetShareUsage]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

AccountName

Get-AzRmStorageShare
    [-ResourceGroupName] <String>
    [-StorageAccountName] <String>
    [-IncludeDeleted]
    [-IncludeSnapshot]
    [-Filter <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

AccountObjectSingle

Get-AzRmStorageShare
    -StorageAccount <PSStorageAccount>
    -Name <String>
    [-SnapshotTime <DateTime>]
    [-GetShareUsage]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

AccountObject

Get-AzRmStorageShare
    -StorageAccount <PSStorageAccount>
    [-IncludeDeleted]
    [-IncludeSnapshot]
    [-Filter <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ShareResourceId

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.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, 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

-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>)

Parameter properties

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

Parameter sets

AccountName
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AccountObject
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-GetShareUsage

Specify this parameter to get the Share Usage in Bytes.

Parameter properties

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

Parameter sets

AccountNameSingle
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AccountObjectSingle
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ShareResourceId
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IncludeDeleted

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

Parameter properties

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

Parameter sets

AccountName
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AccountObject
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IncludeSnapshot

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

Parameter properties

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

Parameter sets

AccountName
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AccountObject
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

Share Name

Parameter properties

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

Parameter sets

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

-ResourceGroupName

Resource Group Name.

Parameter properties

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

Parameter sets

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

-ResourceId

Input a File Share Resource Id.

Parameter properties

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

Parameter sets

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

-SnapshotTime

Share SnapshotTime

Parameter properties

Type:

Nullable<T>[DateTime]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AccountNameSingle
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AccountObjectSingle
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-StorageAccount

Storage account object

Parameter properties

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

Parameter sets

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

-StorageAccountName

Storage Account Name.

Parameter properties

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

Parameter sets

AccountNameSingle
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AccountName
Position:1
Mandatory:True
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

PSStorageAccount

String

Outputs

PSShare