An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
For an HNS-enabled ADLS Gen2 storage account, the safer approach is to explicitly manage supported data-protection settings and omit unsupported ones.
restore_policy should be omitted for this scenario. Point-in-time restore is not supported for HNS/ADLS Gen2, and blob versioning is also not supported for accounts that have a hierarchical namespace. That aligns with the provider validation failure requiring versioning_enabled = true when restore_policy is set.
Explicitly managing soft delete is the better production practice here:
- Blob soft delete and container soft delete are both supported for HNS-enabled accounts.
- Blob soft delete is disabled by default and must be enabled at the storage account level.
- Microsoft recommends enabling blob soft delete for all storage accounts, with a minimum retention interval of seven days.
- Microsoft also recommends enabling container soft delete, with a minimum retention interval of seven days.
For ADLS Gen2 specifically:
- Blob soft delete on HNS-enabled accounts protects delete operations.
- Blob versioning is not available for HNS-enabled accounts.
- Container soft delete is available for Data Lake Storage.
- Container soft delete restores deleted containers and their contents, but it does not restore an individual blob deleted from a container.
That means the production-oriented design is:
- keep
blob_properties.delete_retention_policyexplicitly configured - omit
restore_policy - do not enable versioning on HNS accounts
- also explicitly enable container soft delete if container recovery is required
Risks of leaving blob_properties unmanaged and relying on defaults:
- Soft delete may not be enabled, because blob soft delete is disabled by default.
- The retention period is not explicitly controlled in code, which weakens repeatability and auditability.
- Drift becomes harder to detect because the intended protection posture is not declared in Terraform.
- Production recovery expectations can be missed if a deployment succeeds without the required retention settings.
On the specific debate:
- Workaround A is not a best-practice choice for production data protection because it leaves a critical recovery setting unmanaged and depends on platform behavior instead of declared configuration.
- Solution B is the correct pattern: refactor the module so unsupported features such as
restore_policyare omitted for HNS accounts, while supported protections such as soft delete remain explicitly configured.
A practical target configuration for HNS/ADLS Gen2 production is:
- Blob soft delete enabled with at least 7 days retention.
- Container soft delete enabled with at least 7 days retention.
- No blob versioning.
- No point-in-time restore.
- If stronger protection against deletion or overwrite is required, consider immutability policies or account-level protections such as ARM locks, depending on the scenario.
References: