Edit

Share via


Get-AzStorageAccount

Gets a Storage account.

Syntax

ResourceGroupParameterSet

Get-AzStorageAccount
    [[-ResourceGroupName] <String>]
    [-AsJob]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

AccountNameParameterSet

Get-AzStorageAccount
    [-ResourceGroupName] <String>
    [-Name] <String>
    [-IncludeGeoReplicationStats]
    [-AsJob]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

BlobRestoreStatusParameterSet

Get-AzStorageAccount
    [-ResourceGroupName] <String>
    [-Name] <String>
    [-IncludeBlobRestoreStatus]
    [-AsJob]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

The Get-AzStorageAccount cmdlet gets a specified Storage account or all of the Storage accounts in a resource group or the subscription.

Examples

Example 1: Get a specified Storage account

Get-AzStorageAccount -ResourceGroupName "RG01" -Name "mystorageaccount"

This command gets the specified Storage account.

Example 2: Get all Storage accounts in a resource group

Get-AzStorageAccount -ResourceGroupName "RG01"

This command gets all of the Storage accounts in a resource group.

Example 3: Get all Storage accounts in the subscription

Get-AzStorageAccount

This command gets all of the Storage accounts in the subscription.

Example 4: Get a Storage accounts with its blob restore status

$account = Get-AzStorageAccount -ResourceGroupName "myresourcegoup" -Name "mystorageaccount" -IncludeBlobRestoreStatus

$account.BlobRestoreStatus
Status     RestoreId                            FailureReason Parameters.TimeToRestore     Parameters.BlobRanges
------     ---------                            ------------- ------------------------     ---------------------
InProgress a70cd4a1-f223-4c86-959f-cc13eb4795a8               2020-02-10T13:45:04.7155962Z [container1/blob1 -> container2/blob2]

This command gets a Storage accounts with its blob restore status, and show the blob restore status.

Parameters

-AsJob

Run cmdlet in the background

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

-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

-IncludeBlobRestoreStatus

Get the BlobRestoreStatus of the Storage account.

Parameter properties

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

Parameter sets

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

-IncludeGeoReplicationStats

Get the GeoReplicationStats of the Storage account.

Parameter properties

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

Parameter sets

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

-Name

Specifies the name of the Storage account to get.

Parameter properties

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

Parameter sets

AccountNameParameterSet
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
BlobRestoreStatusParameterSet
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ResourceGroupName

Specifies the name of the resource group that contains the Storage account to get.

Parameter properties

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

Parameter sets

ResourceGroupParameterSet
Position:0
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
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

Outputs

PSStorageAccount