Azure Cosmos DB is a globally distributed, multi-model database service built for handling semi-structured data such as JSON documents. It provides automatic indexing, rich query capabilities, and tunable performance, all while scaling across regions. The service is designed to meet requirements for throughput, latency, consistency, and query flexibility, making it a central choice for storing semi-structured data in Azure.
Azure Cosmos DB offers several APIs, each optimized for different data models and existing application ecosystems. The SQL API lets you query JSON documents using a SQL-like syntax, which is the most common choice for new applications. The MongoDB API allows applications that already use MongoDB to connect to Cosmos DB with minimal code changes. The Cassandra API supports Cassandra-compatible workloads, while the Gremlin API is used for graph-based data.
Partitioning is the key to distributing data evenly across physical partitions. Choose a partition key with high cardinality—many unique values—so that no single partition becomes a hotspot. The partition key is part of every document and determines how writes and reads are distributed across the underlying physical storage. Indexing is automatic by default, but you can tune the indexing policy to include or exclude paths, or to use composite indexes for complex queries, which reduces throughput cost and improves query performance.
Throughput is measured in Request Units (RUs) per second and can be provisioned at the database or container level. You can scale throughput up or down manually, or configure autoscale to handle dynamic workloads. For workloads with unpredictable traffic, serverless mode is available, where you pay only for the RUs consumed, with no minimum provisioning. This mode is ideal for development, test, or low-traffic scenarios, whereas provisioned throughput is better for predictable production performance.
Azure Cosmos DB offers five consistency levels that form a spectrum from strongest to weakest. Strong consistency guarantees that reads always see the latest write, but it adds latency because writes must be acknowledged by all replicas. Bounded staleness allows reads to lag behind writes by a configurable time interval or version count, reducing latency while providing a predictable bound. Session consistency is the default option and ensures that reads see the writes from that same session, while Consistent prefix guarantees reads never see out-of-order writes. Finally, Eventual consistency gives the lowest latency and highest throughput without any ordering guarantees.
Cost in Azure Cosmos DB comes from two main components: provisioned throughput and data storage. Throughput cost depends on the operations you perform—such as reads, writes, and queries—as well as the size of the documents. Storage cost is based on the amount of data you store, including its automatic indexes. Denormalizing data can improve read performance, but you must evaluate the trade-off between the throughput savings and the additional storage expense of duplicate records.
When designing your data model, store data in JSON format to keep documents small and queries efficient. Design tables and partitions so that frequent updates or queries target the same partition, which allows atomic batch transactions. Implement retry policies for transient errors such as rate limiting, but do not retry non-retryable errors without proper handling. For operations that span multiple documents, use transactional batch operations within the same partition key to maintain consistency.
Azure Blob Storage is a general-purpose object storage service for massive amounts of unstructured data like images, videos, and backups. It organizes data as simple objects inside containers and offers data tiering to save money based on how often you need to access it. You can store data in the hot, cool, or archive tiers, where colder tiers cost less for storage but more for access. This service is often the best choice for straightforward storage needs where the main goal is to store large volumes of data cheaply.
Azure Data Lake Storage Gen2 builds on Azure Blob Storage but adds features specifically for big data analytics. Its most important feature is a hierarchical namespace, which organizes files into a folder structure like a traditional file system. This directory structure makes it much faster for analytics engines like Azure Databricks or Synapse to process huge datasets. Security is tightly integrated with Azure Active Directory and POSIX-compliant access control lists to manage permissions at the file and folder level.
While primarily a database, Azure Cosmos DB can also host unstructured data when the data is part of a live, global application requiring fast reads and writes. Its core strength is global distribution, which automatically replicates your data across many Azure regions to ensure low-latency access for users anywhere in the world. This database is optimal for workloads that need millisecond response times, such as real-time IoT data or global user profiles. However, it is more expensive than standard storage services, so you should choose it only when fast performance and global reach are critical.
Choosing the right service involves weighing trade-offs across several design dimensions. For scalability, all three services handle massive volumes, but Data Lake Storage Gen2 is optimized for scaling out analytics workloads, while Cosmos DB scales for global transactional workloads. Access patterns also differ: Blob Storage is perfect for long-term retention with rare access, Cosmos DB excels at constant, low-latency transactional access, and Data Lake Storage Gen2 is built for high-speed analytical queries. Finally, Blob Storage uses a flat namespace, Data Lake Storage Gen2 uses a hierarchical namespace, and Cosmos DB organizes data into databases and containers.
Balancing features and performance requires matching your application's access patterns to the underlying architecture. Azure Blob Storage works best when you simply need to store and retrieve files without complex queries, securing data through automatic encryption. Azure Data Lake Storage Gen2 fits analytics or machine learning on massive datasets because its hierarchical namespace allows analytics tools to skip directly to the required data. Meanwhile, Azure Cosmos DB excels when applications require global distribution and extremely low latency for transactional workloads.
Choosing a storage tier directly affects operational expenses and system capabilities. In Blob Storage, you can lower costs by moving infrequently accessed files from hot to cool or archive tiers. For Cosmos DB, you can scale costs based on provisioned throughput or use serverless mode to only pay for actual consumption during unpredictable traffic. Ultimately, selecting a service requires evaluating data access frequency, security parameters, and whether traffic patterns are steady or spiky.
Azure provides multiple options to ensure data durability and high availability across physical boundaries. Zone-Redundant Storage (ZRS) replicates data synchronously across three availability zones within a region to safeguard against datacenter-level failures. For geographic isolation, Geo-Redundant Storage (GRS) copies data asynchronously to a secondary region, while Geo-Zone-Redundant Storage (GZRS) combines both zone and regional replication. For read-heavy recovery, Read-access Geo-Redundant Storage (RA-GRS) and Read-access Geo-Zone-Redundant Storage (RA-GZRS) provide secondary read access, but services like Azure Files do not support these read-access options.
Protecting data from unauthorized modifications and accidental deletions is vital for security and regulatory compliance. Immutable Blob Storage Policies lock data in a write-once, read-many state, preventing users and applications from modifying or deleting files until a retention period expires. To handle operational errors, developers use snapshots to record the state of a resource at a specific moment in time. When combined with soft delete, which retains deleted objects in a soft-deleted state for a configurable period, organizations can easily recover deleted files, while point-in-time restore acts as a safety net to roll block blobs back to an earlier uncorrupted state.
A solid backup strategy relies on secure storage and clear lifecycle management. Azure Backup orchestrates regular protection for enterprise workloads, including SMB file shares, and supports long-term retention policies that can keep historical data for up to 99 years. To protect against ransomware attacks or malicious insider threats, organizations configure vaulted backups within Recovery Services vaults. These vaults store isolated, offsite copies of data that are logically separated from production environments. When setting up a vault, administrators must select the storage replication type before initializing any backups, as this setting cannot be changed later.
During a regional outage, the process of failing over to a secondary region requires a clear understanding of potential data loss. Administrators evaluate the last synchronization time property on the storage account to determine the gap between the primary and secondary regions. Any data written to the primary region before this timestamp is guaranteed to be safe in the secondary region, whereas data written after it may be lost during the failover. To proactively test and execute recovery plans, Cross Region Restore allows administrators to restore resources directly into the secondary region. This capability supports critical workloads such as Azure Virtual Machines (VMs) and SQL Server databases, enabling teams to run disaster recovery drills without impacting the primary environment.
Venture into the world of Azure Infrastructure, where design meets functionality. Harness your skills and gain mastery over complex cloud structures to ace the AZ-305 Designing Microsoft Azure Infrastructure Solutions exam!
Prepare and test your skills

Prepare and test your skills

Azure Data Lake Storage Gen2 builds on Azure Blob Storage by adding a hierarchical namespace that organizes files into a folder structure, significantly speeding up processing for analytics engines. In contrast, standard Azure Blob Storage uses a flat namespace and is primarily designed for general-purpose object storage, long-term retention, and simple file retrieval.
Azure Cosmos DB offers five consistency levels across a spectrum from strongest to weakest: strong consistency, bounded staleness, session consistency, consistent prefix, and eventual consistency. Session consistency is the default option, guaranteeing that reads always reflect the writes made within that same session.
Zone-Redundant Storage (ZRS) synchronously replicates data across three availability zones within a single region to protect against datacenter failures. Geo-Redundant Storage (GRS) copies data asynchronously to a secondary region for geographic isolation, while Geo-Zone-Redundant Storage (GZRS) provides maximum durability by combining synchronous zonal replication in the primary region with regional replication to a secondary region.