适用于 Azure Cosmos DB Gremlin API 的 Azure CLI 示例Azure CLI samples for Azure Cosmos DB Gremlin API

适用于: Gremlin API

下表包括用于 Azure Cosmos DB 的示例 Azure CLI 脚本的链接。The following table includes links to sample Azure CLI scripts for Azure Cosmos DB. 使用右侧的链接可导航到 API 特定示例。Use the links on the right to navigate to API specific samples. 常见示例在所有 API 间是相同的。Common samples are the same across all APIs. Azure CLI 参考中收录了所有 Azure Cosmos DB CLI 命令的参考页。Reference pages for all Azure Cosmos DB CLI commands are available in the Azure CLI Reference. 还可以在 Azure Cosmos DB CLI GitHub 存储库中找到 Azure Cosmos DB CLI 脚本示例。Azure Cosmos DB CLI script samples can also be found in the Azure Cosmos DB CLI GitHub Repository.

这些示例要求使用 Azure CLI 2.12.1 版或更高版本。These samples require Azure CLI version 2.12.1 or later. 运行 az --version 即可查找版本。Run az --version to find the version. 如果需要进行安装或升级,请参阅安装 Azure CLIIf you need to install or upgrade, see Install Azure CLI

常见示例Common Samples

这些示例适用于所有 Azure Cosmos DB APIThese samples apply to all Azure Cosmos DB APIs

任务Task 说明Description
添加或故障转移区域Add or failover regions 添加区域、更改故障转移优先级、触发手动故障转移。Add a region, change failover priority, trigger a manual failover.
帐户密钥和连接字符串Account keys and connection strings 列出帐户密钥、只读密钥,重新生成密钥并列出连接字符串。List account keys, read-only keys, regenerate keys and list connection strings.
使用 IP 防火墙保护Secure with IP firewall 创建配置了 IP 防火墙的 Cosmos 帐户。Create a Cosmos account with IP firewall configured.
使用服务终结点保护新帐户Secure new account with service endpoints 使用服务终结点创建 Cosmos 帐户并确保其安全。Create a Cosmos account and secure with service-endpoints.
使用服务终结点保护现有帐户Secure existing account with service endpoints 最终配置子网后,更新 Cosmos 帐户以使用服务终结点进行保护。Update a Cosmos account to secure with service-endpoints when the subnet is eventually configured.

Gremlin API 示例Gremlin API Samples

任务Task 说明Description
创建 Azure Cosmos 帐户、数据库和图Create an Azure Cosmos account, database and graph 为 Gremlin API 创建 Azure Cosmos DB 帐户、数据库和图。Creates an Azure Cosmos DB account, database, and graph for Gremlin API.
创建 Azure Cosmos 帐户、数据库和图(具有自动缩放功能)Create an Azure Cosmos account, database and graph with autoscale 为 Gremlin API 创建 Azure Cosmos DB 帐户、数据库和图(具有自动缩放功能)。Creates an Azure Cosmos DB account, database, and graph with autoscale for Gremlin API.
吞吐量操作Throughput operations 在数据库和图上的自动缩放和标准吞吐量之间读取、更新和迁移。Read, update and migrate between autoscale and standard throughput on a database and graph.
锁定资源以防止将其删除Lock resources from deletion 使用资源锁防止删除资源。Prevent resources from being deleted with resource locks.