Azure Cosmos DB
Use cases · fit and poor fit · account, container, item · consistency · throughput · NoSQL, MongoDB, Table, Cassandra and Gremlin APIs
By the tools4free.dev team · Last reviewed November 13, 2026
Practice questions for this topic →
What Azure Cosmos DB is
- Azure Cosmos DB is a fully managed NoSQL database service on Azure, a platform-as-a-service (PaaS) offering. Microsoft handles provisioning, patching, updates and backups.
- It is schema-agnostic: items in the same container don't need to share the same structure.
- It automatically creates and maintains indexes on all item properties by default.
- You can add Azure regions to your account at any time and the service replicates your data to each one. Accounts with multi-region writes have a 99.999% availability SLA.
How data is organized
| Level | What it is |
|---|---|
| Account | The top-level Azure resource |
| Database | A logical namespace that groups related containers |
| Container | The primary unit of storage and scaling. You configure the partition key, throughput, indexing policy and optional time-to-live here |
| Item | An individual data entity in a container. Depending on the API, items may be called documents, rows, nodes or edges |
The partition key distributes data across logical partitions. Each logical partition can hold up to 20 GB of data.
Use cases: good fit and poor fit
| Workload | Example | Fit |
|---|---|---|
| IoT and telemetry | Fast ingestion of high-frequency device data | Good |
| Gaming | Player profiles, leaderboards, in-game stats | Good |
| Retail and e-commerce | Product catalogs, shopping carts, order pipelines | Good |
| Web and mobile apps | Personalized experiences, social features, third-party integrations | Good |
| Analytical workloads (OLAP) | Interactive, streaming and batch analytics for analysts and data scientists | Poor: consider Microsoft Fabric |
| Highly relational apps | A white-label CRM application | Poor: consider Azure SQL or Azure Database for MySQL |
Good-fit traits listed by Microsoft: flexible schema, latency sensitive, highly elastic, high throughput, and highly available mission critical workloads.
Consistency levels and throughput
| Consistency level | Meaning |
|---|---|
| Strong | Every read reflects the most recent write |
| Bounded staleness | Reads lag behind writes by a configurable interval (time or version count) |
| Session | Consistency is guaranteed within a single client session; the most widely used level |
| Consistent prefix | Reads never see out-of-order writes but may see stale data |
| Eventual | Replicas converge over time; the weakest guarantee but the highest availability |
Capacity is measured in Request Units per second (RU/s). One RU is roughly the cost of reading a single 1-KB item by its ID and partition key.
| Throughput option | Description |
|---|---|
| Dedicated | Provisioned throughput reserved exclusively for one container |
| Shared | Provisioned at the database level and shared across up to 25 containers |
| Serverless | No throughput to provision upfront; you pay for the RUs your requests consume. Best for intermittent, unpredictable traffic. Limited to a single Azure region |
| Autoscale | You set a maximum RU/s and Cosmos DB adjusts capacity within that range |
The five APIs
When you create an account you choose the API. It sets the data format, the query language and the client libraries your application uses.
| API | Data model | Query language | Choose it when |
|---|---|---|---|
| NoSQL | JSON documents | SQL-like syntax | You want the native Cosmos DB API (previously called the SQL API) |
| MongoDB | BSON | MongoDB Query Language (MQL) | You have MongoDB drivers and expertise |
| Table | Key-value pairs; rows identified by PartitionKey and RowKey | Table Storage programming model | You have an Azure Table Storage app and want more scale, global distribution and automatic indexing |
| Apache Cassandra | Column-family | CQL (Cassandra Query Language) | You migrate an Apache Cassandra workload |
| Apache Gremlin | Graph: vertices (nodes) and edges | Gremlin | Connections between data matter: social networks, recommendations, fraud detection |
Azure Cosmos DB for PostgreSQL is a separate offering on a retirement path and isn't recommended for new projects. Azure Table Storage remains available.
Cosmos DB for NoSQL supports Fabric mirroring, which replicates operational data into Microsoft Fabric with no ETL pipeline to build or manage.
Exam Tips
Tick each tip once you can answer it without looking.
“Flexible schema, items with different properties, global low latency” → Azure Cosmos DB. Trap: Azure SQL Database is better suited when an app depends on complex multi-table joins.
“Interactive or batch analytics for analysts (OLAP)” → Poor fit for Cosmos DB; use Microsoft Fabric. Trap: Cosmos DB is an operational NoSQL store.
“Highly relational app, such as a white-label CRM” → Azure SQL or Azure Database for MySQL. Trap: Cosmos DB is listed as a poor fit for highly relational apps.
“Existing MongoDB application, minimal code changes” → Cosmos DB for MongoDB. Trap: NoSQL is the native API with SQL-like queries, not MongoDB drivers.
“Existing Azure Table Storage app needing global distribution” → Cosmos DB for Table. Trap: Table Storage remains available; the Cosmos DB API adds scale, distribution and indexing.
“Entities and relationships, traversals” → Cosmos DB for Apache Gremlin. Trap: Gremlin means vertices and edges, not key-value pairs.
“Migrating an Apache Cassandra workload, CQL” → Cosmos DB for Apache Cassandra. Trap: Cassandra is column-family; Table is key-value.
“"SQL API" in older docs” → Cosmos DB for NoSQL. Trap: It was renamed; it is the same service.
“JSON documents with SQL-like queries” → Cosmos DB for NoSQL. Trap: MongoDB stores BSON and uses MQL.
“Most widely used consistency level” → Session. Trap: Strong is the most recent-write guarantee, Eventual the weakest.
“Pay per RU consumed, nothing provisioned, spiky traffic” → Serverless. Trap: Serverless accounts are limited to a single Azure region.
“Unit of capacity and cost” → Request Unit per second (RU/s). Trap: One RU is about reading a 1-KB item by ID and partition key.
“Where you configure the partition key, indexing policy and (dedicated) throughput” → Container. Trap: A database is a logical namespace that groups related containers; shared throughput can be set at the database level.
“Replicate operational Cosmos DB data into Fabric without ETL” → Fabric mirroring. Trap: You do not build or manage a pipeline for mirroring.
“Cosmos DB for PostgreSQL for a new project” → Not recommended. Trap: It is a separate offering on a retirement path.
Sources
- Describe Azure Cosmos DB (Microsoft Learn training)
- Identify Azure Cosmos DB APIs (Microsoft Learn training)
- Introduction to Azure Cosmos DB
- Common use cases and scenarios for Azure Cosmos DB
Checked against Microsoft Learn on November 13, 2026.