Editar

Partilhar via


Get-AzBatchAccountKey

Gets the keys of a Batch account.

Syntax

Get-AzBatchAccountKey
   [-AccountName] <String>
   [-ResourceGroupName <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The Get-AzBatchAccountKey cmdlet gets the keys of an Azure Batch account in the current subscription.

Examples

Example 1: Get batch account keys and save it in $Context variable for use later

$Context = Get-AzBatchAccountKey -AccountName myaccount

This command gets the account details and stores it in a $Context object for use later.

Example 2: Get batch account keys and display them

$Context = Get-AzBatchAccountKey -AccountName myaccount
$Context.PrimaryAccountKey
ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMN==
$Context.SecondaryAccountKey
ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMN==

This command gets the account keys and prints them to the console.

Parameters

-AccountName

Specifies the name of the account for which this cmdlet gets keys.

Type:String
Aliases:Name
Position:0
Default value:None
Required:True
Accept pipeline input:True
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

-ResourceGroupName

Specifies the name of the resource group that contains the account for which this cmdlet gets keys.

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

Inputs

String

Outputs

BatchAccountContext