Lesson 5 of 5 Unstructured Data Solutions

Protecting Blobs and Files from Loss

This lesson explains the features that protect data from deletion, overwriting and tampering.

Learning outcomes

After completing this lesson, you will be able to:

  • Explain why replication is not backup.
  • Describe soft delete, versioning and point-in-time restore.
  • Describe immutable storage.
  • Compare planned and unplanned failover.

Failure types need different protection

A common error is to treat replication as a backup. GRS faithfully replicates a deletion to the secondary region within minutes. Protection against accidental or malicious change therefore requires features that retain earlier states. A design should identify which failure it faces: hardware or site failure needs redundancy; human error needs soft delete and versioning; malicious tampering needs immutability and separate backups.

Soft delete and versioning

Blob soft delete retains a deleted blob or overwritten data for a retention period of 1 to 365 days, during which it can be restored. Container soft delete does the same for containers, and it must be enabled separately, since blob soft delete does not protect against the deletion of a container or account. Azure Files soft delete protects file shares.

Blob versioning automatically keeps a previous version on each write, so any earlier state can be restored. Microsoft recommends fewer than 1,000 versions per blob, so lifecycle rules should remove old versions. Snapshots capture a point-in-time copy on demand, whereas versioning is automatic.

Point-in-time restore returns block blobs in a container to an earlier state, which suits recovery from widespread damage such as a faulty application release. It requires soft delete, change feed and versioning, is available for block blobs in standard general-purpose v2 accounts, and its period must be at least one day shorter than the soft delete period. It is not supported where a hierarchical namespace is enabled.

Select all that apply

Point-in-time restore prerequisites

Exam skills 2.2.4

Identify what point-in-time restore for block blobs requires.

Log in to try this activity Interactive activities are free with an account.

Immutability

Immutable storage places blobs in a write once, read many (WORM) state, in which they cannot be changed or deleted, even by an account owner. A time-based retention policy protects data for a set period, from 1 day to about 400 years. Once locked, it cannot be deleted or shortened, which is what regulators require. A legal hold protects data with no fixed end date, until the hold is removed, and it suits litigation.

Policies apply at container or at version level. Version-level immutability allows fine control, and requires versioning. Immutable storage is often the final defence against ransomware, because stolen administrative credentials cannot encrypt or remove protected data.

The following diagram shows the immutability protections on containers for trade records and working files.

Retention for trade records and working files. Trade records get a locked time-based immutability policy for seven years, which even account administrators cannot remove, and a legal hold keeps records under investigation beyond it. Working files, in a separate container, use soft delete with 30 days' retention for mistaken deletions.
The scenario is illustrative.
Scenario questions

Retention policy or legal hold?

Exam skills 2.2.4

Choose the immutability protection for each requirement.

Log in to try this activity Interactive activities are free with an account.

Replication and failover

Object replication asynchronously copies block blobs between two storage accounts, which can be in different regions, according to rules. It requires change feed on the source account and versioning on both accounts, and it allows up to two destinations from a source. It suits moving data closer to users in other regions, or distributing processed output, and unlike GRS it gives control over which containers replicate, and to where.

Failover applies to geo-redundant accounts. A customer-managed planned failover involves no expected data loss, and the account stays geo-redundant, which suits disaster recovery drills. An unplanned failover makes the secondary the primary during an outage, and data that has not yet replicated is lost; the account is converted to locally redundant storage, so geo-redundancy must be reconfigured afterwards. Microsoft-managed failover covers only a severe regional disaster, and it cannot target an individual account.

True or false

Object replication and failover

Exam skills 2.2.4

Check how object replication and account failover behave.

Log in to try this activity Interactive activities are free with an account.

Protecting the account itself

Even with these features, an administrator with control-plane access may be able to disable them. An Azure resource lock can prevent the deletion of a storage account, and Azure Policy can require soft delete or block weak configurations. Backing up to a separate vault with Azure Backup also protects data from an attacker who has compromised the account, and it is covered in the backup module.

Encryption and threat protection

All data in Azure Storage is encrypted at rest with 256-bit AES. By default the account uses one Microsoft-managed key, and a customer-managed key in Key Vault or Managed HSM can replace it when the customer must control rotation or revocation. Two further features meet stricter requirements.

Encryption scopes

An encryption scope applies a separate key to a container or to an individual blob. Each scope uses a Microsoft-managed or customer-managed key, so data belonging to different customers in one account can be protected by different keys, and one customer's key can be revoked without affecting the others. A container can be given a default scope, and that default can be enforced so that every blob uploaded to it uses the same key. A scope can be disabled but not deleted, and it is billed for at least 30 days once enabled.

Infrastructure encryption

Infrastructure encryption encrypts data a second time at the infrastructure layer, with a different algorithm and a separate Microsoft-managed key. It protects against the compromise of one key or algorithm, and suits compliance rules that require double encryption. It must be enabled when the account or the encryption scope is created, and it cannot be enabled or disabled afterwards, so a requirement for double encryption on an existing account means creating a new account and moving the data.

Microsoft Defender for Storage

Encryption protects data at rest, but not from a malicious upload or a leaked credential. Microsoft Defender for Storage, a plan in Microsoft Defender for Cloud, monitors Blob Storage, Azure Files and Data Lake Storage for unusual access, such as access from a Tor exit node or through an overly permissive SAS. It needs no diagnostic logs or agents. Malware scanning scans blobs on upload or on demand with Microsoft Defender Antivirus, is charged per gigabyte scanned with a monthly cap, and can trigger automated quarantine through Event Grid. Sensitive data threat detection raises the priority of alerts on accounts that hold sensitive data. Enabling the plan at subscription level protects existing and new storage accounts automatically.

Match the pairs

Encryption and threat protection

Exam skills 2.2.4

Match each requirement with the storage feature that meets it.

Log in to try this activity Interactive activities are free with an account.

Comparing the features

The following table recaps which feature addresses which risk.

RiskFeature
Hardware, zone or regional failureRedundancy (ZRS, GZRS)
Accidental deletion of a blobBlob soft delete
Accidental deletion of a containerContainer soft delete
Accidental overwriteVersioning
Widespread corruption in block blobsPoint-in-time restore
Regulated retention, ransomwareImmutable storage with a locked policy
Deletion of the storage accountResource lock
Worked example

Meeting a retention rule

A broker must keep trade records unchanged for seven years, in a form that no one can delete, including account administrators. Records under investigation must be held beyond seven years. Staff sometimes delete working files by mistake, and these must be recoverable for 30 days. What should you recommend?

The seven-year rule needs a time-based immutability policy that is locked, as an unlocked policy can still be removed. A legal hold can be added to records under investigation, keeping them protected beyond the policy's end.

Working files in a separate container are protected by blob soft delete with a 30-day retention period. Versioning alone would not prevent deletion by an administrator, and a resource lock protects the account but not the blobs. Geo-redundancy would replicate a deletion, offering no protection against it.

Check yourself

Does blob soft delete protect against the deletion of a container?

Show answer

No. Container soft delete must be enabled separately.

Exam Tips

Remember for the exam

  • Replication is not backup: deletions replicate too.
  • Soft delete retains blobs for 1-365 days; container soft delete is separate.
  • A locked time-based retention policy cannot be shortened or removed.
  • Point-in-time restore needs soft delete, change feed and versioning, and excludes hierarchical namespace accounts.
  • Unplanned failover can lose recent writes, and converts the account to LRS.