Prerequisites
- !Blob storage containers and what a flat namespace means
- !Unix file permissions at a high level
- !Why partitioning exists in analytical tables
What You'll Learn
- 1Explain what hierarchical namespace changes about a storage account
- 2Apply owner, group, mask and other POSIX permissions, and know when ACLs stop applying
- 3Design a raw, curated and sandbox layout that survives team growth
- 4Choose redundant tiers and retention policies that match data value
- 5Diagnose the two most common permission failures in a lake
Gen2 is blob storage with a directory semantics bolted on
Azure Data Lake Storage Gen2 is not a separate product. It is a blob storage account with the hierarchical namespace feature enabled, which makes directories first-class objects instead of a naming convention. That single change is the source of almost every behavioural difference you will be asked about.
Without a hierarchical namespace, raw/2026/01/orders.parquet is just one blob whose name happens to contain slashes. Renaming a "directory" rewrites every blob, permission is granted per blob or per container, and a file move costs a full read-write. With hierarchical namespace enabled, directories exist as real entries: a rename is a metadata operation, directories carry their own permissions, and moving files inside the account is cheap and atomic.
The trade-off is feature availability. Accounts with hierarchical namespace do not support every blob feature: some tiering operations, soft-delete behaviours and a few data protection options differ from a standard account. Teams sometimes discover this after enabling the feature, because hierarchical namespace cannot be toggled on an existing account. The account must be recreated and data copied, which is a decision to make once, deliberately.
| Capability | Flat blob account | Gen2 hierarchical | Why it matters |
|---|---|---|---|
| Directory rename | Rewrites every blob | Metadata-only operation | Lets ETL reorganise zones cheaply |
| Permission scope | Container or blob | Directory and file, POSIX style | Enables per-domain access |
| Move within account | Read and write | Metadata update | Cheap promotion between zones |
| Changing namespace later | Not applicable | Requires a new account | Decide before you store data |
| Cost model | Standard blob rates | Same rates, plus a namespace index | Cost is not the reason to choose it |
Permissions: the two systems that coexist
Gen2 supports two permission models and they interact in ways that confuse everyone at first. The Azure authorization layer, role-based access control, applies to the data plane operations you perform through the portal, REST APIs and SDKs. The POSIX-style ACLs apply at the directory and file level when the hierarchical namespace is enabled.
The precedence rule is worth memorising. If your identity has a data plane role such as Storage Blob Data Contributor at the account or container, that grant is sufficient and the ACLs are not consulted. Only when the RBAC layer does not grant access do the POSIX ACLs get evaluated. So a user denied by an ACL but granted the data role still succeeds, which surprises teams building least-privilege designs.
Within the POSIX model there are four categories of entry: owning user, owning group, mask, and other. The mask is the part people miss: it caps the effective permissions granted to named users and groups in the entries below it, so a broad grant in an entry is silently reduced by a restrictive mask.
# Inspect the current ACL set on a curated directory
az storage fs access show \
--path filesystem/curated/sales \
--account-name stdatalakeprod \
--auth-mode login -o json
# Grant a pipeline identity read and write on one directory only
az storage fs access set \
--path filesystem/curated/sales \
--account-name stdatalakeprod \
--permission "rwx------+" \
--auth-mode login
# Add a specific group entry for the analyst team (read only)
az storage fs access set-entry \
--path filesystem/curated/sales \
--account-name stdatalakeprod \
--group "grp-analysts" \
--permission "r-x------" \
--auth-mode login
The trailing plus sign on a permission string signals that extended ACL entries exist beyond the classic triple. Dropping it when you rewrite a permission string silently removes those named entries, which is a frequent cause of an analyst losing access after a "harmless" permission change.
The layout that scales past the first team
A lake that works for three people usually fails at fifteen, and the failure is almost always the folder structure. The convention that holds up is zone-based: landing, raw, curated and sandbox, with each zone having a different permission and retention posture.
The landing zone is where sources drop files untouched, often via a managed identity with write-only access. Raw holds validated but unmodified copies, partitioned by arrival date so replay is trivial. Curated holds conformed, de-documented tables that analysts query. Sandbox gives engineers a place to experiment without touching production paths.
abfss://stdatalakeprod.dfs.core.windows.net/
landing/
erp-orders/2026/10/11/
crm-customers/2026/10/11/
raw/
erp-orders/dt=2026-10-11/part-00000.parquet
crm-customers/dt=2026-10-11/part-00000.parquet
curated/
sales/fact_order/dt=2026-10-11/
sales/dim_customer/
finance/fact_invoice/
sandbox/
amir/experiment-01/
quarantine/
erp-orders/2026-10-11/failed-records.parquet
Partition columns prefixed with dt= follow the Hive convention that Spark, Synapse and Trino all understand, so a query that filters on date prunes files instead of scanning them. Quarantine folders deserve special mention: records that fail validation are written somewhere visible rather than dropped, which turns a data quality argument into a countable metric.
Layout hints and why they beat manual partitioning
File naming and layout can be left to the writer or declared to the storage account. Optimise for append or for load patterns tells Azure how incoming data is likely to be organised, and the service then places new blobs where readers will look for them. Choosing append means sequential writes; choosing load means batches arriving for the same partition together.
On the read side, the win comes from partitioning and file size. Files smaller than roughly one hundred megabytes waste the reader's time in overhead, and files larger than a gigabyte make task splits coarse and retries expensive. A target of a few hundred megabytes per Parquet file is a good default for Spark workloads.
from pyspark.sql import SparkSession
spark = (SparkSession.builder
.appName("lake-layout")
.getOrCreate())
# Write with an explicit partition scheme and target file size
(raw_df.write
.mode("overwrite")
.option("maxRecordsPerFile", 2000000)
.partitionBy("dt")
.parquet("abfss://[email protected]/erp-orders"))
# Read only one partition: the rest are pruned
curated = (spark.read
.parquet("abfss://[email protected]/erp-orders")
.where("dt >= '2026-10-01' AND dt < '2026-10-08'"))
The predicate must reference the partition column exactly as it is named, and values must match the written strings. dt = date '2026-10-01' against a string partition usually resolves, but a differently formatted value such as 10/01/2026 prunes nothing and silently reads the whole lake.
Tiers, retention and what to do with cold data
Not all bytes are equal. Hot tier serves the frequent reads of curated tables, cool tier suits monthly reporting on raw history, and archive suits compliance copies read once a year. Tiering a directory to archive removes it from immediate availability: retrieval takes minutes and may cost per gigabyte, so it belongs on data nobody queries interactively.
Lifecycle rules are the automation that keeps this honest. Move raw partitions older than ninety days to cool, archive anything older than two years, and delete sandbox content after thirty days so experiment folders stop accruing cost. Soft delete on containers or blobs adds a recovery window for accidental deletion, but it does not replace versioning for a curated table that must be point-in-time correct.
The two permission failures you will actually debug
The first is a job that works from a developer's account and fails from a managed identity. The human has a data role granted at the subscription; the managed identity has nothing. Grant the identity Storage Blob Data Contributor on the account or, better, on only the paths it needs through a credential pass-through model.
The second is a group entry that looks correct but grants nothing because the mask caps it. Read the effective permission rather than the individual entry: az storage fs access show returns the resolved view, and comparing it with what you expected usually reveals the mask in one line.
Common Mistakes
Enabling hierarchical namespace without checking feature compatibility
Fix: Confirm the blob features you depend on are supported first, because the setting cannot be reversed on the account
Assuming an ACL deny overrides an Azure data role
Fix: RBAC at the data plane level is evaluated first; remove the role grant if you truly need the ACL to be the boundary
Leaving files in landing forever because downstream reads them from there
Fix: Treat landing as transient and read from raw, with a lifecycle rule that ages out anything left behind
Partitioning on a low-cardinality column such as region or status
Fix: Partition on a high, steadily growing key like date, and use clustering or Z-ORDER for low-cardinality filters
Best Practices
- Keep zone boundaries explicit so retention and permissions can be applied per zone
- Target a few hundred megabytes per Parquet file and tune records per file accordingly
- Grant identities access on the narrowest path that works, then verify with an effective permission read
- Store quarantine records instead of dropping them so data quality is measurable
Interview Questions
Q1: What does enabling hierarchical namespace change in a storage account?
Directories become real objects, renames and moves become metadata operations, and POSIX-style ACLs become available at directory and file level. It cannot be enabled on an existing account and some blob features are unavailable afterwards.
Q2: How do RBAC and POSIX ACLs interact in Gen2?
Data plane RBAC is evaluated first. If it grants the operation, the ACLs are not consulted. ACLs only take effect when the RBAC layer does not grant access.
Q3: What is the purpose of the mask entry in an ACL?
It caps the effective permissions of named user and group entries beneath it, so a wide grant in an entry is limited by the mask value.
Q4: How should a data lake be partitioned for Spark and Synapse?
On a high-cardinality, steadily growing key such as date, using the Hive dt= convention, with file sizes in the low hundreds of megabytes so pruning and task splits both work.
Q5: When would you move data to the archive tier?
For compliance or historical copies read rarely and never interactively, because archive retrieval is delayed and can carry per-gigabyte retrieval cost.
Key Takeaways
- Gen2 is blob storage with a hierarchical namespace, and that flag is permanent for the account
- RBAC wins over POSIX ACLs whenever it grants the operation, so least privilege means controlling both
- Zone-based layouts with Hive-style partitions are what keep a lake usable as the team grows
- File size and partition choice determine read cost far more than storage tier does
- Effective permissions, not individual ACL entries, are what you should verify