# PART 3: STORAGE SERVICES

---

## 3.1 Azure Blob Storage

### Overview
Object storage for unstructured data. Up to 190 TB per storage account.

### Redundancy Options
| Type | What It Does | Use Case |
|---|---|---|
| **LRS** | 3 copies in one DC | Cheapest, non-critical |
| **ZRS** | 3 zones in one region | HA within region |
| **GRS** | LRS + async copy to paired region | DR |
| **GZRS** | ZRS + async copy to paired region | Best HA + DR |
| **RA-GRS / RA-GZRS** | Read-access to secondary | Read during outage |

### Access Tiers
| Tier | Storage Cost | Access Cost | Min Duration |
|---|---|---|---|
| **Hot** | Highest | Lowest | None |
| **Cool** | Lower | Higher | 30 days |
| **Cold** | Even lower | Even higher | 90 days |
| **Archive** | Lowest | Highest | 180 days (rehydration takes hours) |

### Blob Types
- **Block Blobs** — Most common. Text/binary. Up to 190.7 TB.
- **Append Blobs** — Optimized for append (logs).
- **Page Blobs** — Random R/W. Used by VM disks (VHDs). Up to 8 TB.

### Security
- **Encryption** — AES-256 at rest (default). Microsoft-managed or customer-managed keys (Key Vault).
- **SAS (Shared Access Signatures)** — Time-limited access. Types: Service SAS, Account SAS, User Delegation SAS (Entra ID-backed, most secure).
- **Immutable Storage** — WORM (Write Once, Read Many). Legal hold, time-based retention.
- **Soft Delete** — Recover deleted blobs within retention period (7-365 days).
- **Versioning** — Automatically save previous versions on overwrite.
- **Access Keys** — Two keys for rotation. Full access to storage account. Avoid in production — use Entra ID or SAS.

### Lifecycle Management
Automatically move blobs between tiers or delete them based on rules (e.g., move to Cool after 30 days, Archive after 90, delete after 365).

### Interview Q&A
**Q: When to use Hot vs Cool vs Archive?**
A: Hot = frequently accessed. Cool = infrequently accessed, stored ≥30 days. Archive = rarely accessed, stored ≥180 days. Rehydration from Archive takes hours. Use lifecycle policies to auto-tier.

**Q: LRS vs ZRS vs GRS — when to use which?**
A: LRS = cheapest, single DC, non-critical data. ZRS = HA within region (survives DC failure). GRS = DR across regions (async, some data loss possible). GZRS = best: zone HA + geo DR.

---

## 3.2 Azure Files

### Overview
Managed file shares in the cloud. Accessible via SMB and NFS.

### Tiers
- **Premium** — SSD-backed, high IOPS. For databases, high-performance workloads.
- **Transaction Optimized** — Balanced. For general purpose.
- **Hot** — Standard, frequently accessed.
- **Cool** — Standard, infrequently accessed.

### Key Features
- **SMB File Shares** — Windows-compatible. AD integration for ACLs.
- **NFS File Shares** — Linux-compatible. Premium tier only.
- **Azure File Sync** — Sync on-prem Windows Server with Azure Files. Cloud tiering (cache hot files locally, cold files in cloud).
- **Snapshots** — Point-in-time read-only snapshots.
- **Soft Delete** — Recover deleted shares.

### Interview Q&A
**Q: When to use Azure Files vs Blob Storage?**
A: Azure Files = need SMB/NFS file share, shared access, existing app expects file system. Blob = object storage, massive scale, cheapest for archival, no file locking needed.

**Q: What is Azure File Sync?**
A: Syncs on-prem Windows Server with Azure Files. Cloud tiering keeps frequently accessed files on-prem, cold files in Azure only. Replaces traditional file server backup.

---

## 3.3 Azure Managed Disks

### Overview
Persistent block storage for VMs. Managed by Azure (no storage account management).

