Database Accounts - List Keys
Lists the access keys for the specified Azure Cosmos DB database account.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listKeys?api-version=2026-03-15
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
account
|
path | True |
string minLength: 3maxLength: 50 pattern: ^[a-z0-9]+(-[a-z0-9]+)* |
Cosmos DB database account name. |
|
resource
|
path | True |
string minLength: 1maxLength: 90 |
The name of the resource group. The name is case insensitive. |
|
subscription
|
path | True |
string (uuid) |
The ID of the target subscription. The value must be an UUID. |
|
api-version
|
query | True |
string minLength: 1 |
The API version to use for this operation. |
Responses
| Name | Type | Description |
|---|---|---|
| 200 OK |
Azure operation completed successfully. |
|
| Other Status Codes |
An unexpected error response. |
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
CosmosDBDatabaseAccountListKeys
Sample request
Sample response
{
"primaryMasterKey": "primaryMasterKey",
"secondaryMasterKey": "secondaryMasterKey",
"primaryReadonlyMasterKey": "primaryReadonlyMasterKey",
"secondaryReadonlyMasterKey": "secondaryReadonlyMasterKey"
}
Definitions
| Name | Description |
|---|---|
|
Database |
The access keys for the given database account. |
|
Error |
Error Response. |
DatabaseAccountListKeysResult
The access keys for the given database account.
| Name | Type | Description |
|---|---|---|
| primaryMasterKey |
string |
Base 64 encoded value of the primary read-write key. |
| primaryReadonlyMasterKey |
string |
Base 64 encoded value of the primary read-only key. |
| secondaryMasterKey |
string |
Base 64 encoded value of the secondary read-write key. |
| secondaryReadonlyMasterKey |
string |
Base 64 encoded value of the secondary read-only key. |
ErrorResponse
Error Response.
| Name | Type | Description |
|---|---|---|
| code |
string |
Error code. |
| message |
string |
Error message indicating why the operation failed. |