建立 Azure Cosmos DB for NoSQL 帳戶

適用於:NoSQL

Azure Cosmos DB for NoSQL 帳戶包含您所有的 Azure Cosmos DB 資源:資料庫、容器和項目。 此帳戶為各種工具和 SDK 提供唯一的端點,用以連線到 Azure Cosmos DB 並執行日常作業。 如需 Azure Cosmos DB 中資源的詳細資訊,請參閱 Azure Cosmos DB 資源模型

必要條件

建立客戶

使用 API for NoSQL 建立單一 Azure Cosmos DB 帳戶。

  1. 建立 accountNameresourceGroupNamelocation 的殼層變數。

    # Variable for resource group name
    resourceGroupName="msdocs-cosmos"
    
    # Variable for location
    location="westus"
    
    # Variable for account name with a randomnly generated suffix
    let suffix=$RANDOM*$RANDOM
    accountName="msdocs-$suffix"
    
  2. 如果您尚未登入,請使用 az login 命令登入 Azure CLI。

  3. 使用 az group create 命令在您的訂用帳戶中建立新的資源群組。

    az group create \
        --name $resourceGroupName \
        --location $location
    
  4. 使用 az cosmosdb create 命令建立具有預設設定的新 Azure Cosmos DB for NoSQL 帳戶。

    az cosmosdb create \
        --resource-group $resourceGroupName \
        --name $accountName \
        --locations regionName=$location
    

下一步

在此指南中,您已了解如何建立 Azure Cosmos DB for NoSQL 帳戶。 現在,您可以使用 Azure Cosmos DB 帳戶建立應用程式。