Lesson 3 of 5 Azure Storage Accounts

Replicating Blobs with Object Replication

Object replication copies block blobs between containers in different accounts. This lesson explains how it works, its prerequisites and how it differs from geo-redundancy.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe replication policies and rules.
  • Identify the prerequisites and limitations of object replication.
  • Distinguish between object replication and geo-redundant storage.

How object replication works

A replication policy links a source account and a destination account, which can be in any region and in different subscriptions (replication across tenants is disallowed by default for new accounts and must be explicitly allowed). The policy contains up to 1,000 rules, each mapping one source container to one destination container. A rule can filter blobs by name prefix and can copy all existing blobs or only blobs created after a chosen time. Each source account can replicate to up to two destination accounts.

Replication is asynchronous and usually completes within minutes, and the replication status of each source blob shows whether it succeeded. The destination container is read-only for replicated blobs while the policy is in place.

The following diagram shows, in order, the prerequisites for object replication between storage accounts in two regions.

Prerequisites for object replication from West Europe to Southeast Asia. Object replication does not support accounts with a hierarchical namespace, so the destination must be a general-purpose v2 account without it. Versioning is enabled on both accounts and change feed on the source, then a rule filtered on the approved/ prefix copies the blobs.
The scenario is illustrative.
True or false

Replication policies

Exam skills 2.2.3

Check how object replication policies and rules behave.

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

Prerequisites and limitations

Object replication depends on two other features. Blob versioning must be enabled on both the source and destination accounts, because replication is driven by versions, and change feed must be enabled on the source account, because it records the changes to replicate. Both accounts must be general-purpose v2 or premium block blob accounts.

It replicates block blobs only, not append or page blobs; it is not supported for accounts with a hierarchical namespace; blobs in the Archive tier are not replicated; and snapshots are not replicated. Deleting a blob version in the source does not delete it in the destination. The table below compares object replication with geo-redundant storage.

Object replicationGRS / RA-GRS
DestinationAny account and region you chooseThe fixed paired region
GranularityPer container, with prefix filtersWhole account
Destination readableYes, alwaysOnly with RA- options or after failover
PrerequisitesVersioning on both, change feed on sourceNone
Scenario questions

Object replication or GRS?

Exam skills 2.2.3 · 2.2.2

Decide when object replication is the right choice and what it will copy.

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

Distributing data for analysis

Images uploaded to a container in an account in West Europe must be copied automatically to an account in Southeast Asia, where an analytics team processes them. Only blobs with the prefix approved/ should be copied. The Southeast Asia account has a hierarchical namespace enabled. What must change before object replication can be configured?

Object replication is not supported for accounts with a hierarchical namespace, so the destination must be a general-purpose v2 account without hierarchical namespace. Then enable versioning on both accounts and change feed on the source, and create a policy with a rule filtered on the approved/ prefix. RA-GRS could not be used because its secondary region is fixed to West Europe's pair and covers the whole account.

Check yourself

Which features must be enabled before object replication can be configured?

Show answer

Blob versioning on both the source and destination accounts, and change feed on the source account.

Exam Tips

Remember for the exam

  • Enable versioning on both accounts and change feed on the source first.
  • Object replication copies block blobs only and not to or from hierarchical namespace accounts.
  • Replicated blobs in the destination are read-only.
  • Choose object replication when the destination region or account must be chosen.