Share via


Object Replication Policies - Create Or Update

Create or update the object replication policy of the storage account.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}?api-version=2025-08-01

URI Parameters

Name In Required Type Description
accountName
path True

string

minLength: 3
maxLength: 24
pattern: ^[a-z0-9]+$

The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.

objectReplicationPolicyId
path True

string

minLength: 1

For the destination account, provide the value 'default'. Configure the policy on the destination account first. For the source account, provide the value of the policy ID that is returned when you download the policy that was defined on the destination account. The policy is downloaded as a JSON file.

resourceGroupName
path True

string

minLength: 1
maxLength: 90

The name of the resource group. The name is case insensitive.

subscriptionId
path True

string (uuid)

The ID of the target subscription. The value must be an UUID.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Request Body

Name Required Type Description
properties.destinationAccount True

string

Required. Destination account name. It should be full resource id if allowCrossTenantReplication set to false.

properties.sourceAccount True

string

Required. Source account name. It should be full resource id if allowCrossTenantReplication set to false.

properties.metrics

ObjectReplicationPolicyPropertiesMetrics

Optional. The object replication policy metrics feature options.

properties.priorityReplication

ObjectReplicationPolicyPropertiesPriorityReplication

Optional. The object replication policy priority replication feature options.

properties.rules

ObjectReplicationPolicyRule[]

The storage account object replication rules.

properties.tagsReplication

ObjectReplicationPolicyPropertiesTagsReplication

Optional. The object replication policy tags replication feature options.

Responses

Name Type Description
200 OK

ObjectReplicationPolicy

Resource 'ObjectReplicationPolicy' update operation succeeded

Other Status Codes

ErrorResponse

An unexpected error response.

Security

azure_auth

Azure Active Directory OAuth2 Flow.

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

StorageAccountCreateObjectReplicationPolicyOnDestination
StorageAccountCreateObjectReplicationPolicyOnSource
StorageAccountUpdateObjectReplicationPolicyOnDestination
StorageAccountUpdateObjectReplicationPolicyOnSource

StorageAccountCreateObjectReplicationPolicyOnDestination

Sample request

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/dst112/objectReplicationPolicies/default?api-version=2025-08-01

{
  "properties": {
    "destinationAccount": "dst112",
    "metrics": {
      "enabled": true
    },
    "priorityReplication": {
      "enabled": true
    },
    "rules": [
      {
        "destinationContainer": "dcont139",
        "filters": {
          "prefixMatch": [
            "blobA",
            "blobB"
          ]
        },
        "sourceContainer": "scont139"
      }
    ],
    "sourceAccount": "src1122",
    "tagsReplication": {
      "enabled": true
    }
  }
}

Sample response

{
  "name": "2a20bb73-5717-4635-985a-5d4cf777438f",
  "type": "Microsoft.Storage/storageAccounts/objectReplicationPolicies",
  "id": "/subscriptions/{subscription-id}/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/dst112/objectReplicationPolicies/2a20bb73-5717-4635-985a-5d4cf777438f",
  "properties": {
    "destinationAccount": "dst112",
    "metrics": {
      "enabled": true
    },
    "priorityReplication": {
      "enabled": true
    },
    "policyId": "2a20bb73-5717-4635-985a-5d4cf777438f",
    "rules": [
      {
        "destinationContainer": "destContainer1",
        "filters": {
          "prefixMatch": [
            "blobA",
            "blobB"
          ]
        },
        "ruleId": "d5d18a48-8801-4554-aeaa-74faf65f5ef9",
        "sourceContainer": "sourceContainer1"
      }
    ],
    "sourceAccount": "src1122",
    "tagsReplication": {
      "enabled": true
    }
  }
}

StorageAccountCreateObjectReplicationPolicyOnSource

Sample request

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/src1122/objectReplicationPolicies/2a20bb73-5717-4635-985a-5d4cf777438f?api-version=2025-08-01

{
  "properties": {
    "destinationAccount": "dst112",
    "metrics": {
      "enabled": true
    },
    "priorityReplication": {
      "enabled": true
    },
    "rules": [
      {
        "destinationContainer": "dcont139",
        "filters": {
          "minCreationTime": "2020-02-19T16:05:00Z",
          "prefixMatch": [
            "blobA",
            "blobB"
          ]
        },
        "ruleId": "d5d18a48-8801-4554-aeaa-74faf65f5ef9",
        "sourceContainer": "scont139"
      }
    ],
    "sourceAccount": "src1122",
    "tagsReplication": {
      "enabled": true
    }
  }
}

