你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。

Microsoft.DocumentDB 数据库帐户/gremlin数据库/图形 2025-11-01-preview

Bicep 资源定义

可以使用目标操作部署 databaseAccounts/gremlinDatabases/graphs 资源类型:

有关每个 API 版本中已更改属性的列表,请参阅 更改日志。

用法示例

Bicep 示例

在 Cosmos DB 帐户中部署 Gremlin Graph 的基本示例。

param resourceName string = 'acctest0001'
param location string = 'westeurope'

resource databaseAccount 'Microsoft.DocumentDB/databaseAccounts@2021-10-15' = {
  name: resourceName
  location: location
  kind: 'GlobalDocumentDB'
  properties: {
    capabilities: [
      {
        name: 'EnableGremlin'
      }
    ]
    consistencyPolicy: {
      defaultConsistencyLevel: 'Strong'
      maxIntervalInSeconds: 5
      maxStalenessPrefix: 100
    }
    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: []
  }
}

resource gremlinDatabase 'Microsoft.DocumentDB/databaseAccounts/gremlinDatabases@2023-04-15' = {
  name: resourceName
  parent: databaseAccount
  properties: {
    options: {}
    resource: {
      id: resourceName
    }
  }
}

resource graph 'Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs@2023-04-15' = {
  name: resourceName
  parent: gremlinDatabase
  properties: {
    options: {
      throughput: 400
    }
    resource: {
      id: resourceName
      partitionKey: {
        kind: 'Hash'
        paths: [
          '/test'
        ]
      }
    }
  }
}

Azure 快速入门示例

以下 Azure 快速入门模板 包含用于部署此资源类型的 Bicep 示例。

Bicep 文件 Description
为 Gremlin API 创建 Azure Cosmos DB 帐户 此模板使用专用吞吐量在两个区域中为 Gremlin API 创建 Azure Cosmos DB 帐户,其中包含一个数据库和一个图形。
为 Gremlin API 自动缩放 创建 Azure Cosmos DB 帐户 此模板使用自动缩放吞吐量在两个区域中为 Gremlin API 创建 Azure Cosmos DB 帐户,其中包含一个数据库和一个图形。

资源格式

若要创建 Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs 资源,请将以下 Bicep 添加到模板。

resource symbolicname 'Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs@2025-11-01-preview' = {
  parent: resourceSymbolicName
  identity: {
    type: 'string'
    userAssignedIdentities: {
      {customized property}: {}
    }
  }
  location: 'string'
  name: 'string'
  properties: {
    options: {
      autoscaleSettings: {
        maxThroughput: int
      }
      throughput: int
    }
    resource: {
      analyticalStorageTtl: int
      conflictResolutionPolicy: {
        conflictResolutionPath: 'string'
        conflictResolutionProcedure: 'string'
        mode: 'string'
      }
      createMode: 'string'
      defaultTtl: int
      id: 'string'
      indexingPolicy: {
        automatic: bool
        compositeIndexes: [
          [
            {
              order: 'string'
              path: 'string'
            }
          ]
        ]
        excludedPaths: [
          {
            path: 'string'
          }
        ]
        fullTextIndexes: [
          {
            path: 'string'
          }
        ]
        includedPaths: [
          {
            indexes: [
              {
                dataType: 'string'
                kind: 'string'
                precision: int
              }
            ]
            path: 'string'
          }
        ]
        indexingMode: 'string'
        spatialIndexes: [
          {
            path: 'string'
            types: [
              'string'
            ]
          }
        ]
        vectorIndexes: [
          {
            indexingSearchListSize: int
            path: 'string'
            quantizationByteSize: int
            type: 'string'
            vectorIndexShardKey: [
              'string'
            ]
          }
        ]
      }
      partitionKey: {
        kind: 'string'
        paths: [
          'string'
        ]
        version: int
      }
      restoreParameters: {
        restoreSource: 'string'
        restoreTimestampInUtc: 'string'
        restoreWithTtlDisabled: bool
      }
      uniqueKeyPolicy: {
        uniqueKeys: [
          {
            paths: [
              'string'
            ]
          }
        ]
      }
    }
  }
  tags: {
    {customized property}: 'string'
  }
}

