The official Microsoft Certified: Azure Cosmos DB AI Developer Associate syllabus, organized by domain. Check off each point as you review it.
Inicia sesión para guardar tu progreso entre sesiones.
Evaluate resource models and SDK solutions
Azure Cosmos DB offers five consistency levels: Strong, Bounded Staleness, Session, Consistent Prefix and Eventual. Strong and Bounded Staleness read from two replicas and double the RU cost of reads, while Session guarantees read-your-writes through session tokens. A per-request ConsistencyLevel override can only relax the account default.
Consistency level choices - Azure Cosmos DB ↗Manage Consistency - Azure Cosmos DB ↗
Request units (RUs) normalize the CPU, IO and memory cost of every operation. A point read by id and partition key is the cheapest read, and a query that filters on id and partition key doesn't count as a point read. Write cost depends on item size and indexed properties, and each operation's charge is returned in the SDK response.
Optimize Request Cost - Azure Cosmos DB ↗Request Units as a throughput and performance currency - Azure Cosmos DB ↗
Provisioned throughput can be standard (manual) or autoscale, set on the container (recommended) or shared at database level, and it applies in every region of the account. Serverless fits intermittent traffic in a single region. Burst capacity uses idle capacity for short spikes, and priority-based execution throttles low-priority requests first.
Provision Throughput for Containers and Databases - Azure Cosmos DB ↗Create Containers and Databases with Autoscale Throughput - Azure Cosmos DB ↗
Account settings include regions, the default consistency level and the backup policy (periodic, or continuous with point-in-time restore). Container settings include the partition key and the unique key policy, which are fixed at creation, and the indexing policy and time to live (DefaultTimeToLive and per-item ttl), which can be changed later.
Expire Data With Time to Live - Azure Cosmos DB ↗Use Unique Keys - Azure Cosmos DB ↗
Databases and containers are created with CreateDatabaseIfNotExistsAsync and CreateContainerIfNotExistsAsync in .NET, create_database_if_not_exists and create_container_if_not_exists in Python, or az cosmosdb sql commands in the CLI. Changeable properties are updated with replace_container. With Microsoft Entra ID, creating containers is a control plane operation, not a data plane one.
Manage Resources Using Azure CLI - Azure Cosmos DB ↗Create a Container Using .NET - Azure Cosmos DB ↗
Use one CosmosClient per account for the lifetime of the application. In .NET, Direct mode (TCP) is the default and Gateway mode uses the standard HTTPS port, while ApplicationRegion or ApplicationPreferredRegions set the preferred regions. In Python, preferred_locations orders the read regions and the azure.cosmos.aio async client must be closed.
Best Practices for .NET SDK V3 - Azure Cosmos DB ↗Best practices for Python SDK - Azure Cosmos DB ↗
Implement database operations
Parameterized queries use the @ notation (QueryDefinition.WithParameter in .NET, parameters in Python query_items) and prevent SQL injection. Results arrive in pages capped by MaxItemCount; read until no pages remain, and the continuation token, one per query, lets you resume at any time, except with GROUP BY or DISTINCT without ORDER BY.
Pagination - Query Language for Cosmos DB (in Azure and Fabric) ↗Parameterized queries - Query Language for Cosmos DB (in Azure and Fabric) ↗
A point read (ReadItemAsync in .NET, read_item in Python) looks up an item by id and the full partition key value, including every level when it is hierarchical, and is the cheapest read: its cost depends on item size and consistency level. A query that filters on id and partition key isn't a point read; ReadManyItemsAsync or read_items read many pairs at once.
Optimize Request Cost - Azure Cosmos DB ↗Read an Item Using .NET - Azure Cosmos DB ↗
CreateItemAsync fails if the id already exists, ReplaceItemAsync and patch work only on existing items, and UpsertItemAsync creates or replaces. Partial document update (patch) sends only the changed paths with Add, Set, Replace, Remove, Increment and Move, supports a conditional filter predicate and can't touch system properties; delete_item fails if the item doesn't exist.
Partial Document Update - Azure Cosmos DB ↗Create an Item Using .NET - Azure Cosmos DB ↗
Transactional batch (CreateTransactionalBatch in .NET, execute_item_batch in Python) groups operations for one partition key value with ACID guarantees: if one fails, everything is rolled back and the others return 424. Bulk support in SDK v3 (AllowBulkExecution, one task per operation) maximizes throughput across partitions without atomicity and replaces the bulk executor library.
Transactional Batch Operations - Azure Cosmos DB ↗Migrate From the Bulk Executor Library to the Bulk Support in .NET V3 SDK - Azure Cosmos DB ↗
TTL is set in seconds with DefaultTimeToLive on the container (absent or null: off; -1: on with no default expiry; n: items expire after n seconds) and can be overridden per item with the ttl property, counted from the last modification (_ts). A background task deletes expired items with leftover RUs, although they stop appearing in queries once expired.
Expire Data With Time to Live - Azure Cosmos DB ↗Configure and Manage Time to Live - Azure Cosmos DB ↗
Optimistic concurrency control uses the _etag that the server changes on every update: the client sends it as an if-match condition (IfMatchEtag in .NET, if_match_etag in Python batches) and, if it no longer matches, the write is rejected with HTTP 412 and the client must reread and retry. Stored procedures check _etag implicitly and roll back the whole transaction on a conflict.
Database Transactions and Optimistic Concurrency Control - Azure Cosmos DB ↗
Design and implement data models and partitioning strategies
Start by listing the application's read and write requests and measure each version of the model against them for latency and RUs. For read-heavy workloads, denormalize and duplicate data into containers with a different partition key, kept in sync from the change feed, and keep items that must change together in one logical partition.
How to model and partition data using a real-world example ↗Data modeling in Azure Cosmos DB for NoSQL ↗
Choose an immutable, string-typed, high-cardinality property that spreads RUs and storage evenly. In large read-heavy containers it should appear as an equality filter in most queries; /id suits workloads of point reads and writes. The key can't be changed in place: the data has to be moved to a new container.
Embed data in contained or one-to-few relationships that change infrequently, don't grow without bound and are read together; this typically improves reads. Reference for one-to-many or many-to-many relationships, frequently changing data or unbounded collections; this typically improves writes. Hybrid models denormalize only the displayed fields and store precalculated aggregates.
Provisioned throughput is divided evenly across physical partitions and a logical partition is never split, so a skewed key creates hot partitions that return 429s while capacity sits unused. Detect them with Normalized RU Consumption by PartitionKeyRangeId and CDBPartitionKeyRUConsumption, and watch storage with CDBPartitionKeyStatistics. The lasting fix is to change the key by migrating to a new container.
Diagnose and troubleshoot "Request rate too large" (429) exceptions ↗Monitor normalized request units in Azure Cosmos DB ↗
Hierarchical partition keys support up to three levels (kind MultiHash), are set when the container is created, and let a prefix such as TenantId exceed logical partition limits. Prefix queries are routed to a subset of partitions and point reads use the full key built with PartitionKeyBuilder. With few tenants or write-optimized workloads, a synthetic key or /id fits better.
Hierarchical partition keys in Azure Cosmos DB ↗Multitenancy and Azure Cosmos DB ↗
A synthetic key is an artificial property that client-side logic builds and writes into each item: by concatenating several values, by appending a random suffix to spread writes, or by appending a precalculated suffix, for example from a VIN, that lets the app rebuild the key when reading. Queries that filter on only one of its parts are cross-partition queries.
Common anti-patterns are partitioning write-heavy workloads by date, using low-cardinality fields or a key that queries never filter on, and using /id when many queries filter on other properties. A hot partition shows up in Normalized RU Consumption by PartitionKeyRangeId and in CDBPartitionKeyRUConsumption; logical partition size is watched with alerts over CDBPartitionKeyStatistics.
Partitioning and horizontal scaling - Azure Cosmos DB ↗Troubleshoot Request Rate Too Large Exceptions - Azure Cosmos DB ↗
The Azure Cosmos DB Cost Estimator projects RU/s and cost from document sizes, operation rates, capacity mode, consistency and regions. Point reads are the cheapest reads, Strong and Bounded Staleness double the cost of reads, item size and indexed properties raise write cost, and RU/s are provisioned in every region of the account.
Estimate Costs using the Cost Estimator - API for NoSQL - Azure Cosmos DB ↗Optimize Request Cost - Azure Cosmos DB ↗
Implement change feed
The change feed is enabled by default, consumes RUs from provisioned throughput and guarantees order only within a partition key value. It is read with Azure Functions, the change feed processor or the pull model, and supports notifications, materialized views, data movement, zero-downtime migrations and event sourcing.
Work with the Change Feed - Azure Cosmos DB ↗Change Feed Design Patterns - Azure Cosmos DB ↗
The change feed processor (.NET and Java only) keeps state in a lease container, polls by itself, distributes work across instances and retries failed batches. The pull model uses continuation tokens that you store, can read a single partition key and lets you control the pace, and parallelizes with FeedRange, but without automatic load balancing or an at-least-once guarantee.
Change Feed Pull Model - Azure Cosmos DB ↗Read Change Feed - Azure Cosmos DB ↗
The lease container stores state and coordinates workers; it can live in the same or another account, and a partitioned one must use /id. Instances of one deployment unit share the processorName and lease container with different instance names, several units or triggers share it with distinct names or LeaseContainerPrefix values, and the global endpoint should be used.
Change Feed Processor - Azure Cosmos DB ↗Create Multiple Independent Azure Functions Triggers - Azure Cosmos DB ↗
Latest version mode records creates and updates, only the latest version of each item and no deletes (use a soft delete with TTL), and can start from the beginning. All versions and deletes mode requires continuous backup, is enabled on an existing account, captures deletes with metadata and reads only from now, within the backup retention window.
Container copy jobs copy items into a new container to change the partition key, unique keys or throughput granularity, or to adopt hierarchical partition keys. Offline copy requires stopping writes on the source; online copy requires continuous backup and all versions and deletes mode, and is finished with az cosmosdb copy complete.
Copy jobs in Azure Cosmos DB (preview) ↗Create and manage container copy jobs in Azure Cosmos DB (Preview) ↗
Design and implement Azure Cosmos DB solutions by using AI-assisted tools
The Azure Cosmos DB Agent Kit provides recipes to review partition keys, queries and SDK code: you supply document shapes, filters, write rates, the indexing policy, RU charges or sanitized diagnostics, never credentials. Its recommendations are suggestions: compare RU, latency and results on the same data and test outside production before applying them.
Use the Azure Cosmos DB Agent Kit ↗Azure Cosmos DB Agent Kit overview ↗
The Azure Cosmos DB Agent Kit is installed with npx skills add AzureCosmosDB/cosmosdb-agent-kit or the host's plugin method, and verified by finding the cosmosdb-best-practices skill. It provides guidance, not access: it doesn't authenticate to Azure or query data; the Microsoft Learn MCP server serves documentation. Load only the relevant skill to avoid filling the context.
Set up the Azure Cosmos DB Agent Kit ↗Supported AI coding assistants for Azure Cosmos DB Agent Kit ↗