Share via


Sql Resources - Get Sql Container

Gets the SQL container under an existing Azure Cosmos DB database account.

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}?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.

containerName
path True

string

Cosmos DB container 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

SqlContainerGetResults

The SQL container property 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

CosmosDBSqlContainerGet

Sample request

GET https://management.azure.com/subscriptions/subid/resourceGroups/rgName/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/containers/containerName?api-version=2024-11-15

Sample response

{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/containers/containerName",
  "name": "containerName",
  "type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/sqlContainers",
  "location": "West US",
  "tags": {},
  "properties": {
    "resource": {
      "id": "containerName",
      "indexingPolicy": {
        "indexingMode": "consistent",
        "automatic": true,
        "includedPaths": [
          {
            "path": "/*",
            "indexes": [
              {
                "kind": "Range",
                "dataType": "String",
                "precision": -1
              },
              {
                "kind": "Range",
                "dataType": "Number",
                "precision": -1
              }
            ]
          }
        ],
        "excludedPaths": [],
        "vectorIndexes": [
          {
            "path": "/vectorPath1",
            "type": "flat"
          },
          {
            "path": "/vectorPath2",
            "type": "quantizedFlat"
          },
          {
            "path": "/vectorPath3",
            "type": "diskANN"
          }
        ]
      },
      "vectorEmbeddingPolicy": {
        "vectorEmbeddings": [
          {
            "path": "/vectorPath1",
            "dataType": "float32",
            "dimensions": 400,
            "distanceFunction": "euclidean"
          },
          {
            "path": "/vectorPath2",
            "dataType": "uint8",
            "dimensions": 512,
            "distanceFunction": "cosine"
          },
          {
            "path": "/vectorPath3",
            "dataType": "int8",
            "dimensions": 512,
            "distanceFunction": "dotproduct"
          }
        ]
      },
      "partitionKey": {
        "paths": [
          "/AccountNumber"
        ],
        "kind": "Hash"
      },
      "defaultTtl": 100,
      "uniqueKeyPolicy": {
        "uniqueKeys": [
          {
            "paths": [
              "/testPath"
            ]
          }
        ]
      },
      "conflictResolutionPolicy": {
        "mode": "LastWriterWins",
        "conflictResolutionPath": "/path"
      },
      "clientEncryptionPolicy": {
        "includedPaths": [
          {
            "path": "/path",
            "clientEncryptionKeyId": "keyId",
            "encryptionAlgorithm": "AEAD_AES_256_CBC_HMAC_SHA256",
            "encryptionType": "Deterministic"
          }
        ],
        "policyFormatVersion": 1
      },
      "computedProperties": [
        {
          "name": "cp_lowerName",
          "query": "SELECT VALUE LOWER(c.name) FROM c"
        }
      ],
      "_rid": "PD5DALigDgw=",
      "_ts": 1459200611,
      "_etag": "\"00005900-0000-0000-0000-56f9a2630000\""
    },
    "options": {
      "throughput": 400
    }
  }
}

Definitions

Name Description
AutoscaleSettings
ClientEncryptionIncludedPath

.

ClientEncryptionPolicy

Cosmos DB client encryption policy.

CompositePath
CompositePathSortOrder

Sort order for composite paths.

ComputedProperty

The definition of a computed property

ConflictResolutionMode

Indicates the conflict resolution mode.

ConflictResolutionPolicy

The conflict resolution policy for the container.

ContainerPartitionKey

The configuration of the partition key to be used for partitioning data into multiple partitions

CreateMode

Enum to indicate the mode of account creation.

DataType

The datatype for which the indexing behavior is applied to.

DistanceFunction

The distance function to use for distance calculation in between vectors.

ExcludedPath
IncludedPath

The paths that are included in indexing

Indexes

The indexes for the path.

IndexingMode

Indicates the indexing mode.

IndexingPolicy

Cosmos DB indexing policy

IndexKind

Indicates the type of index.

Options
PartitionKind

