Deploy and Query Azure Cosmos DB with the NoSQL API
Create a serverless Cosmos DB account, build a database and container, insert and query documents, and explore consistency levels in this hands-on lab.

Lab overview
Azure Cosmos DB is Microsoft's globally distributed, multi-model database service built for mission-critical workloads. Its NoSQL API lets you query JSON documents using familiar SQL-like syntax while delivering single-digit-millisecond latency and five tunable consistency levels — a combination no other managed database offers.
In this lab, you will deploy a Cosmos DB account in serverless mode, create a database and container with a thoughtful partition key, insert JSON documents, and write queries to filter, project, and sort your data. You will also configure indexing policies and explore the five consistency levels that make Cosmos DB unique. Each step frames a real architecture decision — not just a click-through — so you leave with the knowledge to design Cosmos DB solutions for production workloads.
Objectives
Upon completing this Intermediate level lab, you will be able to:
- Create an Azure Cosmos DB account using the serverless capacity mode with the NoSQL API
- Build a database and container with a well-designed partition key strategy
- Insert JSON documents into a container using the Azure Portal Data Explorer
- Write SQL-like queries to filter, project, and sort NoSQL documents
- Configure an indexing policy to include and exclude specific document paths
- Compare the five consistency levels and understand their trade-offs in a distributed system
Who is this lab for?
This lab is designed for:
- Cloud engineers and developers learning Azure's flagship NoSQL database and wanting hands-on experience with Cosmos DB
- Solutions architects evaluating Cosmos DB's consistency models and cost optimization strategies
- Database administrators transitioning from relational databases to NoSQL and looking for a structured introduction
Verified against your live environment
An automated validation engine inspects your actual resources and configurations as you work. Completion means the task was performed — not multiple choice, real-world proficiency.
More labs like this
Expose a REST API as an MCP Server via Azure API Management
Import a REST API into Azure API Management and export it as an MCP server for AI agents to consume as tools
Azure Cosmos DB for NoSQL Database and Container Setup
Independently create an Azure Cosmos DB for NoSQL account, set up a database and container with a partition key, and add JSON items.
Creating a Web App on Azure App Service using Azure Portal
Learn how to create, configure, and deploy a web application using Azure App Service through the Azure Portal's interface.
Related reading
Environment
Every lab includes
- Real environment, pre-credentialed
- Automated checks on every step
- Isolated sandbox, auto cleanup
- AI-recommended next steps
Lab curriculum
- 01
Logging into Azure Account using Azure Portal
- 02
Create an Azure Cosmos DB Serverless Account with the NoSQL API
1 automated check
- 03
Build a Database and Container with a Partition Key
1 automated check
- 04
Insert and Query JSON Documents in Data Explorer
1 automated check
- 05
Configure Indexing Policies and Explore Consistency Levels
1 automated check
Not the lab you were looking for?
Browse 150+ hands-on labs across AWS, Azure, Kubernetes, Docker, and cloud security.