Database Accounts - Regenerate Key

Regenerates an access key for the specified Azure Cosmos DB database account.

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey?api-version=2023-11-15

URI Parameters

Name In Required Type Description
accountName
path True

string

Cosmos DB database account name.

Regex pattern: ^[a-z0-9]+(-[a-z0-9]+)*

resourceGroupName
path True

string

The name of the resource group. The name is case insensitive.

subscriptionId
path True

string

The ID of the target subscription.

api-version
query True

string

The API version to use for this operation.

Request Body

Name Required Type Description
keyKind True

KeyKind

The access key to regenerate.

Responses

Name Type Description
200 OK

OK

202 Accepted

Accepted. The regenerate key operation will complete asynchronously.

Headers

  • azure-AsyncOperation: string
  • location: string

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation Impersonate your user account

Examples

CosmosDBDatabaseAccountRegenerateKey

Sample Request

POST https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/regenerateKey?api-version=2023-11-15

{
  "keyKind": "primary"
}

Sample Response

Location: https://centraluseuap.management.azure.com/subscriptions/d1eb41bc-1b7f-4404-bd2a-8568c222852d/providers/Microsoft.DocumentDB/locations/centraluseuap/operationsStatus/fdd04b7b-86d5-460f-b19e-386230348bcc?api-version=2023-11-15
Azure-AsyncOperation: https://centraluseuap.management.azure.com/subscriptions/d1eb41bc-1b7f-4404-bd2a-8568c222852d/providers/Microsoft.DocumentDB/locations/centraluseuap/operationsStatus/fdd04b7b-86d5-460f-b19e-386230348bcc?api-version=2023-11-15

Definitions

Name Description
DatabaseAccountRegenerateKeyParameters

Parameters to regenerate the keys within the database account.

KeyKind

The access key to regenerate.

DatabaseAccountRegenerateKeyParameters

Parameters to regenerate the keys within the database account.

Name Type Description
keyKind

KeyKind

The access key to regenerate.

KeyKind

The access key to regenerate.

Name Type Description
primary

string

primaryReadonly

string

secondary

string

secondaryReadonly

string