Get-AzBatchAccountKey

Gets the keys of a Batch account.

Note

This is the previous version of our documentation. Please consult the most recent version for up-to-date information.

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

PS C:\>$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

PS C:\>$Context = Get-AzBatchAccountKey -AccountName myaccount
PS C:\>$Context.PrimaryAccountKey
ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMN==
PS C:\>$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
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
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
Accept pipeline input:True
Accept wildcard characters:False

Inputs

String

Outputs

BatchAccountContext