Azure Storage Solutions
Azure provides multiple storage services for different scenarios. The AZ-204 exam focuses on Cosmos DB for NoSQL database scenarios and Blob Storage for object storage.Azure Cosmos DB
Cosmos DB is a globally distributed, multi-model database service offering turnkey global distribution and elastic scalability.Consistency Models
Cosmos DB offers five tunable consistency levels trading off between consistency guarantees and performance.- Strong
- Bounded Staleness
- Session
- Consistent Prefix
- Eventual
Strongest consistency
- Linearizable reads (always latest committed write)
- Highest latency and cost
- Use for financial/inventory systems requiring strict consistency
Partitioning Strategies
The partition key determines how data is distributed across physical partitions for scale and performance. Key Concepts:- Partition key - Immutable, chosen at container creation
- Logical partition - All items with same partition key value (20 GB limit)
- Physical partition - 50 GB, 10,000 RU/s limit
- High cardinality - Many distinct values (userId, orderId)
- Synthetic keys - Combine fields for better distribution
Request Units (RU/s)
Request Units are the abstracted throughput currency in Cosmos DB. RU Pricing:- 1 RU = Cost to read a 1 KB item by ID
- Writes cost ~5x more than reads
- Cross-partition queries consume proportionally more
- 400 RU/s minimum provisioned throughput
Provisioned Throughput
- Fixed RU/s allocation
- Container or database level
- Predictable cost
- Throttling at 429 if exceeded
Autoscale
- Scales 10% to 100% of max RU/s
- Pay for what you use
- Best for variable workloads
Serverless
- Pay per RU consumed
- No provisioning
- Best for dev/test
- 5,000 RU/s per operation limit
Database-Shared
- Up to 25 containers share throughput
- Cost optimization
- Throughput divided among containers
Always log
response.RequestCharge in development to understand RU consumption - this identifies expensive queries before production.Indexing Policies
Cosmos DB indexes all properties by default. Custom policies optimize write performance and enable complex queries. Policy Options:- Default - All paths indexed automatically
- Exclude paths - Reduce write cost for unused properties
- Composite index - Required for ORDER BY on multiple fields
- Spatial index - For geospatial queries
Change Feed
The change feed is a persistent log of changes enabling event-driven architectures. Key Features:- Captures inserts and updates (not deletes by default)
- Full fidelity mode captures deletes and pre/post states
- Change Feed Processor - Distributed consumption with leases
- Azure Functions trigger uses Change Feed Processor internally
Azure Blob Storage
Blob Storage provides object storage for unstructured data like documents, images, videos, and backups.Account Tiers
Blob Storage offers account types and access tiers trading storage cost for access cost. Access Tiers:- Hot
- Cool
- Cold
- Archive
- Highest storage cost, lowest access cost
- Frequent access patterns
- Optimized for data accessed regularly
- Default tier for new blobs
Shared Access Signatures (SAS)
SAS tokens grant time-limited, scoped permissions without sharing account keys. SAS Types:- Account SAS - Broad access across services
- Service SAS - Scoped to one service (Blob, Queue, Table)
- User Delegation SAS - Uses Azure AD identity (most secure)
Storage Service Encryption
All Azure Storage data is automatically encrypted at rest using AES-256. Encryption Options:- Microsoft-managed keys (MMK) - Default, no configuration
- Customer-managed keys (CMK) - Stored in Key Vault, you control rotation
- Customer-provided keys (CPK) - Per-request, key never stored
- Infrastructure encryption - Double encryption for compliance
Data Protection Features
Azure Blob Storage offers multiple protection mechanisms.Soft Delete
- 1-365 day retention
- Recoverable before permanent deletion
- Protects against accidental delete
Versioning
- Auto-saves prior versions on write
- Protects against overwrites
- Works with soft delete
Point-in-Time Restore
- Roll back containers to earlier state
- Time-based recovery
- Requires versioning
Immutability Policies
- Time-based or legal hold
- WORM (write-once-read-many)
- SEC/FINRA compliance
Exam Checklist
- Understand Cosmos DB consistency levels and tradeoffs
- Know partition key design best practices
- Understand Request Units and cost optimization
- Know indexing policy options and composite indexes
- Understand Change Feed patterns and processors
- Know blob storage access tiers and use cases
- Understand SAS token types and security
- Know encryption options (MMK, CMK, CPK)
- Understand data protection features