You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过Azure CLI创建启用Gremlin Graph API的Azure CosmosDB账户?

使用Azure CLI创建启用Gremlin Graph API的Azure Cosmos DB账户

我完全理解你的困扰——当你从Azure门户切换到CLI来创建Gremlin Graph类型的Cosmos DB账户时,--capabilities参数的配置确实容易让人混淆。下面是具体的操作方法和完整命令示例:

核心命令示例

你可以直接使用以下Azure CLI命令创建支持Gremlin Graph API的Cosmos DB账户,关键就是通过--capabilities参数指定EnableGremlin:

az cosmosdb create \
  --name <你的CosmosDB账户名称> \
  --resource-group <你的资源组名称> \
  --kind GlobalDocumentDB \
  --capabilities EnableGremlin \
  --default-consistency-level Session \
  --locations regionName="East US" failoverPriority=0 isZoneRedundant=False

参数说明

  • --kind GlobalDocumentDB:因为Gremlin Graph API是基于Core (SQL) API扩展的能力,所以这里需要指定为GlobalDocumentDB(这是Cosmos DB账户的基础类型)。
  • --capabilities EnableGremlin:这个参数就是用来启用Gremlin Graph能力的核心配置,直接传递EnableGremlin即可。如果需要同时启用多个能力(比如同时支持MongoDB和Gremlin),可以用空格分隔多个值,比如--capabilities EnableGremlin EnableMongo。
  • 其他参数:--name、--resource-group、--locations这些都是创建Cosmos DB账户的必填/常用参数,你可以根据自己的需求调整区域、一致性级别等配置。

验证配置是否生效

创建完成后,你可以用以下命令查看账户的能力配置,确认Gremlin是否已经启用:

az cosmosdb show --name <你的CosmosDB账户名称> --resource-group <你的资源组名称> --query "capabilities"

执行后应该会返回包含"name": "EnableGremlin"的结果,说明配置成功。

内容的提问来源于stack exchange,提问作者Tomas Aschan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 09:49:13