Sample response

{
  "name": "2a20bb73-5717-4635-985a-5d4cf777438f",
  "type": "Microsoft.Storage/storageAccounts/objectReplicationPolicies",
  "id": "/subscriptions/{subscription-id}/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/src1122/objectReplicationPolicies/2a20bb73-5717-4635-985a-5d4cf777438f",
  "properties": {
    "destinationAccount": "dst112",
    "enabledTime": "2019-06-08T03:01:55.7168089Z",
    "metrics": {
      "enabled": true
    },
    "priorityReplication": {
      "enabled": true
    },
    "policyId": "2a20bb73-5717-4635-985a-5d4cf777438f",
    "rules": [
      {
        "destinationContainer": "destContainer1",
        "filters": {
          "minCreationTime": "2020-02-19T16:05:00Z",
          "prefixMatch": [
            "blobA",
            "blobB"
          ]
        },
        "ruleId": "d5d18a48-8801-4554-aeaa-74faf65f5ef9",
        "sourceContainer": "sourceContainer1"
      }
    ],
    "sourceAccount": "src1122",
    "tagsReplication": {
      "enabled": true
    }
  }
}

StorageAccountUpdateObjectReplicationPolicyOnDestination

Sample request

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/dst112/objectReplicationPolicies/2a20bb73-5717-4635-985a-5d4cf777438f?api-version=2025-08-01

{
  "properties": {
    "destinationAccount": "dst112",
    "metrics": {
      "enabled": true
    },
    "priorityReplication": {
      "enabled": true
    },
    "rules": [
      {
        "destinationContainer": "dcont139",
        "filters": {
          "prefixMatch": [
            "blobA",
            "blobB"
          ]
        },
        "ruleId": "d5d18a48-8801-4554-aeaa-74faf65f5ef9",
        "sourceContainer": "scont139"
      },
      {
        "destinationContainer": "dcont179",
        "sourceContainer": "scont179"
      }
    ],
    "sourceAccount": "src1122",
    "tagsReplication": {
      "enabled": true
    }
  }
}

Sample response

{
  "name": "2a20bb73-5717-4635-985a-5d4cf777438f",
  "type": "Microsoft.Storage/storageAccounts/objectReplicationPolicies",
  "id": "/subscriptions/{subscription-id}/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/dst112/objectReplicationPolicies/2a20bb73-5717-4635-985a-5d4cf777438f",
  "properties": {
    "destinationAccount": "dst112",
    "metrics": {
      "enabled": true
    },
    "priorityReplication": {
      "enabled": true
    },
    "policyId": "2a20bb73-5717-4635-985a-5d4cf777438f",
    "rules": [
      {
        "destinationContainer": "destContainer1",
        "filters": {
          "prefixMatch": [
            "blobA",
            "blobB"
          ]
        },
        "ruleId": "d5d18a48-8801-4554-aeaa-74faf65f5ef9",
        "sourceContainer": "sourceContainer1"
      },
      {
        "destinationContainer": "dcont179",
        "ruleId": "cfbb4bc2-8b60-429f-b05a-d1e0942b33b2",
        "sourceContainer": "scont179"
      }
    ],
    "sourceAccount": "src1122",
    "tagsReplication": {
      "enabled": true
    }
  }
}

StorageAccountUpdateObjectReplicationPolicyOnSource

Sample request

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/src1122/objectReplicationPolicies/2a20bb73-5717-4635-985a-5d4cf777438f?api-version=2025-08-01

{
  "properties": {
    "destinationAccount": "dst112",
    "metrics": {
      "enabled": true
    },
    "priorityReplication": {
      "enabled": true
    },
    "rules": [
      {
        "destinationContainer": "dcont139",
        "filters": {
          "prefixMatch": [
            "blobA",
            "blobB"
          ]
        },
        "ruleId": "d5d18a48-8801-4554-aeaa-74faf65f5ef9",
        "sourceContainer": "scont139"
      },
      {
        "destinationContainer": "dcont179",
        "ruleId": "cfbb4bc2-8b60-429f-b05a-d1e0942b33b2",
        "sourceContainer": "scont179"
      }
    ],
    "sourceAccount": "src1122",
    "tagsReplication": {
      "enabled": true
    }
  }
}

Sample response

