Create a Database in Azure Cosmos DB
Note: This tutorial guides you through creating a database using the Azure portal. Similar steps can be followed using SDKs or the Azure CLI.
Introduction
Azure Cosmos DB is a globally distributed, multi-model database service. Creating a database is the first step in organizing your data within an Azure Cosmos DB account. Databases in Azure Cosmos DB are logical constructs that group containers.
Prerequisites
- An active Azure subscription. If you don't have one, create a free account.
- An Azure Cosmos DB account. If you don't have one, you can create one in the Azure portal.
Steps to Create a Database
Step 1: Navigate to your Azure Cosmos DB Account
- Sign in to the Azure portal.
- In the search bar at the top, type "Azure Cosmos DB" and select it from the search results.
- Select your existing Azure Cosmos DB account from the list.
Step 2: Access the Data Explorer
Once you are on the overview page of your Azure Cosmos DB account, navigate to the Data Explorer in the left-hand menu.
Step 3: Create a New Database
- In the Data Explorer, click on the New Database button.
- A side panel will appear. Enter a unique Database ID for your new database (e.g.,
MySampleDatabase). Database IDs can contain lowercase letters, numbers, and hyphens, and must be between 1 and 255 characters. - You can optionally configure throughput for the database. For most scenarios, it's recommended to configure throughput at the container level. Leave this as Manual and set the RU/s to 400 for initial setup or select Autoscale if preferred.
- Click OK.
Step 4: Verify Database Creation
After a short period, your new database will appear under the Databases section in the Data Explorer's left-hand navigation pane. You can then select this database to start creating containers within it.
Next Steps
Now that you have successfully created a database, you can proceed to:
- Create a Container within your database.
- Configure throughput settings for your database or containers.
- Learn more about Azure Cosmos DB pricing.