Indicates the kind of algorithm used for partitioning. For MultiHash, multiple partition keys (upto three maximum) are supported for container create

Resource
ResourceRestoreParameters

Parameters to indicate the information about the restore.

SpatialSpec
SpatialType

Indicates the spatial type of index.

SqlContainerGetResults

An Azure Cosmos DB container.

UniqueKey

The unique key on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service.

UniqueKeyPolicy

The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service.

VectorDataType

Indicates the data type of vector.

VectorEmbedding

Represents a vector embedding. A vector embedding is used to define a vector field in the documents.

VectorEmbeddingPolicy

Cosmos DB Vector Embedding Policy

VectorIndex
VectorIndexType

The index type of the vector. Currently, flat, diskANN, and quantizedFlat are supported.

AutoscaleSettings

Name Type Description
maxThroughput

integer

Represents maximum throughput, the resource can scale up to.

ClientEncryptionIncludedPath

.

Name Type Description
clientEncryptionKeyId

string

The identifier of the Client Encryption Key to be used to encrypt the path.

encryptionAlgorithm

string

The encryption algorithm which will be used. Eg - AEAD_AES_256_CBC_HMAC_SHA256.

encryptionType

string

The type of encryption to be performed. Eg - Deterministic, Randomized.

path

string

Path that needs to be encrypted.

ClientEncryptionPolicy

Cosmos DB client encryption policy.

Name Type Description
includedPaths

ClientEncryptionIncludedPath[]

Paths of the item that need encryption along with path-specific settings.

policyFormatVersion

integer (int32)

minimum: 1
maximum: 2

Version of the client encryption policy definition. Supported versions are 1 and 2. Version 2 supports id and partition key path encryption.

CompositePath

Name Type Description
order

CompositePathSortOrder

Sort order for composite paths.

path

string

The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*)

CompositePathSortOrder

Sort order for composite paths.

Value Description
ascending
descending

ComputedProperty

The definition of a computed property

Name Type Description
name

string

The name of a computed property, for example - "cp_lowerName"

query

string

The query that evaluates the value for computed property, for example - "SELECT VALUE LOWER(c.name) FROM c"

ConflictResolutionMode

Indicates the conflict resolution mode.

Value Description
Custom
LastWriterWins

ConflictResolutionPolicy

The conflict resolution policy for the container.

Name Type Default value Description
conflictResolutionPath

string

The conflict resolution path in the case of LastWriterWins mode.

conflictResolutionProcedure

string

The procedure to resolve conflicts in the case of custom mode.

mode

ConflictResolutionMode

LastWriterWins

Indicates the conflict resolution mode.

ContainerPartitionKey

The configuration of the partition key to be used for partitioning data into multiple partitions

Name Type Default value Description
kind

PartitionKind

Hash

Indicates the kind of algorithm used for partitioning. For MultiHash, multiple partition keys (upto three maximum) are supported for container create

paths

string[]

List of paths using which data within the container can be partitioned

systemKey

boolean

Indicates if the container is using a system generated partition key

version

integer (int32)

minimum: 1
maximum: 2

Indicates the version of the partition key definition

CreateMode

Enum to indicate the mode of account creation.

Value Description
Default
Restore

DataType

The datatype for which the indexing behavior is applied to.

Value Description
LineString
MultiPolygon
Number
Point
Polygon
String

DistanceFunction

The distance function to use for distance calculation in between vectors.

Value Description
cosine
dotproduct
euclidean

ExcludedPath

Name Type Description
path

string

The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*)

IncludedPath

The paths that are included in indexing

Name Type Description
indexes

Indexes[]

List of indexes for this path

path

string

The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*)

Indexes

The indexes for the path.

Name Type Default value Description
dataType

DataType

String

The datatype for which the indexing behavior is applied to.

kind

IndexKind

Hash

Indicates the type of index.

precision

integer

The precision of the index. -1 is maximum precision.

IndexingMode

Indicates the indexing mode.

Value Description
consistent
lazy
none

IndexingPolicy

Cosmos DB indexing policy

Name Type Default value Description
automatic

