Share via


Sql Resources - Get Client Encryption Key

Gets the ClientEncryptionKey under an existing Azure Cosmos DB SQL database.

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}?api-version=2024-11-15

URI Parameters

Name In Required Type Description
accountName
path True

string

minLength: 3
maxLength: 50
pattern: ^[a-z0-9]+(-[a-z0-9]+)*

Cosmos DB database account name.

clientEncryptionKeyName
path True

string

Cosmos DB ClientEncryptionKey name.

databaseName
path True

string

Cosmos DB database name.

resourceGroupName
path True

string

minLength: 1
maxLength: 90

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

subscriptionId
path True

string

minLength: 1

The ID of the target subscription.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Responses

Name Type Description
200 OK

ClientEncryptionKeyGetResults

The ClientEncryptionKey was retrieved successfully.

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

CosmosDBClientEncryptionKeyGet

Sample request

GET https://management.azure.com/subscriptions/subId/resourceGroups/rgName/providers/Microsoft.DocumentDB/databaseAccounts/accountName/sqlDatabases/databaseName/clientEncryptionKeys/cekName?api-version=2024-11-15

Sample response

{
  "id": "/subscriptions/subId/resourceGroups/rgName/providers/Microsoft.DocumentDB/databaseAccounts/accountName/sqlDatabases/databaseName/clientEncryptionKeys/cekName",
  "name": "cekName",
  "type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/clientEncryptionKey",
  "properties": {
    "resource": {
      "id": "cekName",
      "encryptionAlgorithm": "AEAD_AES_256_CBC_HMAC_SHA256",
      "wrappedDataEncryptionKey": "U3dhZ2dlciByb2Nrcw==",
      "keyWrapMetadata": {
        "name": "customerManagedKey",
        "type": "AzureKeyVault",
        "value": "AzureKeyVault Key URL",
        "algorithm": "RSA-OAEP"
      },
      "_rid": "tNc4AAAAAAAQkjzWAgAAAA==",
      "_ts": 1626425552,
      "_etag": "00000000-0000-0000-7a1f-bc0828e801d7"
    }
  }
}

Definitions

Name Description
ClientEncryptionKeyGetResults

Client Encryption Key.

KeyWrapMetadata

Represents key wrap metadata that a key wrapping provider can use to wrap/unwrap a client encryption key.

Resource

ClientEncryptionKeyGetResults

Client Encryption Key.

Name Type Description
id

string

The unique resource identifier of the database account.

name

string

The name of the database account.

properties.resource

Resource

type

string

The type of Azure resource.

KeyWrapMetadata

Represents key wrap metadata that a key wrapping provider can use to wrap/unwrap a client encryption key.

Name Type Description
algorithm

string

Algorithm used in wrapping and unwrapping of the data encryption key.

name

string

The name of associated KeyEncryptionKey (aka CustomerManagedKey).

type

string

ProviderName of KeyStoreProvider.

value

string

Reference / link to the KeyEncryptionKey.

Resource

Name Type Description
_etag

string

A system generated property representing the resource etag required for optimistic concurrency control.

_rid

string

A system generated property. A unique identifier.

_ts

number

A system generated property that denotes the last updated timestamp of the resource.

encryptionAlgorithm

string

Encryption algorithm that will be used along with this client encryption key to encrypt/decrypt data.

id

string

Name of the ClientEncryptionKey

keyWrapMetadata

KeyWrapMetadata

Metadata for the wrapping provider that can be used to unwrap the wrapped client encryption key.

wrappedDataEncryptionKey

string (byte)

Wrapped (encrypted) form of the key represented as a byte array.