Get-AzCosmosDBAccountKey

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

Syntax

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

Description

Get the list of connection keys.

Examples

Example 1

PS C:\>  Get-AzCosmosDBAccountKey -ResourceGroupName rg1 -Name dbname -Type "ReadOnlyKeys"

Name                           Value
----                           -----
PrimaryReadonlyMasterKey       qjw0ISW1WNN0BIVPeaI7Tm3H8uZ1h7ESQjxaUendxHmIUNQowVvcL84fTqeXoC2HFgyu8Zo1mCFEcg0jZJHPjA==
SecondaryReadonlyMasterKey     9YRcTABuOHcKyHAKf0lmCeHsrcXu02aeID1g3wjXjlX8SU4s2WNlEB5htJoy3xqxNDqIyGfnq3dblLbrZDbesg==

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.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InputObject

CosmosDB Account object

Type:PSDatabaseAccountGetResults
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-Name

Name of the Cosmos DB database account.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ResourceGroupName

Name of resource group.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ResourceId

ResourceId of the resource.

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

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

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

Inputs

None

Outputs

Microsoft.Azure.Commands.CosmosDB.Models.PSDatabaseAccountListConnectionStrings

Microsoft.Azure.Commands.CosmosDB.Models.PSDatabaseAccountListKeysResult

Microsoft.Azure.Commands.CosmosDB.Models.PSDatabaseAccountListReadOnlyKeysResult