DP-3015: Get started with Azure Cosmos DB NoSQL development
Duration: 1 Day
This course teaches developers to utilize Azure Cosmos DB for NoSQL API and SDK. Students will learn query execution, resource configuration, SDK operations, and design strategies for non-relational data modeling and data partitioning.
Software engineers tasked with authoring cloud-native solutions that leverage Azure Cosmos DB for NoSQL and its various SDKs. They are familiar with C# programming. They also have experience writing code that interacts with a SQL or NoSQL database platform.
Introduction to Azure Cosmos DB for NoSQL
Learn about the Azure Cosmos DB for NoSQL and determine if it is a good fit for your application.
- What is Azure Cosmos DB for NoSQL
- How does Azure Cosmos DB for NoSQL work
- When should you use Azure Cosmos DB for NoSQL
Try Azure Cosmos DB for NoSQL
Learn how to use the Azure Cosmos DB for NoSQL to create an account, and then use the account to create Cosmos DB resources.
- Explore resources
- Review basic operations
- Exercise: Create an Azure Cosmos DB for NoSQL account
- Knowledge check
Plan Resource Requirements
Familiarize yourself with the various configuration options for a new Azure Cosmos DB for NoSQL account.
- Understand throughput
- Evaluate throughput requirements
- Evaluate data storage requirements
- Time-to-live (TTL)
- Plan for data retention with time-to-live (TTL)
Configure Azure Cosmos DB for NoSQL
Select between the various throughput offerings in Azure Cosmos DB for NoSQL.
- Serverless
- Compare serverless vs. provisioned throughput
- Autoscale throughput
- Compare autoscale vs. standard (manual) throughput
- Migrate between standard (manual) and autoscale throughput
- Exercise: Configure throughput for Azure Cosmos DB for NoSQL with the Azure portal
Move data into and out of Azure Cosmos DB for NoSQL
Migrate data into and out of Azure Cosmos DB for NoSQL using Azure services and open-source solutions.
- Move data by using Azure Data Factory
- Move data by using a Kafka connector
- Move data by using Stream Analytics
- Move data by using the Azure Cosmos DB Spark connector
- Exercise: Migrate existing data using Azure Data Factory
Use the Azure Cosmos DB for NoSQL SDK
Learn about the Azure Cosmos DB libraries, and then download the libraries to use in a .NET, Python, or JavaScript (Node.JS) application.
- Understand the SDK
- Import from package manager
- Connect to an online account
- Implement client singleton
- Configure connectivity mode
- Exercise: Connect to Azure Cosmos DB for NoSQL with the SDK
Configure the Azure Cosmos DB for NoSQL SDK
Learn how to configure the Azure Cosmos DB for NoSQL SDK in various ways including how to integrate with the emulator, implement parallelism, and create a custom logger.
- Enable offline development
- Handle connection errors
- Implement threading and parallelism
- Configure logging
- Exercise: Configure the Azure Cosmos DB for NoSQL SDK for offline development
Implement Azure Cosmos DB for NoSQL point operations
Write code to create, read, update, and delete items in Azure Cosmos DB for NoSQL.
- Understand point operations
- Create documents
- Read a document
- Update documents
- Configure time-to-live (TTL) value for a specific document
- Delete documents
- Exercise: Create and update documents with the Azure Cosmos DB for NoSQL SDK
Perform cross-document transactional operations with the Azure Cosmos DB for NoSQL
Perform operations on multiple items in single logical units of work.
- Create a transactional batch with the SDK
- Review batch operation results with the SDK
- Exercise: Batch multiple point operations together with the Azure Cosmos DB for NoSQL SDK
- Implement optimistic concurrency control
Process bulk data in Azure Cosmos DB for NoSQL
Perform bulk operations on Azure Cosmos DB in bulk from code using the SDK.
- Create bulk operations with the SDK
- Review bulk operation caveats
- Implement bulk best practices
- Exercise: Move multiple documents in bulk with the Azure Cosmos DB for NoSQL SDK
Query the Azure Cosmos DB for NoSQL
Author queries for Azure Cosmos DB for NoSQL using the SQL query language.
- Understand NoSQL query language
- Create queries with NoSQL
- Project query results
- Implement type-checking in queries
- Use built-in functions
- Execute queries in the SDK
- Exercise: Execute a query with the Azure Cosmos DB for NoSQL SDK
Author complex queries with the Azure Cosmos DB for NoSQL
Create SQL queries for Azure Cosmos DB for NoSQL that uses subqueries or cross-products.
- Create cross-product queries
- Implement correlated subqueries
- Implement variables in queries
- Paginate query results
- Exercise: Paginate cross-product query results with the Azure Cosmos DB for NoSQL SDK
Build Generative AI applications with Azure Cosmos DB
Build advanced Generative AI application with Python and Azure Cosmos DB for NoSQL.
- Configure the Vector Search and storage feature of Azure Cosmos DB NoSQL
- Exercise - Enable the Azure Cosmos DB for NoSQL Vector Search feature
- Generate embeddings using Azure OpenAI Service
- Exercise - Generate vector embeddings with Azure OpenAI and store them in Azure Cosmos DB for NoSQL
- Build Generative AI applications with Azure Cosmos DB NoSQL and Python
- Perform vector searches using Azure Cosmos DB for NoSQL from a Generative AI application
- Exercise - Build a Generative AI application with Python and Azure Cosmos DB for NoSQL
- Integrate LangChain orchestration to improve efficiency and code maintainability in a Python Generative AI application
- Exercise - Implement RAG with LangChain and Azure Cosmos DB for NoSQL Vector Search
Define indexes in Azure Cosmos DB for NoSQL
Discover indexes and indexing policies in Azure Cosmos DB for NoSQL.
- Understand indexes
- Understand indexing policies
- Review indexing policy strategies
- Exercise: Review the default index policy for an Azure Cosmos DB for NoSQL container with the portal
Customize indexes in Azure Cosmos DB for NoSQL
Customize indexing policies for a container in Azure Cosmos DB for NoSQL.
- Customize the indexing policy
- Evaluate composite indexes
- Exercise: Configure an Azure Cosmos DB for NoSQL container's index policy with the portal
Consume an Azure Cosmos DB for NoSQL change feed using the SDK
Process change feed events using the change feed processor in the Azure Cosmos DB for NoSQL .NET SDK.
- Understand change feed features in the SDK
- Implement a delegate for the change feed processor
- Implement the change feed processor
- Implement the change feed estimator
- Exercise: Process change feed events using the Azure Cosmos DB for NoSQL SDK
Handle events with Azure Functions and Azure Cosmos DB for NoSQL change feed
Use Azure Functions bindings to integrate a function with Azure Cosmos DB for NoSQL.
- Understand Azure Function bindings for Azure Cosmos DB for NoSQL
- Configure function bindings
- Develop function
- Exercise: Process Azure Cosmos DB for NoSQL data using Azure Functions
Search Azure Cosmos DB for NoSQL data with Azure Cognitive Search
Index Azure Cosmos DB for NoSQL data with Azure Cognitive Search.
- Create an indexer for data in Azure Cosmos DB for NoSQL
- Implement a change detection policy
- Manage a data deletion detection policy
- Exercise - Search data using Azure Cognitive Search and Azure Cosmos DB for NoSQL
Implement a non-relational data model
Identify an application’s key access patterns. Define the entities’ data model, along with containers to store the data with a partition key that will result in an efficient and scalable data store for the application.
- What's the difference between NoSQL and relational databases?
- Identify access patterns for your app
- When to embed or reference data
- Exercise: Measure performance for customer entities
- Choose a partition key
- Model small lookup entities
Design a data partitioning strategy
Identify strategies for managing relationships between data entities, such as customers and sales data. Improve data-model performance and scaling by pre-aggregating and denormalizing your data. Use change-feed to maintain your data's referential integrity.
- Denormalize data in your model
- Manage referential integrity by using change feed
- Combine multiple entities in the same container
- Denormalize aggregates in the same container
- Finalize the data model
- Exercise advanced modeling patterns
Configure replication and manage failovers in Azure Cosmos DB
Replicate data across the globe and manage automatic or manual failovers in Azure Cosmos DB.
- Understand replication
- Distribute data across regions
- Evaluate the cost of distributing data globally
- Define automatic failover policies
- Perform manual failovers
- Configure SDK region
- Exercise: Connect different regions with the Azure Cosmos DB for NoSQL SDK
Use consistency models in Azure Cosmos DB for NoSQL
Configure consistency on a sliding scale for Azure Cosmos DB for NoSQL.
- Understand consistency models
- Configure default consistency model in the portal
- Change consistency model with the SDK
- Use session tokens
- Exercise: Configure consistency models in the portal and the Azure Cosmos DB for NoSQL SDK
Configure multi-region write in Azure Cosmos DB for NoSQL
Write data to multiple regions using Azure Cosmos DB for NoSQL.
- Understand multi-region write
- Configure multi-region support in the SDK
- Understand conflict resolution policies
- Create custom conflict resolution policy
- Exercise: Connect multi-region write account with the Azure Cosmos DB for NoSQL SDK
Customize an indexing policy in Azure Cosmos DB for NoSQL
Tune the indexing policy based on your SQL queries in Azure Cosmos DB for NoSQL.
- Index usage
- Review read-heavy index patterns
- Review write-heavy index patterns
- Exercise - Optimize an Azure Cosmos DB for NoSQL container's index policy for common operations
Measure index performance in Azure Cosmos DB for NoSQL
Measure the performance of an indexing policy in Azure Cosmos DB for NoSQL.
- Enable indexing metrics
- Analyze indexing metrics results
- Measure query cost
- Measure point operation cost
- Exercise - Optimize an Azure Cosmos DB for NoSQL container's index policy for a specific query
Implement integrated cache in Azure Cosmos DB for NoSQL
Implement, configure, and monitor integrated cache in Azure Cosmos DB for NoSQL.
- Review workloads that benefit from the cache
- Enable integrated cache
- Configure cache staleness
Measure performance in Azure Cosmos DB for NoSQL
We learn to use Azure Monitor to create and analyze monitoring data for Azure Cosmos DB.
- Understand Azure Monitor
- Measure throughput
- Observe rate-limiting events
- Query logs
- Exercise: Use Azure Monitor to analyze an Azure Cosmos DB for NoSQL account
Monitor responses and events in Azure Cosmos DB for NoSQL
We will learn to use a rich set of REST response codes returned by Azure Cosmos DB request to help you analyze potential issues.
- Review common response codes
- Understand transient errors
- Review rate-limiting errors
- Configure Alerts
- Audit security
- Exercise: Troubleshoot an application using the Azure Cosmos DB for NoSQL SDK
Implement backup and restore for Azure Cosmos DB for NoSQL
We'll learn to use the two backup models Azure Cosmos DB provides.
- Evaluate periodic backup
- Configure continuous backup and recovery
- Perform a point-in-time recovery
- Exercise - Recover a database or container from a recovery point
Implement security in Azure Cosmos DB for NoSQL
We will learn the different security models that Azure Cosmos DB uses.
- Implement network-level access control
- Review data encryption options
- Use role-based access control (RBAC)
- Access account resources using Microsoft Entra ID
- Understand Always Encrypted
- Exercise: Store Azure Cosmos DB for NoSQL account keys in Azure Key Vault
Write management scripts for Azure Cosmos DB for NoSQL
Learn how to manage Azure Cosmos DB for NoSQL accounts, databases, and containers using the Azure CLI.
- Create resources
- Manage index policies
- Configure database or container-provisioned throughput
- Migrate between standard and autoscale throughput
- Change region failover priority
- Initiate failovers
- Exercise: Adjust provisioned throughput using an Azure CLI script
Create resource template for Azure Cosmos DB for NoSQL
Learn about automated Azure Cosmos DB for NoSQL resource deployments using the Azure Resource Manager with JSON and Bicep templates.
- Understand Azure Resource Manager resources
- Author Azure Resource Manager templates
- Configure database or container resources
- Configure throughput with an Azure Resource Manager template
- Manage index policies through Azure Resource Manager templates
- Exercise: Create an Azure Cosmos DB for NoSQL container using Azure Resource Manager templates
Build multi-item transactions with the Azure Cosmos DB for NoSQL
Author stored procedures using JavaScript in Azure Cosmos DB for NoSQL.
- Understand transactions in the context of JavaScript SDK
- Author Stored procedures
- Rollback transactions
- Create stored procedures with the JavaScript SDK
- Exercise: Create a stored procedure with the Azure portal
Expand query and transaction functionality in Azure Cosmos DB for NoSQL
Author user-defined functions and triggers using JavaScript in Azure Cosmos DB for NoSQL.
- Create user-defined functions
- Create user-defined functions with the SDK
- Add triggers to an operation
- Create and use triggers with the SDK
- Exercise: Implement and use user defined functions with the Azure Cosmos DB SDK