适用于 Azure Cosmos DB 表 API 的 Azure PowerShell 示例Azure PowerShell samples for Azure Cosmos DB Table API

适用于: 表 API

下表包含常用于 Azure Cosmos DB 的 Azure PowerShell 脚本的链接。The following table includes links to commonly used Azure PowerShell 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 PowerShell 参考中收录了所有 Azure Cosmos DB PowerShell cmdlet 的参考页。Reference pages for all Azure Cosmos DB PowerShell cmdlets are available in the Azure PowerShell Reference. Az.CosmosDB 模块现在是 Az 模块的一部分。The Az.CosmosDB module is now part of the Az module. 下载并安装 Az 模块的最新版本,获取 Azure Cosmos DB cmdlet。Download and install the latest version of Az module to get the Azure Cosmos DB cmdlets. 还可从 PowerShell 库中获取最新版本。You can also get the latest version from the PowerShell Gallery. 还可以从我们的 GitHub 存储库 GitHub 上的 Cosmos DB PowerShell 示例创建这些适用于 Cosmos DB 的 PowerShell 示例的分支。You can also fork these PowerShell samples for Cosmos DB from our GitHub repository, Cosmos DB PowerShell Samples on GitHub.

常见示例Common Samples

任务Task 说明Description
更新帐户Update an account 更新 Cosmos DB 帐户的默认一致性级别。Update a Cosmos DB account's default consistency level.
更新帐户的区域Update an account's regions 更新 Cosmos DB 帐户的区域。Update a Cosmos DB account's regions.
更改故障转移优先级或触发故障转移Change failover priority or trigger failover 更改 Azure Cosmos 帐户的区域故障转移优先级或触发手动故障转移。Change the regional failover priority of an Azure Cosmos account or trigger a manual failover.
帐户密钥或连接字符串Account keys or connection strings 获取 Azure Cosmos DB 帐户的主密钥和辅助密钥、连接字符串或重新生成其帐户密钥。Get primary and secondary keys, connection strings or regenerate an account key of an Azure Cosmos DB account.
创建启用 IP 防火墙的 Cosmos 帐户Create a Cosmos Account with IP Firewall 创建启用 IP 防火墙的 Azure Cosmos DB 帐户。Create an Azure Cosmos DB account with IP Firewall enabled.

表 API 示例Table API Samples

任务Task 说明Description
创建帐户和表Create an account and table 创建 Azure Cosmos 帐户和表。Creates an Azure Cosmos account and table.
创建帐户和表(具有自动缩放功能)Create an account and table with autoscale 创建 Azure Cosmos 帐户和表(具有自动缩放功能)。Creates an Azure Cosmos account and table autoscale.
列出或获取表List or get tables 列出或获取表。List or get tables.
吞吐量操作Throughput operations 表的吞吐量操作,包括获取、更新自动缩放和标准吞吐量和在其之间进行迁移。Throughput operations for a table including get, update and migrate between autoscale and standard throughput.
锁定资源以防止将其删除Lock resources from deletion 通过资源锁防止资源遭到删除。Prevent resources from being deleted with resource locks.