DP-420 Practice

12 DP-420 Scenarios, Sorted by Difficulty

DP-420 (Building AI Applications with Azure Cosmos DB) rewards knowing which mechanism fits a scenario (partition key design, consistency level, change feed, vector or hybrid search, Fabric mirroring), not memorized definitions. These 12 questions are split into Easy, Medium, and Hard tiers so you can gauge exactly where your gap is before booking the exam.

By MSCertQuiz Team•Updated October 2026•16 min read

Updated for the October 6, 2026 exam change

DP-420 is now Building AI Applications with Azure Cosmos DB, and passing it earns Microsoft Certified: Azure Cosmos DB AI Developer Associate (replacing the Azure Cosmos DB Developer Specialty). The skills outline has three domains: Design and develop database solutions (40–45%); Secure, optimize, and deploy database solutions (30–35%); and Implement AI and analytics capabilities in database solutions (20–25%). Server-side JavaScript, data movement, DevOps, and Synapse Link are out; vector, full-text and hybrid search, RAG, agent memory, and Microsoft Fabric mirroring are in. These 12 questions follow that split: 5, 4, and 3 per domain.

If you clear the Easy tier but stumble in Medium, focus your remaining study time on partition key design, change feed patterns, indexing policy, and backup modes. If Hard is where you lose points, it is usually hierarchical partition keys, RBAC versus keys, hybrid search with RRF, or Fabric mirroring. Those topics reward comparing two valid-sounding options against one specific constraint in the scenario.

For the full domain breakdown and study plan, see the DP-420 study guide.

Easy — Foundational Cosmos DB Decisions

Question 1Easy

A retail application needs single-digit-millisecond reads and can tolerate reading data that is a few writes behind, but each client must see its own prior writes when it reads them back. Which default consistency level fits without application-side changes and at the lowest read RU cost?

A. Strong
B. Session
C. Bounded Staleness
D. Eventual
Reveal Answer & Explanation

Correct Answer: B

Session consistency guarantees read-your-own-writes, monotonic reads and monotonic writes within a client session, and it is the default level for Azure Cosmos DB accounts. Session reads are served from a single replica (using the session token), so a read costs the same RUs as Eventual. Strong and Bounded Staleness both read from two replicas (a local minority quorum), which doubles the RU cost of every read; they deliver more guarantee than the scenario needs at twice the read cost. Eventual has the same single-replica read cost as Session but gives no read-your-own-writes guarantee, which the scenario explicitly requires.

Question 2Easy

A container stores shopping cart documents that should be deleted automatically 24 hours after their last update, without any application code running a cleanup job. What should you configure?

A. A change feed processor that deletes carts older than 24 hours
B. A timer-triggered Azure Function that queries and deletes old carts
C. A nightly SDK bulk-delete job that removes expired carts
D. Time to live (TTL) on the container with a default of 86,400 seconds
Reveal Answer & Explanation

Correct Answer: D

Time to live is a built-in Azure Cosmos DB feature: set a default TTL in seconds on the container (86,400 for 24 hours) and the service deletes items automatically, counting from each item's last-modified timestamp, with no delete issued by the client. Expired items stop appearing in query results immediately, and on provisioned throughput the background deletion uses leftover RUs. You can also override the default per item. A change feed processor reacts to inserts and updates; it is not an expiry mechanism, so you would still be writing and hosting your own delete logic. A timer-triggered Azure Function and a nightly SDK bulk-delete job both mean writing and running cleanup code, which the scenario rules out, and both also leave carts in place between runs.

Question 3Easy

An AI agent stores each conversation turn as an item that includes an embedding of the turn's text, in a container partitioned by threadId with a vector embedding policy and vector index on /embedding. To ground the next response, the agent runs SELECT TOP 5 c.content FROM c WHERE c.threadId = @threadId and must return the five earlier turns in this thread that are most semantically similar to the user's new question. Which ORDER BY clause completes the query?

A. ORDER BY c.timestamp DESC
B. ORDER BY RANK FullTextScore(c.content, @keywords)
C. ORDER BY VectorDistance(c.embedding, @queryVector)
D. ORDER BY ST_DISTANCE(c.embedding, @queryVector)
Reveal Answer & Explanation