{
  "name": "2a20bb73-5717-4635-985a-5d4cf777438f",
  "type": "Microsoft.Storage/storageAccounts/objectReplicationPolicies",
  "id": "/subscriptions/{subscription-id}/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/src1122/objectReplicationPolicies/2a20bb73-5717-4635-985a-5d4cf777438f",
  "properties": {
    "destinationAccount": "dst112",
    "enabledTime": "2019-06-08T03:01:55.7168089Z",
    "metrics": {
      "enabled": true
    },
    "priorityReplication": {
      "enabled": true
    },
    "policyId": "2a20bb73-5717-4635-985a-5d4cf777438f",
    "rules": [
      {
        "destinationContainer": "destContainer1",
        "filters": {
          "prefixMatch": [
            "blobA",
            "blobB"
          ]
        },
        "ruleId": "d5d18a48-8801-4554-aeaa-74faf65f5ef9",
        "sourceContainer": "sourceContainer1"
      },
      {
        "destinationContainer": "dcont179",
        "ruleId": "cfbb4bc2-8b60-429f-b05a-d1e0942b33b2",
        "sourceContainer": "scont179"
      }
    ],
    "sourceAccount": "src1122",
    "tagsReplication": {
      "enabled": true
    }
  }
}

Definitions

Name Description
ErrorResponse

An error response from the storage resource provider.

ErrorResponseBody

Error response body contract.

ObjectReplicationPolicy

The replication policy between two storage accounts. Multiple rules can be defined in one policy.

ObjectReplicationPolicyFilter

Filters limit replication to a subset of blobs within the storage account. A logical OR is performed on values in the filter. If multiple filters are defined, a logical AND is performed on all filters.

ObjectReplicationPolicyPropertiesMetrics

Optional. The object replication policy metrics feature options.

ObjectReplicationPolicyPropertiesPriorityReplication

Optional. The object replication policy priority replication feature options.

ObjectReplicationPolicyPropertiesTagsReplication

Optional. The object replication policy tags replication feature options.

ObjectReplicationPolicyRule

The replication policy rule between two containers.

ErrorResponse

An error response from the storage resource provider.

Name Type Description
error

ErrorResponseBody

Azure Storage Resource Provider error response body.

ErrorResponseBody

Error response body contract.

Name Type Description
code

string

An identifier for the error. Codes are invariant and are intended to be consumed programmatically.

message

string

A message describing the error, intended to be suitable for display in a user interface.

ObjectReplicationPolicy

The replication policy between two storage accounts. Multiple rules can be defined in one policy.

Name Type Description
id

string

Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

The name of the resource

properties.destinationAccount

string

Required. Destination account name. It should be full resource id if allowCrossTenantReplication set to false.

properties.enabledTime

string (date-time)

Indicates when the policy is enabled on the source account.

properties.metrics

ObjectReplicationPolicyPropertiesMetrics

Optional. The object replication policy metrics feature options.

properties.policyId

string

A unique id for object replication policy.

properties.priorityReplication

ObjectReplicationPolicyPropertiesPriorityReplication

Optional. The object replication policy priority replication feature options.

properties.rules

ObjectReplicationPolicyRule[]

The storage account object replication rules.

properties.sourceAccount

string

Required. Source account name. It should be full resource id if allowCrossTenantReplication set to false.

properties.tagsReplication

ObjectReplicationPolicyPropertiesTagsReplication

Optional. The object replication policy tags replication feature options.

type

string

The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"

ObjectReplicationPolicyFilter

Filters limit replication to a subset of blobs within the storage account. A logical OR is performed on values in the filter. If multiple filters are defined, a logical AND is performed on all filters.

Name Type Description
minCreationTime

string

Blobs created after the time will be replicated to the destination. It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z

prefixMatch

string[]

Optional. Filters the results to replicate only blobs whose names begin with the specified prefix.

ObjectReplicationPolicyPropertiesMetrics

Optional. The object replication policy metrics feature options.

Name Type Description
enabled

boolean

Indicates whether object replication metrics feature is enabled for the policy.

ObjectReplicationPolicyPropertiesPriorityReplication

Optional. The object replication policy priority replication feature options.

Name Type Description
enabled

boolean

Indicates whether object replication priority replication feature is enabled for the policy.

ObjectReplicationPolicyPropertiesTagsReplication

Optional. The object replication policy tags replication feature options.

Name Type Description
enabled

boolean

Indicates whether object replication tags replication feature is enabled for the policy.

ObjectReplicationPolicyRule

The replication policy rule between two containers.

Name Type Description
destinationContainer

string

Required. Destination container name.

filters

ObjectReplicationPolicyFilter

Optional. An object that defines the filter set.

ruleId

string

Rule Id is auto-generated for each new rule on destination account. It is required for put policy on source account.

sourceContainer

string

Required. Source container name.