Redigera

Dela via


Get-AzStorageAccount

Gets a Storage account.

Syntax

Get-AzStorageAccount
   [[-ResourceGroupName] <String>]
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzStorageAccount
   [-ResourceGroupName] <String>
   [-Name] <String>
   [-IncludeGeoReplicationStats]
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
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

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

-IncludeBlobRestoreStatus

Get the BlobRestoreStatus of the Storage account.

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

-IncludeGeoReplicationStats

Get the GeoReplicationStats of the Storage account.

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

-Name

Specifies the name of the Storage account to get.

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

-ResourceGroupName

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

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

Inputs

String

Outputs

PSStorageAccount