Correct Answer: C

VectorDistance compares the stored embedding with the embedding of the new question, so ordering by it returns the turns closest in meaning, even when they share no exact words. This is the semantic-memory retrieval pattern Microsoft documents for agent memories, and filtering on threadId keeps the search inside one logical partition. Ordering by c.timestamp DESC returns the most recent turns, which suits rebuilding chat history but ranks by recency, not relevance. FullTextScore ranks by BM25 keyword relevance, so it matches shared terms rather than meaning, and it needs a full-text index on the property. ST_DISTANCE measures distance between GeoJSON geometries such as points and polygons; it is a geospatial function, not a vector-similarity function.

Question 4Easy

A company requires its Azure Cosmos DB for NoSQL account to accept connections from its applications over a private IP address in its Azure virtual network, and to reject public internet traffic even if someone later adds an IP firewall rule. What should you configure?

A. A private endpoint in the virtual network, with public network access set to Disabled
B. A virtual network service endpoint on the app subnet, with a matching virtual network rule
C. An IP firewall rule that allows the virtual network's outbound public IP address
D. The firewall option to accept connections from within public Azure datacenters
Reveal Answer & Explanation

Correct Answer: A

A private endpoint gives the account a private IP address from the virtual network's address space, and setting publicNetworkAccess to Disabled blocks all public and virtual network traffic. That flag takes precedence over any IP or virtual network rule, so a firewall rule added later cannot reopen public access. A virtual network service endpoint restricts access to a subnet, but the account is still reached through its public IP addresses rather than a private one. An IP firewall rule for the virtual network's outbound public IP keeps the account on the public endpoint and does nothing to block future rules. Accepting connections from within public Azure datacenters allows requests from any Azure subscription, including other customers' resources, which widens access instead of restricting it.

Halfway through

The Medium and Hard tiers are where DP-420 actually differs from DP-900

40 free practice questions, same difficulty range, no credit card required.

Start Free Practice →

Medium — Applied Design Decisions

Question 5Medium

A telemetry application ingests readings from 50,000 IoT devices. Over the retention period, a single device accumulates well over 20 GB of readings, and nearly every query requests one device's readings for one calendar day. The container must use a single-path partition key rather than a hierarchical key. Which partition key fits?

A. A synthetic key that concatenates deviceId and the reading date
B. deviceId by itself, so each device maps to one logical partition
C. The reading date by itself, so each day maps to one logical partition
D. The reading date with a random suffix from 1 to 400 appended
Reveal Answer & Explanation

Correct Answer: A

A synthetic key such as deviceId plus date is built by concatenating property values into one partitionKey property. Each device-day becomes its own logical partition, which keeps every logical partition well under the 20 GB limit and spreads writes across many partitions. Because the dominant query supplies both the device and the day, the query can still be routed to a single partition. deviceId by itself matches the query filter, but each device would exceed the 20 GB per-logical-partition limit during the retention period. The reading date by itself sends every device's writes for the day to the same logical partition, the hot-partition pattern Microsoft warns against for time-based keys. A date with a random suffix spreads writes well, but a query for one device has no way to know which of the 400 suffixes holds its readings, so it fans out across partitions.

Question 6Medium

An e-commerce platform stores orders in one container and needs a denormalized customer order summary kept up to date in a second container whenever an order is created or updated, without the order-writing service knowing anything about the summary container. Which approach fits?

A. An Azure Function using the Azure Cosmos DB trigger on the orders container
B. A stored procedure on the orders container that also writes the summary
C. The order-writing service also writing the summary in the same request
D. A scheduled batch job that recomputes the summaries once per day
Reveal Answer & Explanation

Correct Answer: A

The Azure Functions trigger for Azure Cosmos DB reads the orders container's change feed, using a lease container to track progress, and runs your function for every insert and update. Using the change feed to denormalize data across containers is a documented change feed design pattern, and it keeps the order service fully decoupled (with eventual consistency for the summary). A stored procedure is registered on one container and its execution is scoped to a single logical partition key, so it cannot write into a different container. Having the order-writing service also write the summary couples the two directly in application code, which the scenario rules out. A daily scheduled batch job leaves summaries up to a day out of date, which fails the requirement to stay current whenever an order changes.

