Modifier

Partager via


New-AzCosmosDBAccountKey

Regenerate a given CosmosDB Account Key.

Syntax

New-AzCosmosDBAccountKey
   -ResourceGroupName <String>
   -Name <String>
   [-KeyKind <String>]
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzCosmosDBAccountKey
   [-KeyKind <String>]
   -ResourceId <String>
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzCosmosDBAccountKey
   [-KeyKind <String>]
   -InputObject <PSDatabaseAccountGetResults>
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Create a new CosmosDB Account in the given ResourceGroup.

Examples

Example 1

New-AzCosmosDBAccountKey -ResourceGroupName rg -Name dbname

New keys are generated for Account with account name dbname in ResourceGroup rg.

Example 2

Regenerate a given CosmosDB Account Key. (autogenerated)

New-AzCosmosDBAccountKey -KeyKind <String> -Name dbname -ResourceGroupName rg

Parameters

-AsJob

Run cmdlet in the background

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

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
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

-InputObject

CosmosDB Account object

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

-KeyKind

The access key to regenerate. Accepted values: primary, primaryReadonly, secondary, secondaryReadonly

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

-Name

Name of the Cosmos DB database account.

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

-ResourceGroupName

Name of resource group.

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

-ResourceId

ResourceId of the resource.

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

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

Void