Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

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

-InputObject

CosmosDB Account object

Parameter properties

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

Parameter sets

-Name

Name of the Cosmos DB database account.

Parameter properties

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

Parameter sets

-ResourceGroupName

Name of resource group.

Parameter properties

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

Parameter sets

-ResourceId

ResourceId of the resource.

Parameter properties

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

Parameter sets

-Type

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

Parameter properties

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

Parameter sets

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


Feedback

Was this page helpful?