- 最新
- 2025-11-01-預覽
- 2025-10-15
- 2025-05-01-預覽版
- 2025-04-15
- 2024-12-01-預覽版
- 2024-11-15
- 2024-09-01-預覽版
- 2024-08-15
- 2024-05-15
- 2024-05-15-預覽版
- 2024-02-15-預覽版
- 2023-11-15
- 2023-11-15-預覽版
- 2023-09-15
- 2023-09-15-預覽版
- 2023-04-15
- 2023-03-15
- 2023-03-15-預覽版
- 2023-03-01-預覽版
- 2022-11-15
- 2022-11-15-預覽版
- 2022-08-15
- 2022-08-15-預覽版
- 2022-05-15
- 2022-05-15-預覽版
- 2022-02-15-預覽版
- 2021-11-15-預覽版
- 2021-10-15
- 2021-10-15-預覽版
- 2021-07-01-預覽版
- 2021-06-15
- 2021-05-15
- 2021-04-15
- 2021-04-01-預覽版
- 2021-03-15
- 2021-03-01-預覽版
- 2021-01-15
- 2020-09-01
- 2020-06-01-預覽版
- 2020-04-01
- 2020-03-01
- 2019-12-12
- 2019-08-01
Bicep 資源定義
databaseAccounts/sqlDatabases/containers 資源類型可以使用目標作業來部署:
如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。
資源格式
若要建立 Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers 資源,請將下列 Bicep 新增至範本。
resource symbolicname 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers@2020-04-01' = {
parent: resourceSymbolicName
location: 'string'
name: 'string'
properties: {
options: {
autoscaleSettings: {
maxThroughput: int
}
throughput: int
}
resource: {
analyticalStorageTtl: int
conflictResolutionPolicy: {
conflictResolutionPath: 'string'
conflictResolutionProcedure: 'string'
mode: 'string'
}
defaultTtl: int
id: 'string'
indexingPolicy: {
automatic: bool
compositeIndexes: [
[
{
order: 'string'
path: 'string'
}
]
]
excludedPaths: [
{
path: 'string'
}
]
includedPaths: [
{
indexes: [
{
dataType: 'string'
kind: 'string'
precision: int
}
]
path: 'string'
}
]
indexingMode: 'string'
spatialIndexes: [
{
path: 'string'
types: [
'string'
]
}
]
}
partitionKey: {
kind: 'string'
paths: [
'string'
]
version: int
}
uniqueKeyPolicy: {
uniqueKeys: [
{
paths: [
'string'
]
}
]
}
}
}
tags: {
{customized property}: 'string'
}
}
屬性值
Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers
| 名字 | 描述 | 價值 |
|---|---|---|
| 位置 | 資源所屬資源群組的位置。 | 字串 |
| 名字 | 資源名稱 | 字串 (必要) |
| 父代 | 在 Bicep 中,您可以指定子資源的父資源。 只有在父資源外部宣告子資源時,才需要新增這個屬性。 如需詳細資訊,請參閱 父資源外部的子資源。 |
類型資源的符號名稱:databaseAccounts/sqlDatabases |
| 性能 | 用來建立及更新 Azure Cosmos DB 容器的屬性。 | SqlContainerCreateUpdatePropertiesOrSqlContainerGetProperties (必要) |
| 標籤 | 資源標籤 | 標記名稱和值的字典。 請參閱範本中的 標籤 |
AutoscaleSettings
| 名字 | 描述 | 價值 |
|---|---|---|
| maxThroughput (最大輸送量) | 代表最大輸送量,資源可以相應增加至 。 | 整數 (int) |
複合路徑
| 名字 | 描述 | 價值 |
|---|---|---|
| 順序 | 複合路徑的排序順序。 | “上升” “下降” |
| 路徑 | 索引行為套用的路徑。 索引路徑通常以根開頭,並以通配符結尾 (/path/*) | 字串 |
ConflictResolutionPolicy (衝突解決策略)
| 名字 | 描述 | 價值 |
|---|---|---|
| conflictResolutionPath 衝突解決路徑 | LastWriterWins 模式的衝突解決路徑。 | 字串 |
| conflictResolutionProcedure | 解決自定義模式衝突的程式。 | 字串 |
| 模式 | 表示衝突解決模式。 | “自定義” 'LastWriterWins' |
ContainerPartitionKey
| 名字 | 描述 | 價值 |
|---|---|---|
| 類 | 指出用於數據分割的演算法類型 | '哈希' '範圍' |
| 路徑 | 使用容器內可分割數據的路徑清單 | 字串[] |
| 版本 | 指出分割區索引鍵定義的版本 | int 約束: 最小值 = 1 最大值 = 2 |
CreateUpdateOptionsOrSqlContainerGetPropertiesOptions
| 名字 | 描述 | 價值 |
|---|---|---|
| autoscaleSettings | 指定自動調整設定。 | AutoscaleSettings |
| 輸送量 | 每秒要求單位數。 例如,「輸送量」:10000。 | 整數 (int) |
排除路徑
| 名字 | 描述 | 價值 |
|---|---|---|
| 路徑 | 索引行為套用的路徑。 索引路徑通常以根開頭,並以通配符結尾 (/path/*) | 字串 |
包含路徑
| 名字 | 描述 | 價值 |
|---|---|---|
| 指標 | 此路徑的索引清單 | 索引[] |
| 路徑 | 索引行為套用的路徑。 索引路徑通常以根開頭,並以通配符結尾 (/path/*) | 字串 |
指標
| 名字 | 描述 | 價值 |
|---|---|---|
| 數據類型 | 套用索引行為的數據類型。 | 'LineString' 'MultiPolygon' (多多邊形) '數位' “點” '多邊形' '字串' |
| 類 | 表示索引的類型。 | '哈希' '範圍' “空間” |
| 精確度 | 索引的有效位數。 -1 是最大精確度。 | 整數 (int) |
索引政策
| 名字 | 描述 | 價值 |
|---|---|---|
| 自動 | 指出索引編製原則是否為自動 | 布爾 (bool) |
| 複合索引 | 複合路徑清單清單 | CompositePath[][] |
| excludedPaths | 要從索引編製中排除的路徑清單 | ExcludedPath[] |
| includedPaths | 要包含在索引中的路徑清單 | IncludedPath[] |
| indexingMode | 表示索引模式。 | '一致' '懶惰' “無” |
| 空間索引 | 空間特定項目清單 | 空間規格 |
空間規格
| 名字 | 描述 | 價值 |
|---|---|---|
| 路徑 | 索引行為套用的路徑。 索引路徑通常以根開頭,並以通配符結尾 (/path/*) | 字串 |
| 類型 | 路徑的空間類型清單 | 包含任何的字串數組: 'LineString' 'MultiPolygon' (多多邊形) “點” '多邊形' |
SqlContainerCreateUpdatePropertiesOrSqlContainerGetProperties
| 名字 | 描述 | 價值 |
|---|---|---|
| 選項 | 要套用要求之選項的索引鍵/值組。 這會對應至隨要求傳送的標頭。 | CreateUpdateOptionsOrSqlContainerGetPropertiesOptions (必要) |
| 資源 | 容器的標準 JSON 格式 | SqlContainerResourceOrSqlContainerGetPropertiesResource (必要) |
SqlContainerResourceOrSqlContainerGetPropertiesResource
| 名字 | 描述 | 價值 |
|---|---|---|
| 分析StorageTtl | 分析TTL。 | 整數 (int) |
| conflictResolutionPolicy (衝突解決策略) | 容器的衝突解決原則。 | ConflictResolutionPolicy (衝突解決策略) |
| defaultTtl | 默認存留時間 | 整數 (int) |
| 識別碼 | Cosmos DB SQL 容器的名稱 | 字串 (必要) |
| indexingPolicy (索引策略) | 編製索引原則的組態。 根據預設,容器內所有文件路徑的索引會自動編製索引 | 索引策略 |
| partitionKey | 分割區索引鍵的組態,用於將數據分割成多個分割區 | ContainerPartitionKey |
| uniqueKeyPolicy 的 | 針對 Azure Cosmos DB 服務集合中檔指定唯一性條件約束的唯一索引鍵原則組態。 | UniqueKeyPolicy (唯一金鑰策略) |
標籤
| 名字 | 描述 | 價值 |
|---|
唯一鍵
| 名字 | 描述 | 價值 |
|---|---|---|
| 路徑 | Azure Cosmos DB 服務中每個文件的路徑清單必須是唯一的 | 字串[] |
UniqueKeyPolicy (唯一金鑰策略)
| 名字 | 描述 | 價值 |
|---|---|---|
| uniqueKeys 的 | 上唯一索引鍵的清單,該索引鍵會對 Azure Cosmos DB 服務集合中的文件強制執行唯一性條件約束。 | UniqueKey[] |
使用範例
Azure 快速入門範例
下列 Azure 快速入門範本 包含用於部署此資源類型的 Bicep 範例。
| Bicep 檔案 | 描述 |
|---|---|
| 使用分析存放區 Azure Cosmos DB 帳戶 SQL API | 此範本會建立適用於 Core (SQL) API 的 Azure Cosmos 帳戶,其中包含使用分析存放區設定的資料庫和容器。 |
| 建立免費層 Azure Cosmos DB 帳戶 | 此範本會使用具有共用輸送量和容器的資料庫,為 SQL API 建立免費層 Azure Cosmos DB 帳戶。 |
| 建立適用於 Core (SQL) API 的 Azure Cosmos DB 帳戶 | 此範本會使用具有多個其他選項的資料庫和容器,建立適用於 Core (SQL) API 的 Azure Cosmos 帳戶。 |
| 使用自動調整 建立 Azure Cosmos DB 帳戶 SQL API | 此範本會建立適用於 Core (SQL) API 的 Azure Cosmos 帳戶,其中包含具有多個其他選項之自動調整輸送量的資料庫和容器。 |
| 建立 Azure Cosmos DB Core (SQL) API 預存程式 | 此範本會建立適用於 Core (SQL) API 的 Azure Cosmos DB 帳戶,以及具有預存程式、觸發程式和使用者定義函式的容器。 |
| 使用 Container Apps 建立 Dapr 微服務應用程式 | 使用 Container Apps 建立 Dapr 微服務應用程式。 |
| 使用 Container Apps 建立 Dapr pub-sub servicebus 應用程式 | 使用 Container Apps 建立 Dapr pub-sub servicebus 應用程式。 |
| 使用 Cosmos DB 連線部署 Azure 數據總管 DB | 使用 Cosmos DB 連線部署 Azure 數據總管 DB。 |
ARM 樣本資源定義
databaseAccounts/sqlDatabases/containers 資源類型可以使用目標作業來部署:
如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。
資源格式
若要建立 Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers 資源,請將下列 JSON 新增至範本。
{
"type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers",
"apiVersion": "2020-04-01",
"name": "string",
"location": "string",
"properties": {
"options": {
"autoscaleSettings": {
"maxThroughput": "int"
},
"throughput": "int"
},
"resource": {
"analyticalStorageTtl": "int",
"conflictResolutionPolicy": {
"conflictResolutionPath": "string",
"conflictResolutionProcedure": "string",
"mode": "string"
},
"defaultTtl": "int",
"id": "string",
"indexingPolicy": {
"automatic": "bool",
"compositeIndexes": [
[
{
"order": "string",
"path": "string"
}
]
],
"excludedPaths": [
{
"path": "string"
}
],
"includedPaths": [
{
"indexes": [
{
"dataType": "string",
"kind": "string",
"precision": "int"
}
],
"path": "string"
}
],
"indexingMode": "string",
"spatialIndexes": [
{
"path": "string",
"types": [ "string" ]
}
]
},
"partitionKey": {
"kind": "string",
"paths": [ "string" ],
"version": "int"
},
"uniqueKeyPolicy": {
"uniqueKeys": [
{
"paths": [ "string" ]
}
]
}
}
},
"tags": {
"{customized property}": "string"
}
}
屬性值
Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers
| 名字 | 描述 | 價值 |
|---|---|---|
| apiVersion | API 版本 | '2020-04-01' |
| 位置 | 資源所屬資源群組的位置。 | 字串 |
| 名字 | 資源名稱 | 字串 (必要) |
| 性能 | 用來建立及更新 Azure Cosmos DB 容器的屬性。 | SqlContainerCreateUpdatePropertiesOrSqlContainerGetProperties (必要) |
| 標籤 | 資源標籤 | 標記名稱和值的字典。 請參閱範本中的 標籤 |
| 型別 | 資源類型 | “Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers” |
AutoscaleSettings
| 名字 | 描述 | 價值 |
|---|---|---|
| maxThroughput (最大輸送量) | 代表最大輸送量,資源可以相應增加至 。 | 整數 (int) |
複合路徑
| 名字 | 描述 | 價值 |
|---|---|---|
| 順序 | 複合路徑的排序順序。 | “上升” “下降” |
| 路徑 | 索引行為套用的路徑。 索引路徑通常以根開頭,並以通配符結尾 (/path/*) | 字串 |
ConflictResolutionPolicy (衝突解決策略)
| 名字 | 描述 | 價值 |
|---|---|---|
| conflictResolutionPath 衝突解決路徑 | LastWriterWins 模式的衝突解決路徑。 | 字串 |
| conflictResolutionProcedure | 解決自定義模式衝突的程式。 | 字串 |
| 模式 | 表示衝突解決模式。 | “自定義” 'LastWriterWins' |
ContainerPartitionKey
| 名字 | 描述 | 價值 |
|---|---|---|
| 類 | 指出用於數據分割的演算法類型 | '哈希' '範圍' |
| 路徑 | 使用容器內可分割數據的路徑清單 | 字串[] |
| 版本 | 指出分割區索引鍵定義的版本 | int 約束: 最小值 = 1 最大值 = 2 |
CreateUpdateOptionsOrSqlContainerGetPropertiesOptions
| 名字 | 描述 | 價值 |
|---|---|---|
| autoscaleSettings | 指定自動調整設定。 | AutoscaleSettings |
| 輸送量 | 每秒要求單位數。 例如,「輸送量」:10000。 | 整數 (int) |
排除路徑
| 名字 | 描述 | 價值 |
|---|---|---|
| 路徑 | 索引行為套用的路徑。 索引路徑通常以根開頭,並以通配符結尾 (/path/*) | 字串 |
包含路徑
| 名字 | 描述 | 價值 |
|---|---|---|
| 指標 | 此路徑的索引清單 | 索引[] |
| 路徑 | 索引行為套用的路徑。 索引路徑通常以根開頭,並以通配符結尾 (/path/*) | 字串 |
指標
| 名字 | 描述 | 價值 |
|---|---|---|
| 數據類型 | 套用索引行為的數據類型。 | 'LineString' 'MultiPolygon' (多多邊形) '數位' “點” '多邊形' '字串' |
| 類 | 表示索引的類型。 | '哈希' '範圍' “空間” |
| 精確度 | 索引的有效位數。 -1 是最大精確度。 | 整數 (int) |
索引政策
| 名字 | 描述 | 價值 |
|---|---|---|
| 自動 | 指出索引編製原則是否為自動 | 布爾 (bool) |
| 複合索引 | 複合路徑清單清單 | CompositePath[][] |
| excludedPaths | 要從索引編製中排除的路徑清單 | ExcludedPath[] |
| includedPaths | 要包含在索引中的路徑清單 | IncludedPath[] |
| indexingMode | 表示索引模式。 | '一致' '懶惰' “無” |
| 空間索引 | 空間特定項目清單 | 空間規格 |
空間規格
| 名字 | 描述 | 價值 |
|---|---|---|
| 路徑 | 索引行為套用的路徑。 索引路徑通常以根開頭,並以通配符結尾 (/path/*) | 字串 |
| 類型 | 路徑的空間類型清單 | 包含任何的字串數組: 'LineString' 'MultiPolygon' (多多邊形) “點” '多邊形' |
SqlContainerCreateUpdatePropertiesOrSqlContainerGetProperties
| 名字 | 描述 | 價值 |
|---|---|---|
| 選項 | 要套用要求之選項的索引鍵/值組。 這會對應至隨要求傳送的標頭。 | CreateUpdateOptionsOrSqlContainerGetPropertiesOptions (必要) |
| 資源 | 容器的標準 JSON 格式 | SqlContainerResourceOrSqlContainerGetPropertiesResource (必要) |
SqlContainerResourceOrSqlContainerGetPropertiesResource
| 名字 | 描述 | 價值 |
|---|---|---|
| 分析StorageTtl | 分析TTL。 | 整數 (int) |
| conflictResolutionPolicy (衝突解決策略) | 容器的衝突解決原則。 | ConflictResolutionPolicy (衝突解決策略) |
| defaultTtl | 默認存留時間 | 整數 (int) |
| 識別碼 | Cosmos DB SQL 容器的名稱 | 字串 (必要) |
| indexingPolicy (索引策略) | 編製索引原則的組態。 根據預設,容器內所有文件路徑的索引會自動編製索引 | 索引策略 |
| partitionKey | 分割區索引鍵的組態,用於將數據分割成多個分割區 | ContainerPartitionKey |
| uniqueKeyPolicy 的 | 針對 Azure Cosmos DB 服務集合中檔指定唯一性條件約束的唯一索引鍵原則組態。 | UniqueKeyPolicy (唯一金鑰策略) |
標籤
| 名字 | 描述 | 價值 |
|---|
唯一鍵
| 名字 | 描述 | 價值 |
|---|---|---|
| 路徑 | Azure Cosmos DB 服務中每個文件的路徑清單必須是唯一的 | 字串[] |
UniqueKeyPolicy (唯一金鑰策略)
| 名字 | 描述 | 價值 |
|---|---|---|
| uniqueKeys 的 | 上唯一索引鍵的清單,該索引鍵會對 Azure Cosmos DB 服務集合中的文件強制執行唯一性條件約束。 | UniqueKey[] |
使用範例
Azure 快速入門範本
下列 Azure 快速入門範本 部署此資源類型。
| 範本 | 描述 |
|---|---|
| 使用分析存放區 Azure Cosmos DB 帳戶 SQL API |
此範本會建立適用於 Core (SQL) API 的 Azure Cosmos 帳戶,其中包含使用分析存放區設定的資料庫和容器。 |
|
建立免費層 Azure Cosmos DB 帳戶 |
此範本會使用具有共用輸送量和容器的資料庫,為 SQL API 建立免費層 Azure Cosmos DB 帳戶。 |
|
建立適用於 Core (SQL) API 的 Azure Cosmos DB 帳戶 |
此範本會使用具有多個其他選項的資料庫和容器,建立適用於 Core (SQL) API 的 Azure Cosmos 帳戶。 |
|
使用自動調整 建立 Azure Cosmos DB 帳戶 SQL API |
此範本會建立適用於 Core (SQL) API 的 Azure Cosmos 帳戶,其中包含具有多個其他選項之自動調整輸送量的資料庫和容器。 |
|
建立 Azure Cosmos DB Core (SQL) API 預存程式 |
此範本會建立適用於 Core (SQL) API 的 Azure Cosmos DB 帳戶,以及具有預存程式、觸發程式和使用者定義函式的容器。 |
|
使用 Container Apps 建立 Dapr 微服務應用程式 |
使用 Container Apps 建立 Dapr 微服務應用程式。 |
|
使用 Container Apps 建立 Dapr pub-sub servicebus 應用程式 |
使用 Container Apps 建立 Dapr pub-sub servicebus 應用程式。 |
|
使用 Cosmos DB 連線部署 Azure 數據總管 DB |
使用 Cosmos DB 連線部署 Azure 數據總管 DB。 |
Terraform (AzAPI 提供者) 資源定義
databaseAccounts/sqlDatabases/containers 資源類型可以使用目標作業來部署:
如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。
資源格式
若要建立 Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers 資源,請將下列 Terraform 新增至範本。
resource "azapi_resource" "symbolicname" {
type = "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers@2020-04-01"
name = "string"
parent_id = "string"
location = "string"
tags = {
{customized property} = "string"
}
body = {
properties = {
options = {
autoscaleSettings = {
maxThroughput = int
}
throughput = int
}
resource = {
analyticalStorageTtl = int
conflictResolutionPolicy = {
conflictResolutionPath = "string"
conflictResolutionProcedure = "string"
mode = "string"
}
defaultTtl = int
id = "string"
indexingPolicy = {
automatic = bool
compositeIndexes = [
[
{
order = "string"
path = "string"
}
]
]
excludedPaths = [
{
path = "string"
}
]
includedPaths = [
{
indexes = [
{
dataType = "string"
kind = "string"
precision = int
}
]
path = "string"
}
]
indexingMode = "string"
spatialIndexes = [
{
path = "string"
types = [
"string"
]
}
]
}
partitionKey = {
kind = "string"
paths = [
"string"
]
version = int
}
uniqueKeyPolicy = {
uniqueKeys = [
{
paths = [
"string"
]
}
]
}
}
}
}
}
屬性值
Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers
| 名字 | 描述 | 價值 |
|---|---|---|
| 位置 | 資源所屬資源群組的位置。 | 字串 |
| 名字 | 資源名稱 | 字串 (必要) |
| 父項識別碼 | 此資源為父系之資源的標識碼。 | 類型資源的標識碼:databaseAccounts/sqlDatabases |
| 性能 | 用來建立及更新 Azure Cosmos DB 容器的屬性。 | SqlContainerCreateUpdatePropertiesOrSqlContainerGetProperties (必要) |
| 標籤 | 資源標籤 | 標記名稱和值的字典。 |
| 型別 | 資源類型 | “Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers@2020-04-01” |
AutoscaleSettings
| 名字 | 描述 | 價值 |
|---|---|---|
| maxThroughput (最大輸送量) | 代表最大輸送量,資源可以相應增加至 。 | 整數 (int) |
複合路徑
| 名字 | 描述 | 價值 |
|---|---|---|
| 順序 | 複合路徑的排序順序。 | “上升” “下降” |
| 路徑 | 索引行為套用的路徑。 索引路徑通常以根開頭,並以通配符結尾 (/path/*) | 字串 |
ConflictResolutionPolicy (衝突解決策略)
| 名字 | 描述 | 價值 |
|---|---|---|
| conflictResolutionPath 衝突解決路徑 | LastWriterWins 模式的衝突解決路徑。 | 字串 |
| conflictResolutionProcedure | 解決自定義模式衝突的程式。 | 字串 |
| 模式 | 表示衝突解決模式。 | “自定義” 'LastWriterWins' |
ContainerPartitionKey
| 名字 | 描述 | 價值 |
|---|---|---|
| 類 | 指出用於數據分割的演算法類型 | '哈希' '範圍' |
| 路徑 | 使用容器內可分割數據的路徑清單 | 字串[] |
| 版本 | 指出分割區索引鍵定義的版本 | int 約束: 最小值 = 1 最大值 = 2 |
CreateUpdateOptionsOrSqlContainerGetPropertiesOptions
| 名字 | 描述 | 價值 |
|---|---|---|
| autoscaleSettings | 指定自動調整設定。 | AutoscaleSettings |
| 輸送量 | 每秒要求單位數。 例如,「輸送量」:10000。 | 整數 (int) |
排除路徑
| 名字 | 描述 | 價值 |
|---|---|---|
| 路徑 | 索引行為套用的路徑。 索引路徑通常以根開頭,並以通配符結尾 (/path/*) | 字串 |
包含路徑
| 名字 | 描述 | 價值 |
|---|---|---|
| 指標 | 此路徑的索引清單 | 索引[] |
| 路徑 | 索引行為套用的路徑。 索引路徑通常以根開頭,並以通配符結尾 (/path/*) | 字串 |
指標
| 名字 | 描述 | 價值 |
|---|---|---|
| 數據類型 | 套用索引行為的數據類型。 | 'LineString' 'MultiPolygon' (多多邊形) '數位' “點” '多邊形' '字串' |
| 類 | 表示索引的類型。 | '哈希' '範圍' “空間” |
| 精確度 | 索引的有效位數。 -1 是最大精確度。 | 整數 (int) |
索引政策
| 名字 | 描述 | 價值 |
|---|---|---|
| 自動 | 指出索引編製原則是否為自動 | 布爾 (bool) |
| 複合索引 | 複合路徑清單清單 | CompositePath[][] |
| excludedPaths | 要從索引編製中排除的路徑清單 | ExcludedPath[] |
| includedPaths | 要包含在索引中的路徑清單 | IncludedPath[] |
| indexingMode | 表示索引模式。 | '一致' '懶惰' “無” |
| 空間索引 | 空間特定項目清單 | 空間規格 |
空間規格
| 名字 | 描述 | 價值 |
|---|---|---|
| 路徑 | 索引行為套用的路徑。 索引路徑通常以根開頭,並以通配符結尾 (/path/*) | 字串 |
| 類型 | 路徑的空間類型清單 | 包含任何的字串數組: 'LineString' 'MultiPolygon' (多多邊形) “點” '多邊形' |
SqlContainerCreateUpdatePropertiesOrSqlContainerGetProperties
| 名字 | 描述 | 價值 |
|---|---|---|
| 選項 | 要套用要求之選項的索引鍵/值組。 這會對應至隨要求傳送的標頭。 | CreateUpdateOptionsOrSqlContainerGetPropertiesOptions (必要) |
| 資源 | 容器的標準 JSON 格式 | SqlContainerResourceOrSqlContainerGetPropertiesResource (必要) |
SqlContainerResourceOrSqlContainerGetPropertiesResource
| 名字 | 描述 | 價值 |
|---|---|---|
| 分析StorageTtl | 分析TTL。 | 整數 (int) |
| conflictResolutionPolicy (衝突解決策略) | 容器的衝突解決原則。 | ConflictResolutionPolicy (衝突解決策略) |
| defaultTtl | 默認存留時間 | 整數 (int) |
| 識別碼 | Cosmos DB SQL 容器的名稱 | 字串 (必要) |
| indexingPolicy (索引策略) | 編製索引原則的組態。 根據預設,容器內所有文件路徑的索引會自動編製索引 | 索引策略 |
| partitionKey | 分割區索引鍵的組態,用於將數據分割成多個分割區 | ContainerPartitionKey |
| uniqueKeyPolicy 的 | 針對 Azure Cosmos DB 服務集合中檔指定唯一性條件約束的唯一索引鍵原則組態。 | UniqueKeyPolicy (唯一金鑰策略) |
標籤
| 名字 | 描述 | 價值 |
|---|
唯一鍵
| 名字 | 描述 | 價值 |
|---|---|---|
| 路徑 | Azure Cosmos DB 服務中每個文件的路徑清單必須是唯一的 | 字串[] |
UniqueKeyPolicy (唯一金鑰策略)
| 名字 | 描述 | 價值 |
|---|---|---|
| uniqueKeys 的 | 上唯一索引鍵的清單,該索引鍵會對 Azure Cosmos DB 服務集合中的文件強制執行唯一性條件約束。 | UniqueKey[] |
使用範例
Terraform 範例
在 Cosmos DB 帳戶內部署 SQL 容器的基本範例。
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
}
}
provider "azapi" {
skip_provider_registration = false
}
variable "resource_name" {
type = string
default = "acctest0001"
}
variable "location" {
type = string
default = "westeurope"
}
resource "azapi_resource" "resourceGroup" {
type = "Microsoft.Resources/resourceGroups@2020-06-01"
name = var.resource_name
location = var.location
}
resource "azapi_resource" "databaseAccount" {
type = "Microsoft.DocumentDB/databaseAccounts@2021-10-15"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = var.location
body = {
kind = "GlobalDocumentDB"
properties = {
capabilities = [
]
consistencyPolicy = {
defaultConsistencyLevel = "BoundedStaleness"
maxIntervalInSeconds = 10
maxStalenessPrefix = 200
}
databaseAccountOfferType = "Standard"
defaultIdentity = "FirstPartyIdentity"
disableKeyBasedMetadataWriteAccess = false
disableLocalAuth = false
enableAnalyticalStorage = false
enableAutomaticFailover = false
enableFreeTier = false
enableMultipleWriteLocations = false
ipRules = [
]
isVirtualNetworkFilterEnabled = false
locations = [
{
failoverPriority = 0
isZoneRedundant = false
locationName = "West Europe"
},
]
networkAclBypass = "None"
networkAclBypassResourceIds = [
]
publicNetworkAccess = "Enabled"
virtualNetworkRules = [
]
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "sqlDatabase" {
type = "Microsoft.DocumentDB/databaseAccounts/sqlDatabases@2021-10-15"
parent_id = azapi_resource.databaseAccount.id
name = var.resource_name
body = {
properties = {
options = {
throughput = 400
}
resource = {
id = var.resource_name
}
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "container" {
type = "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers@2023-04-15"
parent_id = azapi_resource.sqlDatabase.id
name = var.resource_name
body = {
properties = {
options = {
}
resource = {
id = "test-containerWest Europe"
partitionKey = {
kind = "Hash"
paths = [
"/definition",
]
}
}
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}