### Disk Types
| Type | IOPS | Throughput | Use Case |
|---|---|---|---|
| **Ultra Disk** | Up to 160,000 | Up to 2,000 MB/s | Mission-critical, SAP HANA, tier-1 DBs |
| **Premium SSD v2** | Up to 80,000 | Up to 1,200 MB/s | Production, configurable IOPS/throughput |
| **Premium SSD** | Up to 20,000 | Up to 900 MB/s | Production workloads |
| **Standard SSD** | Up to 6,000 | Up to 300 MB/s | Web servers, light workloads |
| **Standard HDD** | Up to 2,000 | Up to 500 MB/s | Backups, non-critical |

### Key Features
- **Availability Zones** — ZRS disks survive zone failure (Standard SSD, Premium SSD, Premium SSD v2)
- **Snapshots** — Point-in-time read-only copy. Stored incrementally.
- **Encryption** — SSE with PMK or CMK. Azure Disk Encryption (BitLocker/DM-Crypt) for OS-level encryption.
- **Shared Disks** — Multi-VM shared access (SMB/CIFS). For clustered databases.

---

## 3.4 Azure Data Lake Storage (ADLS Gen2)

### Overview
Enterprise data lake built on Blob Storage. Hadoop-compatible. Hierarchical namespace (folders).

### Key Features
- Built on Blob Storage (uses same infrastructure)
- **Hierarchical Namespace** — True directories (vs flat namespace in Blob). Faster rename/directory operations.
- **POSIX ACLs** — Fine-grained access control at file/folder level
- Compatible with HDFS (Hadoop, Spark, Databricks)
- Supports all Blob Storage tiers (Hot, Cool, Cold, Archive)
- Lifecycle management same as Blob

### ADLS Gen2 vs Blob Storage
| Feature | Blob Storage | ADLS Gen2 |
|---|---|---|
| Namespace | Flat (simulate folders) | Hierarchical (real folders) |
| Access control | RBAC, SAS | RBAC, SAS, POSIX ACLs |
| Hadoop compatible | No | Yes |
| Performance (rename/dir) | Slower | Faster |
| Use case | General object storage | Big data / analytics |

### Interview Q&A
**Q: When to use ADLS Gen2 vs Blob Storage?**
A: ADLS Gen2 when doing big data/analytics (Databricks, Synapse, HDInsight) — needs hierarchical namespace, POSIX ACLs, HDFS compatibility. Blob Storage for general-purpose object storage, web content, backups.

---

## 3.5 Azure Table Storage

### Overview
NoSQL key-value store. Schemaless. Very cheap. Part of Storage Account.

- Partition key + Row key = unique identifier
- Up to 1 TB per table
- Cheap, simple, massive scale
- For simple lookups by key — no complex queries
- Often superseded by Cosmos DB Table API (more features, same API)

---

## 3.6 Azure Queue Storage

### Overview
Message queue for asynchronous communication between components.

- Messages up to 64 KB
- Millions of messages, pay per use
- At-least-once delivery
- Often compared to Service Bus Queue — Queue Storage is simpler, cheaper; Service Bus has more features (sessions, dead-letter, transactions, FIFO)

---

## 3.7 Azure NetApp Files

### Overview
Enterprise-grade NFS/SMB file shares powered by NetApp.

- Premium, Ultra, Standard service levels
- For SAP HANA, HPC, enterprise file shares
- Snapshots, cloning, cross-region replication
- More expensive than Azure Files, but enterprise features

---

## 3.8 Azure Data Box

### Overview
Physical device for offline data transfer to Azure. For TB-PB scale.

- **Data Box** — 80 TB, ruggedized
- **Data Box Disk** — 8 TB SSD, up to 5 disks
- **Data Box Heavy** — 800 TB
- For when network transfer is too slow or expensive
- Microsoft ships device → you copy data → ship back → data uploaded to Azure

---

## 3.9 Azure Elastic SAN

### Overview
SAN-like storage for workloads needing high IOPS and throughput.

- Simplifies SAN deployment at scale
- For enterprise applications needing shared block storage