属性值

Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs

Name Description 价值
标识 资源的标识。 ManagedServiceIdentity
位置 资源所属的资源组的位置。 字符串
姓名 资源名称 string (必需)
父级 在 Bicep 中,可以为子资源指定父资源。 仅当子资源在父资源外部声明时,才需要添加此属性。

有关详细信息,请参阅 父资源外部的子资源。
类型资源的符号名称:databaseAccounts/gremlinDatabases
属性 用于创建和更新 Azure Cosmos DB Gremlin 图形的属性。 GremlinGraphCreateUpdatePropertiesOrGremlinGraphGetProperties (必需)
tags 资源标记 标记名称和值的字典。 请参阅模板 中的 标记

ARMResourceProperties标签

Name Description 价值

AutoscaleSettings

Name Description 价值
maxThroughput (最大吞吐量) 表示最大吞吐量,资源可以纵向扩展。 int

复合路径

Name Description 价值
顺序 复合路径的排序顺序。 “ascending”
“descending”
路径 索引行为应用于的路径。 索引路径通常以根开头,以通配符结尾(/path/*) 字符串

ConflictResolutionPolicy (冲突解决策略)

Name Description 价值
conflictResolutionPath 冲突解决路径 LastWriterWins 模式下的冲突解决路径。 字符串
conflictResolutionProcedure 解决自定义模式冲突的过程。 字符串
mode 指示冲突解决模式。 'Custom'
“LastWriterWins”

ContainerPartitionKey

Name Description 价值
kind 指示用于分区的算法类型。 对于 MultiHash,容器创建支持多个分区键(最多三个最大值) “Hash”
“MultiHash”
“Range”
路径 使用容器中的数据可以分区的路径列表 字符串[]
版本 指示分区键定义的版本 int

Constraints:
最小值 = 1
最大值 = 2

CreateUpdateOptionsOrGremlinGraphGetPropertiesOptions

Name Description 价值
autoscaleSettings 指定自动缩放设置。 注意:需要吞吐量或自动缩放设置,但不需要两者。 AutoscaleSettings
吞吐量 每秒请求单位数。 例如,“throughput”:10000。 int

排除路径

Name Description 价值
路径 索引行为应用于的路径。 索引路径通常以根开头,以通配符结尾(/path/*) 字符串

全文索引路径

Name Description 价值
路径 文档中全文字段的路径。 string (必需)

GremlinGraphCreateUpdatePropertiesOrGremlinGraphGetProperties

Name Description 价值
options 要为请求应用的选项的键值对。 这对应于随请求一起发送的标头。 CreateUpdateOptionsOrGremlinGraphGetPropertiesOptions
资源 Gremlin 图形的标准 JSON 格式 GremlinGraphResourceOrGremlinGraphGetPropertiesResource(必需)

GremlinGraphResourceOrGremlinGraphGetPropertiesResource

Name Description 价值
分析StorageTtl 分析 TTL。 int
conflictResolutionPolicy (冲突解决策略) 图形的冲突解决策略。 ConflictResolutionPolicy (冲突解决策略)
createMode 用于指示资源创建模式的枚举。 'Default'
“还原”
defaultTtl 默认生存时间 int
id Cosmos DB Gremlin 图形的名称 string (必需)
indexingPolicy (索引策略) 索引策略的配置。 默认情况下,图形中所有文档路径的索引都是自动的 索引策略
partitionKey 要用于将数据分区到多个分区的分区键的配置 ContainerPartitionKey
restoreParameters 指示有关还原的信息的参数 资源恢复参数
uniqueKeyPolicy 的 用于在 Azure Cosmos DB 服务中的集合中指定文档的唯一性约束的唯一键策略配置。 UniqueKeyPolicy (唯一密钥策略)

IncludedPath

Name Description 价值
指标 此路径的索引列表 索引[]
路径 索引行为应用于的路径。 索引路径通常以根开头,以通配符结尾(/path/*) 字符串

Indexes

Name Description 价值
数据类型 为其应用索引行为的数据类型。 “LineString”
“MultiPolygon”
“Number”
“Point”
“Polygon”
'String'
kind 指示索引的类型。 “Hash”
“Range”
“Spatial”
精准率 索引的精度。 -1 是最大精度。 int

索引策略

Name Description 价值
自动 指示索引策略是否自动 布尔
复合索引 复合路径列表列表 CompositePath[][]
excludedPaths 要从索引中排除的路径列表 ExcludedPath[]
全文索引 要包含在全文索引中的路径列表 全文索引路径[]
includedPaths 要包含在索引中的路径列表 IncludedPath[]
indexingMode 指示索引模式。 “一致”
“懒惰”
'none'
空间索引 空间细节列表 空间规格
vectorIndexes 的 要包含在矢量索引中的路径列表 向量索引[]

ManagedServiceIdentity

Name Description 价值
类型 用于资源的标识类型。 类型“SystemAssigned,UserAssigned”包括隐式创建的标识和一组用户分配的标识。 类型“None”将从服务中删除任何标识。 'None'
'SystemAssigned'
'SystemAssigned,UserAssigned'
'UserAssigned'
userAssignedIdentities 与资源关联的用户标识列表。 用户标识字典密钥引用的格式为 ARM 资源 ID:“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}”。 ManagedServiceIdentityUserAssignedIdentities

ManagedServiceIdentityUserAssignedIdentities

Name Description 价值

ManagedServiceIdentityUserAssignedIdentities

Name Description 价值

资源恢复参数

Name Description 价值
restoreSource 必须从中启动还原的可还原数据库帐户的 ID。 例如:/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName} 字符串
restoreTimestampInUtc 帐户必须还原到的时间(ISO-8601 格式)。 字符串
restoreWithTtlDisabled 指定还原的帐户是否在成功还原时禁用时间To-Live。 布尔

空间规格

Name Description 价值
路径 索引行为应用于的路径。 索引路径通常以根开头,以通配符结尾(/path/*) 字符串
类型 路径的空间类型列表 包含任一项的字符串数组:
“LineString”
“MultiPolygon”
“Point”
“Polygon”

唯一键

Name Description 价值
路径 路径列表对于 Azure Cosmos DB 服务中的每个文档必须是唯一的 字符串[]

UniqueKeyPolicy (唯一密钥策略)

Name Description 价值
uniqueKeys 的 在 Azure Cosmos DB 服务中对集合中的文档强制实施唯一性约束的唯一键列表。 UniqueKey[]

向量索引

Name Description 价值
索引搜索列表大小 这是在构建 DiskANN 索引作为优化过程的一部分时存储的近似邻居候选列表的大小。 较大的值可能会以延迟为代价来提高召回率。 这仅适用于 diskANN 矢量索引类型。 int

Constraints:
最小值 = 25
最大值 = 500
路径 文档中矢量字段的路径。 string (必需)
量化字节大小 向量乘积量化中使用的字节数。 较大的值可能会导致更好的向量搜索召回率,但会牺牲延迟。 这仅适用于 quantizedFlat 和 diskANN 矢量索引类型。 int

Constraints:
最小值 = 4
类型 矢量的索引类型。 目前支持平面、diskANN 和 quantizedFlat。 “diskANN”
“flat”
“quantizedFlat”(必需)
vectorIndexShardKey 矢量索引的分片键数组。 这仅适用于 quantizedFlat 和 diskANN 矢量索引类型。 字符串[]

ARM 模板资源定义

可以使用目标操作部署 databaseAccounts/gremlinDatabases/graphs 资源类型:

用法示例

Azure 快速入门模板

以下 Azure 快速入门模板 部署此资源类型。

Template Description
为 Gremlin API 创建 Azure Cosmos DB 帐户

部署到 Azure
此模板使用专用吞吐量在两个区域中为 Gremlin API 创建 Azure Cosmos DB 帐户,其中包含一个数据库和一个图形。
为 Gremlin API 自动缩放 创建 Azure Cosmos DB 帐户

部署到 Azure
此模板使用自动缩放吞吐量在两个区域中为 Gremlin API 创建 Azure Cosmos DB 帐户,其中包含一个数据库和一个图形。

资源格式

若要创建 Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs 资源,请将以下 JSON 添加到模板。

{
  "type": "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs",
  "apiVersion": "2025-11-01-preview",
  "name": "string",
  "identity": {
    "type": "string",
    "userAssignedIdentities": {
      "{customized property}": {
      }
    }
  },
  "location": "string",
  "properties": {
    "options": {
      "autoscaleSettings": {
        "maxThroughput": "int"
      },
      "throughput": "int"
    },
    "resource": {
      "analyticalStorageTtl": "int",
      "conflictResolutionPolicy": {
        "conflictResolutionPath": "string",
        "conflictResolutionProcedure": "string",
        "mode": "string"
      },
      "createMode": "string",
      "defaultTtl": "int",
      "id": "string",
      "indexingPolicy": {
        "automatic": "bool",
        "compositeIndexes": [
          [
            {
              "order": "string",
              "path": "string"
            }
          ]
        ],
        "excludedPaths": [
          {
            "path": "string"
          }
        ],
        "fullTextIndexes": [
          {
            "path": "string"
          }
        ],
        "includedPaths": [
          {
            "indexes": [
              {
                "dataType": "string",
                "kind": "string",
                "precision": "int"
              }
            ],
            "path": "string"
          }
        ],
        "indexingMode": "string",
        "spatialIndexes": [
          {
            "path": "string",
            "types": [ "string" ]
          }
        ],
        "vectorIndexes": [
          {
            "indexingSearchListSize": "int",
            "path": "string",
            "quantizationByteSize": "int",
            "type": "string",
            "vectorIndexShardKey": [ "string" ]
          }
        ]
      },
      "partitionKey": {
        "kind": "string",
        "paths": [ "string" ],
        "version": "int"
      },
      "restoreParameters": {
        "restoreSource": "string",
        "restoreTimestampInUtc": "string",
        "restoreWithTtlDisabled": "bool"
      },
      "uniqueKeyPolicy": {
        "uniqueKeys": [
          {
            "paths": [ "string" ]
          }
        ]
      }
    }
  },
  "tags": {
    "{customized property}": "string"
  }
}

属性值

Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs

Name Description 价值
apiVersion API 版本 “2025-11-01-预览”
标识 资源的标识。 ManagedServiceIdentity
位置 资源所属的资源组的位置。 字符串
姓名 资源名称 string (必需)
属性 用于创建和更新 Azure Cosmos DB Gremlin 图形的属性。 GremlinGraphCreateUpdatePropertiesOrGremlinGraphGetProperties (必需)
tags 资源标记 标记名称和值的字典。 请参阅模板 中的 标记
类型 资源类型 “Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs”

ARMResourceProperties标签

Name Description 价值

AutoscaleSettings

Name Description 价值
maxThroughput (最大吞吐量) 表示最大吞吐量,资源可以纵向扩展。 int

复合路径

Name Description 价值
顺序 复合路径的排序顺序。 “ascending”
“descending”
路径 索引行为应用于的路径。 索引路径通常以根开头,以通配符结尾(/path/*) 字符串

ConflictResolutionPolicy (冲突解决策略)

Name Description 价值
conflictResolutionPath 冲突解决路径 LastWriterWins 模式下的冲突解决路径。 字符串
conflictResolutionProcedure 解决自定义模式冲突的过程。 字符串
mode 指示冲突解决模式。 'Custom'
“LastWriterWins”

ContainerPartitionKey

Name Description 价值
kind 指示用于分区的算法类型。 对于 MultiHash,容器创建支持多个分区键(最多三个最大值) “Hash”
“MultiHash”
“Range”
路径 使用容器中的数据可以分区的路径列表 字符串[]
版本 指示分区键定义的版本 int

Constraints:
最小值 = 1
最大值 = 2

CreateUpdateOptionsOrGremlinGraphGetPropertiesOptions

Name Description 价值
autoscaleSettings 指定自动缩放设置。 注意:需要吞吐量或自动缩放设置,但不需要两者。 AutoscaleSettings
吞吐量 每秒请求单位数。 例如,“throughput”:10000。 int

排除路径

Name Description 价值
路径 索引行为应用于的路径。 索引路径通常以根开头,以通配符结尾(/path/*) 字符串

全文索引路径

Name Description 价值
路径 文档中全文字段的路径。 string (必需)

GremlinGraphCreateUpdatePropertiesOrGremlinGraphGetProperties

Name Description 价值
options 要为请求应用的选项的键值对。 这对应于随请求一起发送的标头。 CreateUpdateOptionsOrGremlinGraphGetPropertiesOptions
资源 Gremlin 图形的标准 JSON 格式 GremlinGraphResourceOrGremlinGraphGetPropertiesResource(必需)

GremlinGraphResourceOrGremlinGraphGetPropertiesResource

Name Description 价值
分析StorageTtl 分析 TTL。 int
conflictResolutionPolicy (冲突解决策略) 图形的冲突解决策略。 ConflictResolutionPolicy (冲突解决策略)
createMode 用于指示资源创建模式的枚举。 'Default'
“还原”
defaultTtl 默认生存时间 int
id Cosmos DB Gremlin 图形的名称 string (必需)
indexingPolicy (索引策略) 索引策略的配置。 默认情况下,图形中所有文档路径的索引都是自动的 索引策略
partitionKey 要用于将数据分区到多个分区的分区键的配置 ContainerPartitionKey
restoreParameters 指示有关还原的信息的参数 资源恢复参数
uniqueKeyPolicy 的 用于在 Azure Cosmos DB 服务中的集合中指定文档的唯一性约束的唯一键策略配置。 UniqueKeyPolicy (唯一密钥策略)

IncludedPath

Name Description 价值
指标 此路径的索引列表 索引[]
路径 索引行为应用于的路径。 索引路径通常以根开头,以通配符结尾(/path/*) 字符串

Indexes

Name Description 价值
数据类型 为其应用索引行为的数据类型。 “LineString”
“MultiPolygon”
“Number”
“Point”
“Polygon”
'String'
kind 指示索引的类型。 “Hash”
“Range”
“Spatial”
精准率 索引的精度。 -1 是最大精度。 int

索引策略

Name Description 价值
自动 指示索引策略是否自动 布尔
复合索引 复合路径列表列表 CompositePath[][]
excludedPaths 要从索引中排除的路径列表 ExcludedPath[]
全文索引 要包含在全文索引中的路径列表 全文索引路径[]
includedPaths 要包含在索引中的路径列表 IncludedPath[]
indexingMode 指示索引模式。 “一致”
“懒惰”
'none'
空间索引 空间细节列表 空间规格
vectorIndexes 的 要包含在矢量索引中的路径列表 向量索引[]

ManagedServiceIdentity

Name Description 价值
类型 用于资源的标识类型。 类型“SystemAssigned,UserAssigned”包括隐式创建的标识和一组用户分配的标识。 类型“None”将从服务中删除任何标识。 'None'
'SystemAssigned'
'SystemAssigned,UserAssigned'
'UserAssigned'
userAssignedIdentities 与资源关联的用户标识列表。 用户标识字典密钥引用的格式为 ARM 资源 ID:“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}”。 ManagedServiceIdentityUserAssignedIdentities

ManagedServiceIdentityUserAssignedIdentities

Name Description 价值

ManagedServiceIdentityUserAssignedIdentities

Name Description 价值

资源恢复参数

Name Description 价值
restoreSource 必须从中启动还原的可还原数据库帐户的 ID。 例如:/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName} 字符串
restoreTimestampInUtc 帐户必须还原到的时间(ISO-8601 格式)。 字符串
restoreWithTtlDisabled 指定还原的帐户是否在成功还原时禁用时间To-Live。 布尔

空间规格

Name Description 价值
路径 索引行为应用于的路径。 索引路径通常以根开头,以通配符结尾(/path/*) 字符串
类型 路径的空间类型列表 包含任一项的字符串数组:
“LineString”
“MultiPolygon”
“Point”
“Polygon”

唯一键

Name Description 价值
路径 路径列表对于 Azure Cosmos DB 服务中的每个文档必须是唯一的 字符串[]

UniqueKeyPolicy (唯一密钥策略)

Name Description 价值
uniqueKeys 的 在 Azure Cosmos DB 服务中对集合中的文档强制实施唯一性约束的唯一键列表。 UniqueKey[]

向量索引

Name Description 价值
索引搜索列表大小 这是在构建 DiskANN 索引作为优化过程的一部分时存储的近似邻居候选列表的大小。 较大的值可能会以延迟为代价来提高召回率。 这仅适用于 diskANN 矢量索引类型。 int

Constraints:
最小值 = 25
最大值 = 500
路径 文档中矢量字段的路径。 string (必需)
量化字节大小 向量乘积量化中使用的字节数。 较大的值可能会导致更好的向量搜索召回率,但会牺牲延迟。 这仅适用于 quantizedFlat 和 diskANN 矢量索引类型。 int

Constraints:
最小值 = 4
类型 矢量的索引类型。 目前支持平面、diskANN 和 quantizedFlat。 “diskANN”
“flat”
“quantizedFlat”(必需)
vectorIndexShardKey 矢量索引的分片键数组。 这仅适用于 quantizedFlat 和 diskANN 矢量索引类型。 字符串[]

Terraform (AzAPI 提供程序)资源定义

可以使用目标操作部署 databaseAccounts/gremlinDatabases/graphs 资源类型:

  • 资源组 关于每个API版本中变更属性的列表,请参见 更改日志。

用法示例

Terraform 示例

在 Cosmos DB 帐户中部署 Gremlin Graph 的基本示例。

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 = [
        {
          name = "EnableGremlin"
        },
      ]
      consistencyPolicy = {
        defaultConsistencyLevel = "Strong"
        maxIntervalInSeconds    = 5
        maxStalenessPrefix      = 100
      }
      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" "gremlinDatabase" {
  type      = "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases@2023-04-15"
  parent_id = azapi_resource.databaseAccount.id
  name      = var.resource_name
  body = {
    properties = {
      options = {
      }
      resource = {
        id = var.resource_name
      }
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "graph" {
  type      = "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs@2023-04-15"
  parent_id = azapi_resource.gremlinDatabase.id
  name      = var.resource_name
  body = {
    properties = {
      options = {
        throughput = 400
      }
      resource = {
        id = var.resource_name
        partitionKey = {
          kind = "Hash"
          paths = [
            "/test",
          ]
        }
      }
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

资源格式

若要创建 Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs 资源,请将以下 Terraform 添加到模板。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs@2025-11-01-preview"
  name = "string"
  parent_id = "string"
  identity {
    type = "string"
    identity_ids = [
      "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"
        }
        createMode = "string"
        defaultTtl = int
        id = "string"
        indexingPolicy = {
          automatic = bool
          compositeIndexes = [
            [
              {
                order = "string"
                path = "string"
              }
            ]
          ]
          excludedPaths = [
            {
              path = "string"
            }
          ]
          fullTextIndexes = [
            {
              path = "string"
            }
          ]
          includedPaths = [
            {
              indexes = [
                {
                  dataType = "string"
                  kind = "string"
                  precision = int
                }
              ]
              path = "string"
            }
          ]
          indexingMode = "string"
          spatialIndexes = [
            {
              path = "string"
              types = [
                "string"
              ]
            }
          ]
          vectorIndexes = [
            {
              indexingSearchListSize = int
              path = "string"
              quantizationByteSize = int
              type = "string"
              vectorIndexShardKey = [
                "string"
              ]
            }
          ]
        }
        partitionKey = {
          kind = "string"
          paths = [
            "string"
          ]
          version = int
        }
        restoreParameters = {
          restoreSource = "string"
          restoreTimestampInUtc = "string"
          restoreWithTtlDisabled = bool
        }
        uniqueKeyPolicy = {
          uniqueKeys = [
            {
              paths = [
                "string"
              ]
            }
          ]
        }
      }
    }
  }
}

属性值

Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs

Name Description 价值
标识 资源的标识。 ManagedServiceIdentity
位置 资源所属的资源组的位置。 字符串
姓名 资源名称 string (必需)
parent_id 此资源的父资源的 ID。 类型资源的 ID:databaseAccounts/gremlinDatabases
属性 用于创建和更新 Azure Cosmos DB Gremlin 图形的属性。 GremlinGraphCreateUpdatePropertiesOrGremlinGraphGetProperties (必需)
tags 资源标记 标记名称和值的字典。
类型 资源类型 “Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/graphs@2025-11-01-preview”

ARMResourceProperties标签

Name Description 价值

AutoscaleSettings

Name Description 价值
maxThroughput (最大吞吐量) 表示最大吞吐量,资源可以纵向扩展。 int

复合路径

Name Description 价值
顺序 复合路径的排序顺序。 “ascending”
“descending”
路径 索引行为应用于的路径。 索引路径通常以根开头,以通配符结尾(/path/*) 字符串

ConflictResolutionPolicy (冲突解决策略)

Name Description 价值
conflictResolutionPath 冲突解决路径 LastWriterWins 模式下的冲突解决路径。 字符串
conflictResolutionProcedure 解决自定义模式冲突的过程。 字符串
mode 指示冲突解决模式。 'Custom'
“LastWriterWins”

ContainerPartitionKey

Name Description 价值
kind 指示用于分区的算法类型。 对于 MultiHash,容器创建支持多个分区键(最多三个最大值) “Hash”
“MultiHash”
“Range”
路径 使用容器中的数据可以分区的路径列表 字符串[]
版本 指示分区键定义的版本 int

Constraints:
最小值 = 1
最大值 = 2

CreateUpdateOptionsOrGremlinGraphGetPropertiesOptions

Name Description 价值
autoscaleSettings 指定自动缩放设置。 注意:需要吞吐量或自动缩放设置,但不需要两者。 AutoscaleSettings
吞吐量 每秒请求单位数。 例如,“throughput”:10000。 int

排除路径

Name Description 价值
路径 索引行为应用于的路径。 索引路径通常以根开头,以通配符结尾(/path/*) 字符串

全文索引路径

Name Description 价值
路径 文档中全文字段的路径。 string (必需)

GremlinGraphCreateUpdatePropertiesOrGremlinGraphGetProperties

Name Description 价值
options 要为请求应用的选项的键值对。 这对应于随请求一起发送的标头。 CreateUpdateOptionsOrGremlinGraphGetPropertiesOptions
资源 Gremlin 图形的标准 JSON 格式 GremlinGraphResourceOrGremlinGraphGetPropertiesResource(必需)

GremlinGraphResourceOrGremlinGraphGetPropertiesResource

Name Description 价值
分析StorageTtl 分析 TTL。 int
conflictResolutionPolicy (冲突解决策略) 图形的冲突解决策略。 ConflictResolutionPolicy (冲突解决策略)
createMode 用于指示资源创建模式的枚举。 'Default'
“还原”
defaultTtl 默认生存时间 int
id Cosmos DB Gremlin 图形的名称 string (必需)
indexingPolicy (索引策略) 索引策略的配置。 默认情况下,图形中所有文档路径的索引都是自动的 索引策略
partitionKey 要用于将数据分区到多个分区的分区键的配置 ContainerPartitionKey
restoreParameters 指示有关还原的信息的参数 资源恢复参数
uniqueKeyPolicy 的 用于在 Azure Cosmos DB 服务中的集合中指定文档的唯一性约束的唯一键策略配置。 UniqueKeyPolicy (唯一密钥策略)

IncludedPath

Name Description 价值
指标 此路径的索引列表 索引[]
路径 索引行为应用于的路径。 索引路径通常以根开头,以通配符结尾(/path/*) 字符串

Indexes

Name Description 价值
数据类型 为其应用索引行为的数据类型。 “LineString”
“MultiPolygon”
“Number”
“Point”
“Polygon”
'String'
kind 指示索引的类型。 “Hash”
“Range”
“Spatial”
精准率 索引的精度。 -1 是最大精度。 int

索引策略

Name Description 价值
自动 指示索引策略是否自动 布尔
复合索引 复合路径列表列表 CompositePath[][]
excludedPaths 要从索引中排除的路径列表 ExcludedPath[]
全文索引 要包含在全文索引中的路径列表 全文索引路径[]
includedPaths 要包含在索引中的路径列表 IncludedPath[]
indexingMode 指示索引模式。 “一致”
“懒惰”
'none'
空间索引 空间细节列表 空间规格
vectorIndexes 的 要包含在矢量索引中的路径列表 向量索引[]

ManagedServiceIdentity

Name Description 价值
类型 用于资源的标识类型。 类型“SystemAssigned,UserAssigned”包括隐式创建的标识和一组用户分配的标识。 类型“None”将从服务中删除任何标识。 'None'
'SystemAssigned'
'SystemAssigned,UserAssigned'
'UserAssigned'
userAssignedIdentities 与资源关联的用户标识列表。 用户标识字典密钥引用的格式为 ARM 资源 ID:“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}”。 ManagedServiceIdentityUserAssignedIdentities

ManagedServiceIdentityUserAssignedIdentities

Name Description 价值

ManagedServiceIdentityUserAssignedIdentities

Name Description 价值

资源恢复参数

Name Description 价值
restoreSource 必须从中启动还原的可还原数据库帐户的 ID。 例如:/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName} 字符串
restoreTimestampInUtc 帐户必须还原到的时间(ISO-8601 格式)。 字符串
restoreWithTtlDisabled 指定还原的帐户是否在成功还原时禁用时间To-Live。 布尔

空间规格

Name Description 价值
路径 索引行为应用于的路径。 索引路径通常以根开头,以通配符结尾(/path/*) 字符串
类型 路径的空间类型列表 包含任一项的字符串数组:
“LineString”
“MultiPolygon”
“Point”
“Polygon”

唯一键

Name Description 价值
路径 路径列表对于 Azure Cosmos DB 服务中的每个文档必须是唯一的 字符串[]

UniqueKeyPolicy (唯一密钥策略)

Name Description 价值
uniqueKeys 的 在 Azure Cosmos DB 服务中对集合中的文档强制实施唯一性约束的唯一键列表。 UniqueKey[]

向量索引

Name Description 价值
索引搜索列表大小 这是在构建 DiskANN 索引作为优化过程的一部分时存储的近似邻居候选列表的大小。 较大的值可能会以延迟为代价来提高召回率。 这仅适用于 diskANN 矢量索引类型。 int

Constraints:
最小值 = 25
最大值 = 500
路径 文档中矢量字段的路径。 string (必需)
量化字节大小 向量乘积量化中使用的字节数。 较大的值可能会导致更好的向量搜索召回率,但会牺牲延迟。 这仅适用于 quantizedFlat 和 diskANN 矢量索引类型。 int

Constraints:
最小值 = 4
类型 矢量的索引类型。 目前支持平面、diskANN 和 quantizedFlat。 “diskANN”
“flat”
“quantizedFlat”(必需)
vectorIndexShardKey 矢量索引的分片键数组。 这仅适用于 quantizedFlat 和 diskANN 矢量索引类型。 字符串[]