Database Accounts - List Keys
列出指定 Azure Cosmos DB 資料庫帳戶的存取金鑰。
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listKeys?api-version=2025-10-15
URI 參數
| 名稱 | 位於 | 必要 | 類型 | Description |
|---|---|---|---|---|
|
account
|
path | True |
string minLength: 3maxLength: 50 pattern: ^[a-z0-9]+(-[a-z0-9]+)* |
Cosmos DB 資料庫帳戶名稱。 |
|
resource
|
path | True |
string minLength: 1maxLength: 90 |
資源群組的名稱。 名稱不區分大小寫。 |
|
subscription
|
path | True |
string minLength: 1 |
目標訂用帳戶的標識碼。 |
|
api-version
|
query | True |
string minLength: 1 |
用於此作業的 API 版本。 |
回應
| 名稱 | 類型 | Description |
|---|---|---|
| 200 OK |
作業已順利完成。 |
安全性
azure_auth
Azure Active Directory OAuth2 流
類型:
oauth2
Flow:
implicit
授權 URL:
https://login.microsoftonline.com/common/oauth2/authorize
範圍
| 名稱 | Description |
|---|---|
| user_impersonation | 模擬您的用戶帳戶 |
範例
CosmosDBDatabaseAccountListKeys
範例要求
POST https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/listKeys?api-version=2025-10-15
範例回覆
{
"primaryMasterKey": "primaryMasterKey",
"secondaryMasterKey": "secondaryMasterKey",
"primaryReadonlyMasterKey": "primaryReadonlyMasterKey",
"secondaryReadonlyMasterKey": "secondaryReadonlyMasterKey"
}
定義
DatabaseAccountListKeysResult
指定資料庫帳戶的存取金鑰。
| 名稱 | 類型 | Description |
|---|---|---|
| primaryMasterKey |
string |
主讀寫金鑰的 Base 64 編碼值。 |
| primaryReadonlyMasterKey |
string |
主要唯讀索引鍵的 Base 64 編碼值。 |
| secondaryMasterKey |
string |
次要讀寫索引鍵的 Base 64 編碼值。 |
| secondaryReadonlyMasterKey |
string |
次要唯讀索引鍵的 Base 64 編碼值。 |