DP-420 Hands-On Labs
DP-420 asks what a request costs, which partition a query reaches, and what the SDK does when two writers collide. Those answers stick once you have seen them in a lab. The official DP-420 courseware from Microsoft Learning includes 20 labs for the new outline. They are all listed here, grouped by exam domain and objective. Most come in both C# and Python, so choose the language you know best.
Lab titles, descriptions, and durations come from the MicrosoftLearning/dp-420-cosmos-db-dev repository, and each lab opens in its official instructions. The labs are published and maintained by Microsoft Learning.
Before you start#
- Create a lab resource group so every lab resource lives in one place and you can delete it all at once.
- Set up the lab environment if you prefer your own computer to a hosted lab environment. It lists the tools to install, including the .NET 8 SDK, Git, Visual Studio Code, and the Azure Cosmos DB emulator.
Keep costs down
The labs create real Azure resources. Use a subscription where you can create and delete resource groups, and delete the lab resource group when you finish so it does not keep costing money. Between labs, the free Azure Cosmos DB emulator runs locally, as a Linux-based Docker container or a Windows installation, and is ideal for trying the SDK patterns and queries on this site at no cost. See Develop locally with the emulator.
Domain 1: Design and develop database solutions
8 labs · about 5 hr 15 min in total
Create an Azure Cosmos DB for NoSQL account
Provision an Azure Cosmos DB for NoSQL account and create a database, container, and items.
Configure throughput and consistency
Configure autoscale throughput, set default and per-request consistency, and configure time to live, observing the effects on cost and behavior.
Connect an app to Azure Cosmos DB
Import the SDK, create a singleton client, run against the emulator, switch to a cloud account, and add basic logging and error handling.
Implement Data Operations
Perform point reads, writes, a conditional patch, an ETag-guarded replace, item time to live, a transactional batch, and a bulk load, comparing request-unit costs.
Author and Page Queries
Load the CosmicWorks catalog, write parameterized and projected queries with built-in functions, add a correlated subquery and a cross-product query, and page results with continuation tokens.
Design a model and partition strategy
Model the CosmicWorks entities for a set of access patterns, create a container with a hierarchical partition key, and validate that prefix queries route efficiently.
Process changes and copy data
Run a change feed consumer against a lease container, react to changes with an Azure Functions trigger, and copy a container onto a new partition key with a copy job.
Inspect Azure Cosmos DB with Azure MCP Server
Use Azure MCP Server in Visual Studio Code to inspect the CosmicWorks catalog, query items, and verify the tool calls and results.
Domain 2: Secure, optimize, and deploy database solutions
7 labs · about 5 hr 15 min in total
Secure an account
Secure an Azure Cosmos DB for NoSQL account with Microsoft Entra authentication, a managed identity, scoped data-plane roles, and network access restrictions.
Recover from a recovery point
Enable continuous backup on an Azure Cosmos DB for NoSQL account, delete a product and its container, and restore both to a recorded point in time.
Configure Regions and Failover
Read the region topology of a two-region Azure Cosmos DB account, change its write region, enable multi-region writes, and take a region offline with a forced failover.
Optimize an indexing strategy
Measure a baseline, trim an indexing policy, add a composite index, and create a global secondary index, comparing the request charge after each change.
Tune a high-cost query
Baseline three operations against a product catalog, prove a scan with query metrics, rewrite the filter so the index serves it, add a composite index, and compare fan-out with single-partition routing.
Diagnose throttling and configure an alert
Enable diagnostic logging, drive a container past its provisioned throughput, confirm the rate limiting from client diagnostics, Azure Monitor metrics, and Log Analytics, then create an alert rule.
Create a fleet and a pooled fleetspace, enroll two Azure Cosmos DB accounts, read pool and dedicated throughput in Azure Monitor, and send fleet analytics to Data Lake Storage Gen2.
Domain 3: Implement AI and analytics capabilities in database solutions
5 labs · about 3 hr 45 min in total
Build Native Search Over a Product Catalog
Load the CosmicWorks catalog with searchable text and embeddings, run BM25 and VectorDistance queries against one container, and refresh a stale embedding from the change feed.
Build and Tune Hybrid Search
Load a catalog with searchable text and embeddings, measure keyword and semantic retrieval separately, fuse them with RRF, weight the fusion, and optimize the query against measured request charges.
Build a grounded RAG assistant
Load the CosmicWorks catalog with embeddings, compare an ungrounded answer with a grounded one, test the refusal path, and observe what a prompt does with an instruction planted in retrieved data.
Build a durable agent memory store
Write conversation turns that expire on their own, distill durable facts and embed them, recall one by meaning in a new session, measure what memory costs in a prompt, then supersede a contradiction and erase the user.
Mirror an Azure Cosmos DB database and query it in Microsoft Fabric
Grant the custom role mirroring needs, mirror a database into Microsoft Fabric, read the replication status, query the mirrored tables with T-SQL including nested JSON, watch a change replicate, and read the same tables from Spark.
Go further#
The Azure Cosmos DB Workshop from the Azure Cosmos DB team adds more .NET practice on querying, indexing, multi-document transactions, the change feed, performance troubleshooting, and optimistic concurrency. It predates the current product names, so read “SQL API” as Azure Cosmos DB for NoSQL, and expect older SDK and tool versions than the official labs use.