boolean

Indicates if the indexing policy is automatic

compositeIndexes

CompositePath[]

List of composite path list

excludedPaths

ExcludedPath[]

List of paths to exclude from indexing

includedPaths

IncludedPath[]

List of paths to include in the indexing

indexingMode

IndexingMode

consistent

Indicates the indexing mode.

spatialIndexes

SpatialSpec[]

List of spatial specifics

vectorIndexes

VectorIndex[]

List of paths to include in the vector indexing

IndexKind

Indicates the type of index.

Value Description
Hash
Range
Spatial

Options

Name Type Description
autoscaleSettings

AutoscaleSettings

Specifies the Autoscale settings.

throughput

integer

Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details.

PartitionKind

Indicates the kind of algorithm used for partitioning. For MultiHash, multiple partition keys (upto three maximum) are supported for container create

Value Description
Hash
MultiHash
Range

Resource

Name Type Default value 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.

analyticalStorageTtl

integer (int64)

Analytical TTL.

clientEncryptionPolicy

ClientEncryptionPolicy

The client encryption policy for the container.

computedProperties

ComputedProperty[]

List of computed properties

conflictResolutionPolicy

ConflictResolutionPolicy

The conflict resolution policy for the container.

createMode

CreateMode

Default

Enum to indicate the mode of resource creation.

defaultTtl

integer

Default time to live

id

string

Name of the Cosmos DB SQL container

indexingPolicy

IndexingPolicy

The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container

partitionKey

ContainerPartitionKey

The configuration of the partition key to be used for partitioning data into multiple partitions

restoreParameters

ResourceRestoreParameters

Parameters to indicate the information about the restore

uniqueKeyPolicy

UniqueKeyPolicy

The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service.

vectorEmbeddingPolicy

VectorEmbeddingPolicy

The vector embedding policy for the container.

ResourceRestoreParameters

Parameters to indicate the information about the restore.

Name Type Description
restoreSource

string

The id of the restorable database account from which the restore has to be initiated. For example: /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}

restoreTimestampInUtc

string (date-time)

Time to which the account has to be restored (ISO-8601 format).

restoreWithTtlDisabled

boolean

Specifies whether the restored account will have Time-To-Live disabled upon the successful restore.

SpatialSpec

Name Type Description
path

string

The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*)

types

SpatialType[]

List of path's spatial type

SpatialType

Indicates the spatial type of index.

Value Description
LineString
MultiPolygon
Point
Polygon

SqlContainerGetResults

An Azure Cosmos DB container.

Name Type Description
id

string

The unique resource identifier of the ARM resource.

location

string

The location of the resource group to which the resource belongs.

name

string

The name of the ARM resource.

properties.options

Options

properties.resource

Resource

tags

object

Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB".

type

string

The type of Azure resource.

UniqueKey

The unique key on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service.

Name Type Description
paths

string[]

List of paths must be unique for each document in the Azure Cosmos DB service

UniqueKeyPolicy

The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service.

Name Type Description
uniqueKeys

UniqueKey[]

List of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service.

VectorDataType

Indicates the data type of vector.

Value Description
float32
int8
uint8

VectorEmbedding

Represents a vector embedding. A vector embedding is used to define a vector field in the documents.

Name Type Description
dataType

VectorDataType

Indicates the data type of vector.

dimensions

integer (int32)

The number of dimensions in the vector.

distanceFunction

DistanceFunction

The distance function to use for distance calculation in between vectors.

path

string

The path to the vector field in the document.

VectorEmbeddingPolicy

Cosmos DB Vector Embedding Policy

Name Type Description
vectorEmbeddings

VectorEmbedding[]

List of vector embeddings

VectorIndex

Name Type Description
path

string

The path to the vector field in the document.

type

VectorIndexType

The index type of the vector. Currently, flat, diskANN, and quantizedFlat are supported.

VectorIndexType

The index type of the vector. Currently, flat, diskANN, and quantizedFlat are supported.

Value Description
diskANN
flat
quantizedFlat