This tutorial guides you through creating and interacting with an Azure Cosmos DB account using the Core (SQL) API in the Azure portal.
Open your web browser and go to the Azure portal. Sign in with your Azure account credentials.
The Create Azure Cosmos DB Account page appears.
On the Basics tab, enter the following details:
cosmosdb-quickstart-rg
).cosmosdbquickstart-yourname
). This name must be globally unique and between 3 and 16 characters long, containing only lowercase letters and numbers.Click Review + create.
Review the settings you’ve configured. If everything looks correct, click Create.
The deployment will take a few minutes. Once completed, you'll see a notification indicating that your deployment is complete.
After the deployment is complete, select Go to resource on the deployment success page. Or, search for your Cosmos DB account in the Azure portal search bar and select it.
ToDoList
).Items
)./category
. The partition key is crucial for scaling your database.Data Explorer now shows your new database and container.
ToDoList
database and select the Items
container.
{
"id": "6871951838070975",
"category": "personal",
"name": "groceries",
"description": "buy milk and eggs",
"isComplete": false
}
{
"id": "6871951838070976",
"category": "work",
"name": "project proposal",
"description": "submit proposal to client",
"isComplete": false
}
In Data Explorer, with the Items
container selected, the following query is automatically executed:
SELECT * FROM c
You can modify this query to filter or sort your data. For example, to find items with the category "personal":
SELECT * FROM c WHERE c.category = "personal"
Press Enter or click the Execute Query button to run your query. The results will appear in the right pane.
To avoid ongoing charges, it's recommended to delete the resource group you created for this quickstart.
cosmosdb-quickstart-rg
).