Lesson 07 — Azure Blob Storage: Access, Lifecycle & Security
Why Blob Storage Deserves Its Own Lesson
Blob storage is the most-used Azure storage service. Every application generating unstructured data — images, videos, logs, backups, telemetry exports, build artefacts — stores it in blob storage. The exam tests it at a depth that surprises many candidates: SAS token types and revocation mechanics, the precise behaviour of Archive rehydration, lifecycle management rule structure, and the interactions between soft delete, versioning, and immutability policies.
Beyond the exam, getting SAS token architecture wrong is one of the most common storage security vulnerabilities in real-world Azure deployments. Understand the three SAS types and when each one is appropriate.
Blob Types
A blob storage account organises data as: storage account → containers → blobs. You choose a blob type at creation — it cannot be changed afterwards.
| Type | Optimised for | Max size | Common use |
|---|---|---|---|
| Block blob | Sequential read/write of large files | 190.7 TiB | Images, videos, backups, build artefacts, general unstructured data |
| Append blob | Append-only operations (existing blocks immutable) | 195 GiB | Application logs, audit logs, diagnostic streams |
| Page blob | Random read/write access | 8 TiB | VHD files for unmanaged VM disks (legacy — use Managed Disks) |
Container Public Access Levels
Containers have a public access setting that controls anonymous (unauthenticated) access:
| Level | Anonymous access permitted |
|---|---|
| Private (default) | None — all requests require authentication |
| Blob | Anonymous read of individual blobs if you know the URL — no container listing |
| Container | Anonymous read of blobs AND anonymous listing of the container contents |
Blob URL Structure
https://<accountname>.blob.core.windows.net/<container>/<blob-path>
Example:
https://mystorageaccount.blob.core.windows.net/images/profile/user-12345.jpg
Blob Access Tiers In Depth
Archive Tier: Rehydration
Archive-tier blobs are stored offline — the data is not available for reads until the blob is rehydrated to an online tier (Hot, Cool, or Cold). Rehydration works in two ways:
- Copy to new blob: use
Copy Blobto copy the archived blob to a new online-tier blob. The original archive blob remains. This is the preferred approach as it is non-destructive. - Change tier in-place: set the blob's tier directly to Hot or Cool. The blob transitions in place.
| Rehydration priority | Duration | Size constraint |
|---|---|---|
| Standard | Up to 15 hours | No limit |
| High | Within 1 hour | Objects under 10 GiB only |
Tier Transitions
You can move blobs between any tier. Moving to a colder tier (hot → archive) is instant — no data movement latency. Moving to a warmer tier from archive requires rehydration as described above. Minimum storage duration penalties apply on early transitions to warmer tiers just as they do for deletions.
Lifecycle Management Policies
Lifecycle management policies automate blob tier transitions and deletions based on age criteria. They are defined as JSON rules and evaluated daily — Azure scans the storage account and applies matching rules.
Rule Structure
Each rule has three components:
- Filters: scope which blobs the rule applies to — by blob type (blockBlob, appendBlob), by prefix match (e.g.
logs/), by minimum/maximum blob size. - Actions: what to do —
tierToCool,tierToCold,tierToArchive, ordelete. - Conditions: the age trigger —
daysAfterModificationGreaterThan,daysAfterCreationGreaterThan, ordaysAfterLastAccessTimeGreaterThan(requires last access time tracking to be enabled).
Example Lifecycle Policy JSON
{
"rules": [
{
"name": "tiering-rule",
"type": "Lifecycle",
"definition": {
"filters": {
"blobTypes": ["blockBlob"],
"prefixMatch": ["data/"]
},
"actions": {
"baseBlob": {
"tierToCool": { "daysAfterModificationGreaterThan": 30 },
"tierToArchive": { "daysAfterModificationGreaterThan": 90 },
"delete": { "daysAfterModificationGreaterThan": 365 }
}
}
}
}
]
}
This policy targets block blobs under the data/ prefix and: moves them to Cool after 30 days, to Archive after 90 days, and deletes them after 365 days of inactivity — all without any manual intervention.
Lifecycle Rules for Versions and Snapshots
Lifecycle management rules can also target blob versions and snapshots separately from the current version. This is important when blob versioning is enabled: previous versions accumulate and incur storage costs. A separate rule can archive or delete previous versions after a defined period.
Shared Access Signatures (SAS)
A SAS is a URI with embedded query parameters that grants scoped, time-limited access to storage resources without sharing the account key. This is the standard mechanism for granting third-party or temporary access to specific blobs or containers.
The Three SAS Types
| Type | Signed with | Scope | Security level |
|---|---|---|---|
| Account SAS | Storage account key | Multiple services in one account | Lowest — key compromise invalidates all account SAS |
| Service SAS | Storage account key | One service (e.g. one blob container) | Medium — tighter scope but still key-signed |
| User Delegation SAS | Entra ID credentials | Blob and ADLS Gen2 only | Highest — no account key involved; backed by identity |
SAS Key Parameters
A SAS URI includes these query parameters (abbreviated):
sp— signed permissions:r=read,w=write,d=delete,l=list,a=add,c=createst/se— start time and expiry time (ISO 8601)sip— allowed IP addresses or rangesspr— protocol restriction (httpsonly in production — never allow HTTP)sig— the HMAC-SHA256 signature computed from the parameters
Stored Access Policies
A Stored Access Policy is a named policy defined on a container (or queue/table/file share). You attach a Service SAS to a Stored Access Policy instead of baking the permissions and expiry directly into the SAS URI. The benefit: you can revoke the SAS by deleting the policy, without rotating the storage account key.
Revoking a SAS — The Full Matrix
| SAS type | How to revoke immediately |
|---|---|
| Account SAS or Service SAS (no stored policy) | Rotate the storage account key used to sign it — invalidates ALL SAS signed with that key |
| Service SAS with Stored Access Policy | Delete or modify the Stored Access Policy on the container |
| User Delegation SAS | Revoke the user's Entra ID permissions, or wait for expiry. Rotating the key has no effect. |
Data Protection Features
Azure Blob Storage has multiple overlapping data protection capabilities. Understanding when to use each — and how they interact — is critical for both production design and exam questions.
Protection Feature Overview
| Feature | Protects against | Recovery method |
|---|---|---|
| Soft delete (blobs) | Accidental blob deletion or overwrite | Undelete within retention period (1–365 days) |
| Soft delete (containers) | Accidental container deletion (must enable separately) | Undelete container within retention period |
| Blob versioning | Overwrites — each write creates a new version | Promote any previous version to current |
| Point-in-time restore | Bulk accidental delete or corruption across blobs | Restore all block blobs to a past timestamp |
| Immutability (WORM) | Regulatory requirement — blobs cannot be modified or deleted | N/A — data cannot be altered until policy expires |
| Change feed | Audit trail — durable ordered log of all blob changes | Replay log for event-driven recovery or auditing |
Point-in-Time Restore Dependencies
Point-in-time restore for block blobs requires all three of the following to be enabled on the storage account:
- Blob versioning — maintains previous states
- Blob soft delete — protects deleted blobs during the restore window
- Change feed — provides the ordered change log that restoration uses
The restore point cannot be older than the soft delete retention period and cannot be more recent than the last 15 minutes (to allow change feed propagation).
Immutability Policies (WORM)
WORM (Write Once Read Many) compliance is implemented via two policy types:
- Time-based retention policy: blobs cannot be modified or deleted until the retention period expires. Can be applied at the container or blob-version level. Can be locked (making the policy itself immutable — required for SEC 17a-4 and similar regulations).
- Legal hold: blocks modification and deletion indefinitely until the legal hold tag is removed. Used during litigation or regulatory investigation when no defined retention period is known.
Check Your Understanding
Click any option to see immediate feedback. Answers represent correct behaviour in a real Azure environment.
1. A security audit finds your application is using storage account access keys embedded in its configuration. What is the most secure replacement approach?
2. A blob is in the Archive tier. An application tries to read it immediately without rehydrating. What happens?
3. You need to ensure a container's blobs cannot be deleted for 7 years to meet compliance requirements. How do you implement this?
4. You create a Service SAS for a blob container valid for 7 days. After 2 days you discover the SAS URI has been leaked. What is the fastest way to invalidate it?
5. You want blobs automatically moved to Archive tier 90 days after last modification, and deleted entirely after 365 days. Which feature implements this?
6. Your application generates append-only log files stored in Azure Blob Storage. Which blob type should you use?
Also read: Grant limited access with SAS, Lifecycle management overview, and Immutable blob storage overview.
This lesson covered blob types, access tiers, SAS tokens, lifecycle management, and data protection. Go deeper on:
- Walk me through generating a User Delegation SAS using the Azure CLI with specific permissions and a 2-hour expiry.
- How do I set up point-in-time restore and what are the exact steps to initiate a restoration to a specific timestamp?
- What is the difference between a versioning delete marker and a soft-deleted blob — how do they interact in Cost Management?
- Can I apply a lifecycle policy rule specifically to previous blob versions to prevent unbounded version accumulation?
- How does a legal hold interact with a time-based retention policy on the same container?