Question 7Medium

A container holds documents with a large internalNotes array that is never queried, but the default indexing policy indexes it on every write, inflating write RU cost. What is the most direct fix?

A. Move internalNotes into a separate container
B. Add /internalNotes/* to the excluded paths of the indexing policy
C. Switch the container's indexing mode from consistent to lazy
D. Reduce the container's provisioned throughput
Reveal Answer & Explanation

Correct Answer: B

The default indexing policy indexes every property of every item. Excluding a path in a custom indexing policy stops that subtree from being indexed, and Microsoft documents that reducing the number of indexed paths substantially lowers the latency and RU charge of writes, while every other property stays indexed and queryable. Moving internalNotes into a separate container is a data-model change with a much larger blast radius than editing the indexing policy. Lazy indexing updates the index at low priority, which can return inconsistent or incomplete query results, and new containers cannot select it. Reducing provisioned throughput does not lower the RU cost of a write; it lowers the RUs available per second, which leads to throttling.

Question 8Medium

A healthcare application must be able to restore a container to its exact state at any chosen second within the past 7 days, for compliance investigations, using a self-service restore. Which backup configuration meets this?

A. Periodic backup with a 4-hour interval and 2 retained copies
B. A second read region added to the account for geo-redundancy
C. A daily container copy job into a separate archive container
D. Continuous backup mode with point-in-time restore
Reveal Answer & Explanation

Correct Answer: D

Continuous backup mode lets you restore to any point in time within the configured retention tier (7, 30, or 35 days) through self-service restore in the portal, PowerShell, or CLI, which satisfies an arbitrary second within the past 7 days. Its 7-day tier carries no backup storage charge. Periodic backup with a 4-hour interval can only restore to the moments its backups captured, and periodic restores are requested through the support team rather than run by you. A second read region replicates every write, including bad ones, so it provides availability, not a way back to an earlier state. A daily container copy job captures one snapshot per day, so it cannot reach an arbitrary second between copies.

Hard — Partitioning at Scale, Access Control, and AI Retrieval

Question 9Hard

A multi-tenant SaaS container uses /tenantId as its partition key. One enterprise tenant now stores more than 20 GB and needs more than 10,000 RU/s, while the other tenants are small. The team will create a replacement container and migrate the data with a container copy job. Which partition key design should the new container use so that queries scoped to one tenant stay efficient?

A. /id by itself, so each item becomes its own logical partition
B. A hierarchical partition key of /tenantId, then /userId, then /id
C. /tenantId again, with autoscale configured for a higher maximum RU/s
D. A synthetic key that concatenates tenantId and userId into one value
Reveal Answer & Explanation

Correct Answer: B

Hierarchical partition keys support up to three levels. With /tenantId, then /userId, then /id, a tenant's data can span multiple physical partitions, so a single tenantId prefix can exceed 20 GB and 10,000 RU/s, and queries that filter on tenantId are routed only to the partitions that hold that tenant. Hierarchical keys cannot be added to an existing container, which is why the plan to create a new container and use a container copy job is correct. Using /id by itself spreads data perfectly, but every query that filters by tenant becomes a cross-partition query. Keeping /tenantId with a higher autoscale maximum does not lift the per-logical-partition limits of 20 GB and 10,000 RU/s. A synthetic tenantId plus userId key avoids the size limit, but queries for a whole tenant become cross-partition unless every user is known and listed in advance.

Question 10Hard

A financial application must let a reporting service read Azure Cosmos DB data without the service ever holding the account's primary or secondary keys, and access must be revocable per identity through Microsoft Entra ID. What should you configure?

A. Rotation of the primary key on a fixed schedule
B. A resource token scoped to the reporting container
C. Data plane RBAC for the service's managed identity, with key-based auth disabled
D. The primary key stored in Azure Key Vault and read by the service
Reveal Answer & Explanation

Correct Answer: C

Data plane role-based access control lets you assign a role such as Cosmos DB Built-in Data Reader to the reporting service's managed identity, which authenticates with Microsoft Entra ID instead of a key. Removing the role assignment revokes that identity alone, and disabling key-based authentication (disableLocalAuth) makes sure no client can fall back to account keys. Rotating the primary key still depends on distributing keys and revokes every key holder at once, not one identity. A resource token comes from Azure Cosmos DB's own users-and-permissions model: it is a time-bound token that your code must issue and refresh, not an identity managed in Microsoft Entra ID. Storing the primary key in Azure Key Vault protects it at rest, but the service still retrieves and holds the full account key, which the requirement forbids.

Question 11Hard

A support assistant uses RAG over a container of troubleshooting articles that has a vector policy, a vector index, a full-text policy and a full-text index. Users type exact error codes such as ERR-4012 as well as natural-language descriptions, and pure vector search ranks articles that contain the exact code too low. The retrieval step must return one ranked list that combines keyword relevance with semantic similarity. Which query approach fits?

A. A pure vector query with VectorDistance and a larger TOP value
B. WHERE FullTextContains on the error code, then ORDER BY VectorDistance
C. Separate vector and full-text queries, with results appended client-side
D. SELECT TOP k with ORDER BY RANK RRF(VectorDistance(...), FullTextScore(...))
Reveal Answer & Explanation

Correct Answer: D

Hybrid search in Azure Cosmos DB for NoSQL uses the RRF (Reciprocal Rank Fusion) function in an ORDER BY RANK clause to merge the VectorDistance ranking with the BM25 FullTextScore ranking into a single list, and you can pass weights to favor either side. Hybrid queries need a TOP (or LIMIT) clause. A pure vector query with a larger TOP value returns more results but still ranks purely by semantic similarity, so articles with the exact code stay low. A WHERE FullTextContains filter is a yes-or-no match: it drops every article without the literal term, which breaks the natural-language queries that contain no code. Running separate queries and appending the results client-side produces two lists stitched together rather than one fused ranking.

Question 12Hard

Analysts need T-SQL and Spark access to near-real-time operational data from an Azure Cosmos DB for NoSQL account, without building an ETL pipeline and without consuming the request units provisioned for the transactional workload. What should you set up?

A. Azure Synapse Link with the analytical store enabled on each container
B. A change feed processor that writes each change to a Fabric lakehouse
C. Mirroring into Microsoft Fabric, with continuous backup enabled on the account
D. An extra read region that the analysts query with cross-partition queries
Reveal Answer & Explanation

Correct Answer: C

Mirroring Azure Cosmos DB into Microsoft Fabric continuously replicates inserts, updates and deletes into OneLake in Delta format with no ETL and without consuming the RUs allocated to transactional workloads. Analysts can then query the mirrored data with T-SQL in the SQL query editor or with Spark. Continuous backup is a prerequisite, and the 7-day tier is free. Azure Synapse Link and the analytical store are a separate, deprecated path; Microsoft states that mirroring does not use the analytical store or Synapse Link. A change feed processor writing to a lakehouse is exactly the custom pipeline the scenario rules out, and change feed reads consume RUs on the monitored container. An extra read region still serves queries from the transactional engine, so every analytical query keeps consuming request units.

If You Missed More Than 2-3 Questions

A miss rate above 2-3 out of 12 is a signal, not a verdict. Where your misses cluster tells you what to study next:

Missed mostly Easy or Medium questions

You likely need more hands-on time with the platform itself. Consistency levels, TTL, change feed triggers, indexing policies, and backup modes are configuration mechanics, and reading about them is not the same as having set them up.

Missed mostly Hard questions

You know the mechanics but not the tradeoffs. Hierarchical partition keys, RBAC versus keys, hybrid search with RRF, and Fabric mirroring all ask you to rule out options that sound right but miss one constraint in the scenario. Timed practice helps more than re-reading definitions.

Missed the AI and analytics questions

This is the newest domain (20–25%). Build a small container with a vector policy, vector index and full-text index, then run VectorDistance, FullTextScore and RRF queries yourself, and set up a Fabric mirror of a test account.

These 12 Are a Sample of 500

MSCertQuiz DP-420 covers all 3 domains in practice mode and a timed exam simulation.

40 questions free to start — no credit card required.

Start Free Practice →

Continue Your DP-420 Prep