Azure Cosmos DB for NoSQL 的 Azure PowerShell 範例

適用於:NoSQL

下表包含適用於 Azure Cosmos DB 的常用 Azure PowerShell 指令碼連結。 使用右側的連結瀏覽至 API 特定範例。 所有 API 的通用範例皆相同。 您可以在 Azure PowerShell 參考中取得所有 Azure Cosmos DB PowerShell Cmdlet 的參考頁面。 Az.CosmosDB 模組現在是 Az 模組的一部分。 下載並安裝最新版的 Az 模組,以取得 Azure Cosmos DB Cmdlet。 您也可以從 PowerShell 資源庫取得最新版本。 您也可以從 GitHub 存放庫 (GitHub 上的 Azure Cosmos DB PowerShell 範例) 的 Azure Cosmos DB 派生這些 PowerShell 範例。

如需適用於其他 API 的 PowerShell Cmdlet,請參閱適用於 Cassandra 的 PowerShell 範例適用於 API for MongoDB 的 PowerShell 範例適用於 Gremlin 的 PowerShell 範例適用於 Table 的 PowerShell 範例

通用範例

Task 描述
更新帳戶 更新 Azure Cosmos DB 帳戶的預設一致性層級。
更新帳戶的區域 更新 Azure Cosmos DB 帳戶的區域。
變更容錯移轉優先順序或觸發容錯移轉 變更 Azure Cosmos DB 帳戶的地區性容錯移轉優先順序或觸發手動容錯移轉。
帳戶金鑰或連接字串 取得主要和次要金鑰、連接字串,或重新產生 Azure Cosmos DB 帳戶的帳戶金鑰。
建立具有 IP 防火牆的 Azure Cosmos DB 帳戶 建立已啟用 IP 防火牆的 Azure Cosmos DB 帳戶。

API for NoSQL 範例

Task 描述
建立帳戶、資料庫和容器 建立 Azure Cosmos DB 帳戶、資料庫和容器。
建立具有自動調整功能的帳戶、資料庫和容器 建立具有自動調整功能的 Azure Cosmos DB 帳戶、資料庫和容器。
使用大型分割區索引鍵建立容器 使用大型分割區索引鍵建立容器。
建立沒有索引原則的容器 建立關閉索引原則的 Azure Cosmos DB 容器。
列出或取得資料庫或容器 列出或取得資料庫或容器。
執行輸送量作業 執行資料庫或容器的輸送量作業,包括自動調整和標準輸送量之間的取得、更新和遷移。
鎖定資源避免刪除 使用資源鎖定避免刪除資源。