Edit

Share via


Get-AzCosmosDBAccountKey

Get Keys{"ConnectionKeys", "PrimaryReadOnly" or "Keys"} for the given CosmosDB Account.

Syntax

ByNameParameterSet (Default)

Get-AzCosmosDBAccountKey
    -ResourceGroupName <String>
    -Name <String>
    [-Type <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ByResourceIdParameterSet

Get-AzCosmosDBAccountKey
    -ResourceId <String>
    [-Type <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ByObjectParameterSet

Get-AzCosmosDBAccountKey
    -InputObject <PSDatabaseAccountGetResults>
    [-Type <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

Get the list of connection keys.

Examples

Example 1

Get-AzCosmosDBAccountKey -ResourceGroupName rg1 -Name dbname -Type "ReadOnlyKeys"
Name                           Value
----                           -----
PrimaryReadonlyMasterKey       ********************************
SecondaryReadonlyMasterKey     ********************************

Lists the keys for CosmosDB Account. The Key Type can be value from : ConnectionStrings, Keys and ReadOnlyKeys. Default is Keys.

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

-InputObject

CosmosDB Account object

Parameter properties

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

Parameter sets

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

-Name

Name of the Cosmos DB database account.

Parameter properties

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

Parameter sets

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

-ResourceGroupName

Name of resource group.

Parameter properties

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

Parameter sets

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

-ResourceId

ResourceId of the resource.

Parameter properties

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

Parameter sets

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

-Type

Value from: {ConnectionStrings, Keys, ReadOnlyKeys}. Default is Keys.

Parameter properties

Type:String
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

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

None

Outputs

Microsoft.Azure.Commands.CosmosDB.Models.PSDatabaseAccountListConnectionStrings

Microsoft.Azure.Commands.CosmosDB.Models.PSDatabaseAccountListKeysResult

Microsoft.Azure.Commands.CosmosDB.Models.PSDatabaseAccountListReadOnlyKeysResult