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=2026-04-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
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
Sample request
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/dst112/objectReplicationPolicies/default?api-version=2026-04-01
{
"properties": {
"destinationAccount": "dst112",
"metrics": {
"enabled": true
},
"priorityReplication": {
"enabled": true
},
"rules": [
{
"destinationContainer": "dcont139",
"filters": {
"prefixMatch": [
"blobA",
"blobB"
]
},
"sourceContainer": "scont139"
}
],
"sourceAccount": "src1122",
"tagsReplication": {
"enabled": true
}
}
}
import com.azure.resourcemanager.storage.fluent.models.ObjectReplicationPolicyInner;
import com.azure.resourcemanager.storage.models.ObjectReplicationPolicyFilter;
import com.azure.resourcemanager.storage.models.ObjectReplicationPolicyPropertiesMetrics;
import com.azure.resourcemanager.storage.models.ObjectReplicationPolicyPropertiesPriorityReplication;
import com.azure.resourcemanager.storage.models.ObjectReplicationPolicyPropertiesTagsReplication;
import com.azure.resourcemanager.storage.models.ObjectReplicationPolicyRule;
import java.util.Arrays;
/**
* Samples for ObjectReplicationPoliciesOperation CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-04-01/StorageAccountCreateObjectReplicationPolicyOnDestination.json
*/
/**
* Sample code: StorageAccountCreateObjectReplicationPolicyOnDestination.
*
* @param manager Entry point to StorageManager.
*/
public static void storageAccountCreateObjectReplicationPolicyOnDestination(
com.azure.resourcemanager.storage.StorageManager manager) {
manager.serviceClient().getObjectReplicationPoliciesOperations().createOrUpdateWithResponse("res7687", "dst112",
"default",
new ObjectReplicationPolicyInner().withSourceAccount("src1122").withDestinationAccount("dst112")
.withRules(Arrays.asList(new ObjectReplicationPolicyRule().withSourceContainer("scont139")
.withDestinationContainer("dcont139")
.withFilters(new ObjectReplicationPolicyFilter().withPrefixMatch(Arrays.asList("blobA", "blobB")))))
.withMetrics(new ObjectReplicationPolicyPropertiesMetrics().withEnabled(true))
.withPriorityReplication(new ObjectReplicationPolicyPropertiesPriorityReplication().withEnabled(true))
.withTagsReplication(new ObjectReplicationPolicyPropertiesTagsReplication().withEnabled(true)),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armstorage_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/v4"
)
// Generated from example definition: 2026-04-01/StorageAccountCreateObjectReplicationPolicyOnDestination.json
func ExampleObjectReplicationPoliciesClient_CreateOrUpdate_storageAccountCreateObjectReplicationPolicyOnDestination() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armstorage.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewObjectReplicationPoliciesClient().CreateOrUpdate(ctx, "res7687", "dst112", "default", armstorage.ObjectReplicationPolicy{
Properties: &armstorage.ObjectReplicationPolicyProperties{
DestinationAccount: to.Ptr("dst112"),
Metrics: &armstorage.ObjectReplicationPolicyPropertiesMetrics{
Enabled: to.Ptr(true),
},
PriorityReplication: &armstorage.ObjectReplicationPolicyPropertiesPriorityReplication{
Enabled: to.Ptr(true),
},
Rules: []*armstorage.ObjectReplicationPolicyRule{
{
DestinationContainer: to.Ptr("dcont139"),
Filters: &armstorage.ObjectReplicationPolicyFilter{
PrefixMatch: []*string{
to.Ptr("blobA"),
to.Ptr("blobB"),
},
},
SourceContainer: to.Ptr("scont139"),
},
},
SourceAccount: to.Ptr("src1122"),
TagsReplication: &armstorage.ObjectReplicationPolicyPropertiesTagsReplication{
Enabled: to.Ptr(true),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armstorage.ObjectReplicationPoliciesClientCreateOrUpdateResponse{
// ObjectReplicationPolicy: armstorage.ObjectReplicationPolicy{
// Name: to.Ptr("2a20bb73-5717-4635-985a-5d4cf777438f"),
// Type: to.Ptr("Microsoft.Storage/storageAccounts/objectReplicationPolicies"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/dst112/objectReplicationPolicies/2a20bb73-5717-4635-985a-5d4cf777438f"),
// Properties: &armstorage.ObjectReplicationPolicyProperties{
// DestinationAccount: to.Ptr("dst112"),
// Metrics: &armstorage.ObjectReplicationPolicyPropertiesMetrics{
// Enabled: to.Ptr(true),
// },
// PriorityReplication: &armstorage.ObjectReplicationPolicyPropertiesPriorityReplication{
// Enabled: to.Ptr(true),
// },
// PolicyID: to.Ptr("2a20bb73-5717-4635-985a-5d4cf777438f"),
// Rules: []*armstorage.ObjectReplicationPolicyRule{
// {
// DestinationContainer: to.Ptr("destContainer1"),
// Filters: &armstorage.ObjectReplicationPolicyFilter{
// PrefixMatch: []*string{
// to.Ptr("blobA"),
// to.Ptr("blobB"),
// },
// },
// RuleID: to.Ptr("d5d18a48-8801-4554-aeaa-74faf65f5ef9"),
// SourceContainer: to.Ptr("sourceContainer1"),
// },
// },
// SourceAccount: to.Ptr("src1122"),
// TagsReplication: &armstorage.ObjectReplicationPolicyPropertiesTagsReplication{
// Enabled: to.Ptr(true),
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { StorageManagementClient } = require("@azure/arm-storage");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to create or update the object replication policy of the storage account.
*
* @summary create or update the object replication policy of the storage account.
* x-ms-original-file: 2026-04-01/StorageAccountCreateObjectReplicationPolicyOnDestination.json
*/
async function storageAccountCreateObjectReplicationPolicyOnDestination() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new StorageManagementClient(credential, subscriptionId);
const result = await client.objectReplicationPolicies.createOrUpdate(
"res7687",
"dst112",
"default",
{
destinationAccount: "dst112",
metrics: { enabled: true },
priorityReplication: { enabled: true },
rules: [
{
destinationContainer: "dcont139",
filters: { prefixMatch: ["blobA", "blobB"] },
sourceContainer: "scont139",
},
],
sourceAccount: "src1122",
tagsReplication: { enabled: true },
},
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
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=2026-04-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
}
}
}
import com.azure.resourcemanager.storage.fluent.models.ObjectReplicationPolicyInner;
import com.azure.resourcemanager.storage.models.ObjectReplicationPolicyFilter;
import com.azure.resourcemanager.storage.models.ObjectReplicationPolicyPropertiesMetrics;
import com.azure.resourcemanager.storage.models.ObjectReplicationPolicyPropertiesPriorityReplication;
import com.azure.resourcemanager.storage.models.ObjectReplicationPolicyPropertiesTagsReplication;
import com.azure.resourcemanager.storage.models.ObjectReplicationPolicyRule;
import java.util.Arrays;
/**
* Samples for ObjectReplicationPoliciesOperation CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-04-01/StorageAccountCreateObjectReplicationPolicyOnSource.json
*/
/**
* Sample code: StorageAccountCreateObjectReplicationPolicyOnSource.
*
* @param manager Entry point to StorageManager.
*/
public static void
storageAccountCreateObjectReplicationPolicyOnSource(com.azure.resourcemanager.storage.StorageManager manager) {
manager.serviceClient().getObjectReplicationPoliciesOperations().createOrUpdateWithResponse("res7687",
"src1122", "2a20bb73-5717-4635-985a-5d4cf777438f",
new ObjectReplicationPolicyInner().withSourceAccount("src1122").withDestinationAccount("dst112")
.withRules(Arrays.asList(new ObjectReplicationPolicyRule()
.withRuleId("d5d18a48-8801-4554-aeaa-74faf65f5ef9").withSourceContainer("scont139")
.withDestinationContainer("dcont139")
.withFilters(new ObjectReplicationPolicyFilter().withPrefixMatch(Arrays.asList("blobA", "blobB"))
.withMinCreationTime("2020-02-19T16:05:00Z"))))
.withMetrics(new ObjectReplicationPolicyPropertiesMetrics().withEnabled(true))
.withPriorityReplication(new ObjectReplicationPolicyPropertiesPriorityReplication().withEnabled(true))
.withTagsReplication(new ObjectReplicationPolicyPropertiesTagsReplication().withEnabled(true)),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armstorage_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/v4"
)
// Generated from example definition: 2026-04-01/StorageAccountCreateObjectReplicationPolicyOnSource.json
func ExampleObjectReplicationPoliciesClient_CreateOrUpdate_storageAccountCreateObjectReplicationPolicyOnSource() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armstorage.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewObjectReplicationPoliciesClient().CreateOrUpdate(ctx, "res7687", "src1122", "2a20bb73-5717-4635-985a-5d4cf777438f", armstorage.ObjectReplicationPolicy{
Properties: &armstorage.ObjectReplicationPolicyProperties{
DestinationAccount: to.Ptr("dst112"),
Metrics: &armstorage.ObjectReplicationPolicyPropertiesMetrics{
Enabled: to.Ptr(true),
},
PriorityReplication: &armstorage.ObjectReplicationPolicyPropertiesPriorityReplication{
Enabled: to.Ptr(true),
},
Rules: []*armstorage.ObjectReplicationPolicyRule{
{
DestinationContainer: to.Ptr("dcont139"),
Filters: &armstorage.ObjectReplicationPolicyFilter{
MinCreationTime: to.Ptr("2020-02-19T16:05:00Z"),
PrefixMatch: []*string{
to.Ptr("blobA"),
to.Ptr("blobB"),
},
},
RuleID: to.Ptr("d5d18a48-8801-4554-aeaa-74faf65f5ef9"),
SourceContainer: to.Ptr("scont139"),
},
},
SourceAccount: to.Ptr("src1122"),
TagsReplication: &armstorage.ObjectReplicationPolicyPropertiesTagsReplication{
Enabled: to.Ptr(true),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armstorage.ObjectReplicationPoliciesClientCreateOrUpdateResponse{
// ObjectReplicationPolicy: armstorage.ObjectReplicationPolicy{
// Name: to.Ptr("2a20bb73-5717-4635-985a-5d4cf777438f"),
// Type: to.Ptr("Microsoft.Storage/storageAccounts/objectReplicationPolicies"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/src1122/objectReplicationPolicies/2a20bb73-5717-4635-985a-5d4cf777438f"),
// Properties: &armstorage.ObjectReplicationPolicyProperties{
// DestinationAccount: to.Ptr("dst112"),
// EnabledTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-08T03:01:55.7168089Z"); return t}()),
// Metrics: &armstorage.ObjectReplicationPolicyPropertiesMetrics{
// Enabled: to.Ptr(true),
// },
// PriorityReplication: &armstorage.ObjectReplicationPolicyPropertiesPriorityReplication{
// Enabled: to.Ptr(true),
// },
// PolicyID: to.Ptr("2a20bb73-5717-4635-985a-5d4cf777438f"),
// Rules: []*armstorage.ObjectReplicationPolicyRule{
// {
// DestinationContainer: to.Ptr("destContainer1"),
// Filters: &armstorage.ObjectReplicationPolicyFilter{
// MinCreationTime: to.Ptr("2020-02-19T16:05:00Z"),
// PrefixMatch: []*string{
// to.Ptr("blobA"),
// to.Ptr("blobB"),
// },
// },
// RuleID: to.Ptr("d5d18a48-8801-4554-aeaa-74faf65f5ef9"),
// SourceContainer: to.Ptr("sourceContainer1"),
// },
// },
// SourceAccount: to.Ptr("src1122"),
// TagsReplication: &armstorage.ObjectReplicationPolicyPropertiesTagsReplication{
// Enabled: to.Ptr(true),
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { StorageManagementClient } = require("@azure/arm-storage");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to create or update the object replication policy of the storage account.
*
* @summary create or update the object replication policy of the storage account.
* x-ms-original-file: 2026-04-01/StorageAccountCreateObjectReplicationPolicyOnSource.json
*/
async function storageAccountCreateObjectReplicationPolicyOnSource() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new StorageManagementClient(credential, subscriptionId);
const result = await client.objectReplicationPolicies.createOrUpdate(
"res7687",
"src1122",
"2a20bb73-5717-4635-985a-5d4cf777438f",
{
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 },
},
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
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=2026-04-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
}
}
}
import com.azure.resourcemanager.storage.fluent.models.ObjectReplicationPolicyInner;
import com.azure.resourcemanager.storage.models.ObjectReplicationPolicyFilter;
import com.azure.resourcemanager.storage.models.ObjectReplicationPolicyPropertiesMetrics;
import com.azure.resourcemanager.storage.models.ObjectReplicationPolicyPropertiesPriorityReplication;
import com.azure.resourcemanager.storage.models.ObjectReplicationPolicyPropertiesTagsReplication;
import com.azure.resourcemanager.storage.models.ObjectReplicationPolicyRule;
import java.util.Arrays;
/**
* Samples for ObjectReplicationPoliciesOperation CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-04-01/StorageAccountUpdateObjectReplicationPolicyOnDestination.json
*/
/**
* Sample code: StorageAccountUpdateObjectReplicationPolicyOnDestination.
*
* @param manager Entry point to StorageManager.
*/
public static void storageAccountUpdateObjectReplicationPolicyOnDestination(
com.azure.resourcemanager.storage.StorageManager manager) {
manager.serviceClient().getObjectReplicationPoliciesOperations()
.createOrUpdateWithResponse("res7687", "dst112", "2a20bb73-5717-4635-985a-5d4cf777438f",
new ObjectReplicationPolicyInner().withSourceAccount("src1122").withDestinationAccount("dst112")
.withRules(
Arrays.asList(
new ObjectReplicationPolicyRule().withRuleId("d5d18a48-8801-4554-aeaa-74faf65f5ef9")
.withSourceContainer("scont139").withDestinationContainer("dcont139")
.withFilters(new ObjectReplicationPolicyFilter()
.withPrefixMatch(Arrays.asList("blobA", "blobB"))),
new ObjectReplicationPolicyRule().withSourceContainer("scont179")
.withDestinationContainer("dcont179")))
.withMetrics(new ObjectReplicationPolicyPropertiesMetrics().withEnabled(true))
.withPriorityReplication(
new ObjectReplicationPolicyPropertiesPriorityReplication().withEnabled(true))
.withTagsReplication(new ObjectReplicationPolicyPropertiesTagsReplication().withEnabled(true)),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armstorage_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/v4"
)
// Generated from example definition: 2026-04-01/StorageAccountUpdateObjectReplicationPolicyOnDestination.json
func ExampleObjectReplicationPoliciesClient_CreateOrUpdate_storageAccountUpdateObjectReplicationPolicyOnDestination() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armstorage.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewObjectReplicationPoliciesClient().CreateOrUpdate(ctx, "res7687", "dst112", "2a20bb73-5717-4635-985a-5d4cf777438f", armstorage.ObjectReplicationPolicy{
Properties: &armstorage.ObjectReplicationPolicyProperties{
DestinationAccount: to.Ptr("dst112"),
Metrics: &armstorage.ObjectReplicationPolicyPropertiesMetrics{
Enabled: to.Ptr(true),
},
PriorityReplication: &armstorage.ObjectReplicationPolicyPropertiesPriorityReplication{
Enabled: to.Ptr(true),
},
Rules: []*armstorage.ObjectReplicationPolicyRule{
{
DestinationContainer: to.Ptr("dcont139"),
Filters: &armstorage.ObjectReplicationPolicyFilter{
PrefixMatch: []*string{
to.Ptr("blobA"),
to.Ptr("blobB"),
},
},
RuleID: to.Ptr("d5d18a48-8801-4554-aeaa-74faf65f5ef9"),
SourceContainer: to.Ptr("scont139"),
},
{
DestinationContainer: to.Ptr("dcont179"),
SourceContainer: to.Ptr("scont179"),
},
},
SourceAccount: to.Ptr("src1122"),
TagsReplication: &armstorage.ObjectReplicationPolicyPropertiesTagsReplication{
Enabled: to.Ptr(true),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armstorage.ObjectReplicationPoliciesClientCreateOrUpdateResponse{
// ObjectReplicationPolicy: armstorage.ObjectReplicationPolicy{
// Name: to.Ptr("2a20bb73-5717-4635-985a-5d4cf777438f"),
// Type: to.Ptr("Microsoft.Storage/storageAccounts/objectReplicationPolicies"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/dst112/objectReplicationPolicies/2a20bb73-5717-4635-985a-5d4cf777438f"),
// Properties: &armstorage.ObjectReplicationPolicyProperties{
// DestinationAccount: to.Ptr("dst112"),
// Metrics: &armstorage.ObjectReplicationPolicyPropertiesMetrics{
// Enabled: to.Ptr(true),
// },
// PriorityReplication: &armstorage.ObjectReplicationPolicyPropertiesPriorityReplication{
// Enabled: to.Ptr(true),
// },
// PolicyID: to.Ptr("2a20bb73-5717-4635-985a-5d4cf777438f"),
// Rules: []*armstorage.ObjectReplicationPolicyRule{
// {
// DestinationContainer: to.Ptr("destContainer1"),
// Filters: &armstorage.ObjectReplicationPolicyFilter{
// PrefixMatch: []*string{
// to.Ptr("blobA"),
// to.Ptr("blobB"),
// },
// },
// RuleID: to.Ptr("d5d18a48-8801-4554-aeaa-74faf65f5ef9"),
// SourceContainer: to.Ptr("sourceContainer1"),
// },
// {
// DestinationContainer: to.Ptr("dcont179"),
// RuleID: to.Ptr("cfbb4bc2-8b60-429f-b05a-d1e0942b33b2"),
// SourceContainer: to.Ptr("scont179"),
// },
// },
// SourceAccount: to.Ptr("src1122"),
// TagsReplication: &armstorage.ObjectReplicationPolicyPropertiesTagsReplication{
// Enabled: to.Ptr(true),
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { StorageManagementClient } = require("@azure/arm-storage");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to create or update the object replication policy of the storage account.
*
* @summary create or update the object replication policy of the storage account.
* x-ms-original-file: 2026-04-01/StorageAccountUpdateObjectReplicationPolicyOnDestination.json
*/
async function storageAccountUpdateObjectReplicationPolicyOnDestination() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new StorageManagementClient(credential, subscriptionId);
const result = await client.objectReplicationPolicies.createOrUpdate(
"res7687",
"dst112",
"2a20bb73-5717-4635-985a-5d4cf777438f",
{
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 },
},
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
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=2026-04-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
}
}
}
import com.azure.resourcemanager.storage.fluent.models.ObjectReplicationPolicyInner;
import com.azure.resourcemanager.storage.models.ObjectReplicationPolicyFilter;
import com.azure.resourcemanager.storage.models.ObjectReplicationPolicyPropertiesMetrics;
import com.azure.resourcemanager.storage.models.ObjectReplicationPolicyPropertiesPriorityReplication;
import com.azure.resourcemanager.storage.models.ObjectReplicationPolicyPropertiesTagsReplication;
import com.azure.resourcemanager.storage.models.ObjectReplicationPolicyRule;
import java.util.Arrays;
/**
* Samples for ObjectReplicationPoliciesOperation CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-04-01/StorageAccountUpdateObjectReplicationPolicyOnSource.json
*/
/**
* Sample code: StorageAccountUpdateObjectReplicationPolicyOnSource.
*
* @param manager Entry point to StorageManager.
*/
public static void
storageAccountUpdateObjectReplicationPolicyOnSource(com.azure.resourcemanager.storage.StorageManager manager) {
manager.serviceClient().getObjectReplicationPoliciesOperations()
.createOrUpdateWithResponse("res7687", "src1122", "2a20bb73-5717-4635-985a-5d4cf777438f",
new ObjectReplicationPolicyInner().withSourceAccount("src1122").withDestinationAccount("dst112")
.withRules(
Arrays.asList(
new ObjectReplicationPolicyRule().withRuleId("d5d18a48-8801-4554-aeaa-74faf65f5ef9")
.withSourceContainer("scont139").withDestinationContainer("dcont139")
.withFilters(new ObjectReplicationPolicyFilter()
.withPrefixMatch(Arrays.asList("blobA", "blobB"))),
new ObjectReplicationPolicyRule().withRuleId("cfbb4bc2-8b60-429f-b05a-d1e0942b33b2")
.withSourceContainer("scont179").withDestinationContainer("dcont179")))
.withMetrics(new ObjectReplicationPolicyPropertiesMetrics().withEnabled(true))
.withPriorityReplication(
new ObjectReplicationPolicyPropertiesPriorityReplication().withEnabled(true))
.withTagsReplication(new ObjectReplicationPolicyPropertiesTagsReplication().withEnabled(true)),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armstorage_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/v4"
)
// Generated from example definition: 2026-04-01/StorageAccountUpdateObjectReplicationPolicyOnSource.json
func ExampleObjectReplicationPoliciesClient_CreateOrUpdate_storageAccountUpdateObjectReplicationPolicyOnSource() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armstorage.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewObjectReplicationPoliciesClient().CreateOrUpdate(ctx, "res7687", "src1122", "2a20bb73-5717-4635-985a-5d4cf777438f", armstorage.ObjectReplicationPolicy{
Properties: &armstorage.ObjectReplicationPolicyProperties{
DestinationAccount: to.Ptr("dst112"),
Metrics: &armstorage.ObjectReplicationPolicyPropertiesMetrics{
Enabled: to.Ptr(true),
},
PriorityReplication: &armstorage.ObjectReplicationPolicyPropertiesPriorityReplication{
Enabled: to.Ptr(true),
},
Rules: []*armstorage.ObjectReplicationPolicyRule{
{
DestinationContainer: to.Ptr("dcont139"),
Filters: &armstorage.ObjectReplicationPolicyFilter{
PrefixMatch: []*string{
to.Ptr("blobA"),
to.Ptr("blobB"),
},
},
RuleID: to.Ptr("d5d18a48-8801-4554-aeaa-74faf65f5ef9"),
SourceContainer: to.Ptr("scont139"),
},
{
DestinationContainer: to.Ptr("dcont179"),
RuleID: to.Ptr("cfbb4bc2-8b60-429f-b05a-d1e0942b33b2"),
SourceContainer: to.Ptr("scont179"),
},
},
SourceAccount: to.Ptr("src1122"),
TagsReplication: &armstorage.ObjectReplicationPolicyPropertiesTagsReplication{
Enabled: to.Ptr(true),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armstorage.ObjectReplicationPoliciesClientCreateOrUpdateResponse{
// ObjectReplicationPolicy: armstorage.ObjectReplicationPolicy{
// Name: to.Ptr("2a20bb73-5717-4635-985a-5d4cf777438f"),
// Type: to.Ptr("Microsoft.Storage/storageAccounts/objectReplicationPolicies"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/src1122/objectReplicationPolicies/2a20bb73-5717-4635-985a-5d4cf777438f"),
// Properties: &armstorage.ObjectReplicationPolicyProperties{
// DestinationAccount: to.Ptr("dst112"),
// EnabledTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-06-08T03:01:55.7168089Z"); return t}()),
// Metrics: &armstorage.ObjectReplicationPolicyPropertiesMetrics{
// Enabled: to.Ptr(true),
// },
// PriorityReplication: &armstorage.ObjectReplicationPolicyPropertiesPriorityReplication{
// Enabled: to.Ptr(true),
// },
// PolicyID: to.Ptr("2a20bb73-5717-4635-985a-5d4cf777438f"),
// Rules: []*armstorage.ObjectReplicationPolicyRule{
// {
// DestinationContainer: to.Ptr("destContainer1"),
// Filters: &armstorage.ObjectReplicationPolicyFilter{
// PrefixMatch: []*string{
// to.Ptr("blobA"),
// to.Ptr("blobB"),
// },
// },
// RuleID: to.Ptr("d5d18a48-8801-4554-aeaa-74faf65f5ef9"),
// SourceContainer: to.Ptr("sourceContainer1"),
// },
// {
// DestinationContainer: to.Ptr("dcont179"),
// RuleID: to.Ptr("cfbb4bc2-8b60-429f-b05a-d1e0942b33b2"),
// SourceContainer: to.Ptr("scont179"),
// },
// },
// SourceAccount: to.Ptr("src1122"),
// TagsReplication: &armstorage.ObjectReplicationPolicyPropertiesTagsReplication{
// Enabled: to.Ptr(true),
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { StorageManagementClient } = require("@azure/arm-storage");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to create or update the object replication policy of the storage account.
*
* @summary create or update the object replication policy of the storage account.
* x-ms-original-file: 2026-04-01/StorageAccountUpdateObjectReplicationPolicyOnSource.json
*/
async function storageAccountUpdateObjectReplicationPolicyOnSource() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new StorageManagementClient(credential, subscriptionId);
const result = await client.objectReplicationPolicies.createOrUpdate(
"res7687",
"src1122",
"2a20bb73-5717-4635-985a-5d4cf777438f",
{
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 },
},
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
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
createdByType
Enumeration
The type of identity that created the resource.
| Value |
Description |
|
User
|
|
|
Application
|
|
|
ManagedIdentity
|
|
|
Key
|
|
ErrorResponse
Object
An error response from the storage resource provider.
| Name |
Type |
Description |
|
error
|
ErrorResponseBody
|
Azure Storage Resource Provider error response body.
|
ErrorResponseBody
Object
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
Object
The replication policy between two storage accounts. Multiple rules can be defined in one policy.
| Name |
Type |
Description |
|
id
|
string
(arm-id)
|
Fully qualified resource ID for the resource. E.g. "/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.
|
|
systemData
|
systemData
|
Azure Resource Manager metadata containing createdBy and modifiedBy information.
|
|
type
|
string
|
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
|
ObjectReplicationPolicyFilter
Object
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
Object
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
Object
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.
|
Object
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
Object
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.
|
systemData
Object
Metadata pertaining to creation and last modification of the resource.
| Name |
Type |
Description |
|
createdAt
|
string
(date-time)
|
The timestamp of resource creation (UTC).
|
|
createdBy
|
string
|
The identity that created the resource.
|
|
createdByType
|
createdByType
|
The type of identity that created the resource.
|
|
lastModifiedAt
|
string
(date-time)
|
The timestamp of resource last modification (UTC)
|
|
lastModifiedBy
|
string
|
The identity that last modified the resource.
|
|
lastModifiedByType
|
createdByType
|
The type of identity that last modified the resource.
|