Volume 8 · Chapter 4 — Azure Cloud Architecture & Enterprise DevOps for .NET Engineers
Azure Storage Architecture
4.1 Introduction
Azure Storage is the durable foundation beneath most cloud applications - files, backups, queues, and tables. It is cheap, massively scalable, and highly durable, but using it well means matching the storage service and its redundancy tier to the data’s access pattern, durability needs, and cost sensitivity. The wrong choice quietly wastes money or, worse, risks data loss.
4.2 The Storage Account and Its Services
A storage account is a namespace and security/redundancy boundary that groups four data services: Blob (unstructured objects), Files (SMB/NFS shares), Queue (simple messaging), and Table (NoSQL key-value). One account can host several, but you often split accounts to isolate performance, security, or lifecycle policies.
flowchart TB SA["Storage Account\n(security + redundancy boundary)"] --> Blob["Blob\n(documents, media, backups)"] SA --> Files["Files\n(SMB/NFS shares)"] SA --> Queue["Queue\n(simple async messaging)"] SA --> Table["Table\n(NoSQL key-value)"]
4.3 Blob Storage and Access Tiers
Blob Storage is the workhorse for unstructured data. Its access tiers let you trade storage price against access price: Hot for frequently accessed data, Cool for infrequent (cheaper storage, pricier reads), and Archive for rarely accessed data at the lowest storage cost but with hours-long rehydration. Matching tier to access pattern is a major cost lever.
// Upload a document with a managed identity - no connection strings or keys.
var cred = new DefaultAzureCredential();
var client = new BlobServiceClient(new Uri("https://acct.blob.core.windows.net"), cred);
var container = client.GetBlobContainerClient("statements");
await container.UploadBlobAsync(
$"{customerId}/{DateTime.UtcNow:yyyyMM}.pdf",
BinaryData.FromBytes(pdfBytes));
4.4 Files, Queues, and Tables
Azure Files provides managed SMB/NFS shares for lift-and-shift file-server scenarios and shared configuration. Queue Storage offers simple, cheap at-least-once messaging for decoupling components (for richer messaging use Service Bus). Table Storage is a low-cost NoSQL key-value store for high-volume, simple-schema data such as metadata and audit records.
4.5 Redundancy: Choosing a Durability Tier
Redundancy determines how many copies exist and where, trading cost against resilience. This is a core reliability and cost decision.
| Option | Protects against | Copies |
|---|---|---|
| LRS (Local) | Disk/rack failure in one datacenter | 3 in one zone |
| ZRS (Zone) | Datacenter (zone) failure | 3 across zones |
| GRS (Geo) | Regional disaster | 3 local + 3 in paired region |
| GZRS (Geo-Zone) | Zone + regional disaster | Zone-redundant + geo copy |
4.6 Lifecycle Management
Lifecycle policies automatically transition or delete blobs based on age or access, so cost management is automatic rather than manual. A typical rule moves statements to Cool after 30 days, to Archive after 180, and deletes them after a legal retention period - a large, hands-off saving on large data sets.
4.7 Security: Identity over Keys
Storage account keys are powerful, long-lived, and dangerous if leaked. The modern best practice is to disable key access and authenticate with Entra ID via managed identities and RBAC data-plane roles (for example “Storage Blob Data Contributor”), combined with encryption at rest (default), private endpoints, and network rules. Where you must grant scoped, time-limited access to a specific blob, use a short-lived user-delegation SAS rather than an account key.
How do you choose the right Azure storage service and access tier?
I start from the data’s shape and access pattern. Unstructured objects (documents, media, backups) go to Blob; shared file access for lift-and-shift goes to Files; simple decoupling messaging to Queue (or Service Bus for richer needs); and high-volume simple key-value data to Table or, for richer queries, Cosmos DB. For Blob I then pick the access tier by how often the data is read: Hot for active data, Cool for infrequent access, Archive for cold data that tolerates rehydration latency - matching tier to access pattern is a big cost lever. Finally I set redundancy from the durability requirement. The decision axes are data type, access frequency, durability need, and cost.
Explain the storage redundancy options and how you choose among them.
Redundancy trades cost for resilience. LRS keeps three copies in a single datacenter - cheapest, protects only against hardware failure. ZRS spreads three copies across availability zones in a region, surviving a datacenter outage. GRS adds an asynchronous copy in the paired region for regional-disaster protection but with a replication lag (so some data loss on failover) and read access only after failover unless you use RA-GRS. GZRS combines zone redundancy locally with a geo copy for the strongest durability. I choose by the data’s criticality and compliance needs: non-critical or easily reproducible data on LRS, important production data on ZRS, and data requiring regional-disaster protection on GRS/ GZRS - accepting the higher cost and, for geo options, the eventual-consistency lag to the secondary.
Why prefer managed identities over storage account keys or connection strings?
Account keys are long-lived, extremely powerful (full control of the account), and a serious liability if they leak through config, logs, or source control, and rotating them is disruptive. Managed identities remove stored secrets entirely: the Azure resource has an Entra identity, and you grant it a narrowly scoped RBAC data role (like Storage Blob Data Reader) so access is least-privilege, auditable, and automatically rotated by the platform. Code authenticates viaDefaultAzureCredentialwith no secret to manage or leak. For rare cases needing scoped external access to a specific object, a short-lived user-delegation SAS (itself backed by Entra) is preferable to handing out an account key. The principle is identity-based, least-privilege, secretless access.
How do you design a cost-effective storage strategy for petabytes of data with mixed access patterns?
At petabyte scale, storage tiering and lifecycle automation dominate cost, so I make them systematic rather than manual. I classify data by access pattern and retention, then use lifecycle management policies to move objects automatically - Hot while active, Cool after a defined idle period, Archive for long-term cold data, and deletion at the end of the legal retention window - so cost tracks actual usage without human effort. I set redundancy per data class (not blanket GZRS on everything), reserving geo-redundancy for data that truly needs regional-disaster protection and using cheaper LRS/ZRS for reproducible or lower-value data. I isolate workloads across storage accounts to apply differentiated policies and monitor cost per account with budgets and alerts. For access, I ensure hot paths are served from the right tier and consider caching or CDN for frequently read blobs. The strategy is to let policy and tiering, not manual intervention, keep cost aligned with value as the data set grows.
A regulated system must retain records immutably for seven years and prove they were not altered. How do you architect that?
This is a WORM (write-once-read-many) and integrity requirement. I’d use Blob Storage with immutable storage policies - a time-based retention policy or legal hold at the container/blob level - so that once written, objects cannot be modified or deleted until the retention period expires, which is exactly the compliance control regulators expect and which even administrators cannot override while the policy is active. I’d combine that with lifecycle rules that transition the data to Archive to control cost over the long horizon, geo-redundant storage for durability against regional disaster, and encryption at rest (optionally with customer-managed keys in Key Vault for control). For tamper-evidence I’d store cryptographic hashes/ digests of each record (and rely on the platform’s integrity guarantees), and enforce access with least-privilege RBAC and private endpoints, with full audit logging of every access. The combination - immutable policy, geo durability, archival tiering, and audited least-privilege access - meets both the retention and the provable-integrity obligations at a manageable cost.
4.8 Banking Enterprise Scenario
A bank stores customer statements as PDFs in Blob Storage, written by services using managed identities with account keys disabled and public access blocked behind private endpoints. Statements sit in Hot for the current month, then a lifecycle policy moves them to Cool after 30 days and Archive after six, with an immutable retention policy enforcing the seven-year regulatory hold so no one can alter or delete them early. The data uses GZRS for zone and regional durability. Audit logs and metadata live in low-cost Table Storage. The result meets strict compliance and integrity requirements while keeping long-term storage cost low through automated tiering.
Chapter Revision Notes
- Pick the storage service by data shape: Blob, Files, Queue, or Table.
- Match Blob access tier (Hot/Cool/Archive) to access frequency for cost.
- Choose redundancy (LRS/ZRS/GRS/GZRS) by durability and compliance needs.
- Automate cost control with lifecycle management policies.
- Prefer managed identities + RBAC over account keys; use private endpoints.
- Use immutable storage policies for regulatory WORM retention.