1. Packages
  2. Azure Classic
  3. API Docs
  4. siterecovery
  5. ReplicationPolicy

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.siterecovery.ReplicationPolicy

Explore with Pulumi AI

Manages a Azure Site Recovery replication policy within a recovery vault. Replication policies define the frequency at which recovery points are created and how long they are stored.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = new azure.core.ResourceGroup("example", {
    name: "tfex-network-mapping-secondary",
    location: "East US",
});
const vault = new azure.recoveryservices.Vault("vault", {
    name: "example-recovery-vault",
    location: example.location,
    resourceGroupName: example.name,
    sku: "Standard",
});
const policy = new azure.siterecovery.ReplicationPolicy("policy", {
    name: "policy",
    resourceGroupName: example.name,
    recoveryVaultName: vault.name,
    recoveryPointRetentionInMinutes: 24 * 60,
    applicationConsistentSnapshotFrequencyInMinutes: 4 * 60,
});
Copy
import pulumi
import pulumi_azure as azure

example = azure.core.ResourceGroup("example",
    name="tfex-network-mapping-secondary",
    location="East US")
vault = azure.recoveryservices.Vault("vault",
    name="example-recovery-vault",
    location=example.location,
    resource_group_name=example.name,
    sku="Standard")
policy = azure.siterecovery.ReplicationPolicy("policy",
    name="policy",
    resource_group_name=example.name,
    recovery_vault_name=vault.name,
    recovery_point_retention_in_minutes=24 * 60,
    application_consistent_snapshot_frequency_in_minutes=4 * 60)
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/recoveryservices"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/siterecovery"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
			Name:     pulumi.String("tfex-network-mapping-secondary"),
			Location: pulumi.String("East US"),
		})
		if err != nil {
			return err
		}
		vault, err := recoveryservices.NewVault(ctx, "vault", &recoveryservices.VaultArgs{
			Name:              pulumi.String("example-recovery-vault"),
			Location:          example.Location,
			ResourceGroupName: example.Name,
			Sku:               pulumi.String("Standard"),
		})
		if err != nil {
			return err
		}
		_, err = siterecovery.NewReplicationPolicy(ctx, "policy", &siterecovery.ReplicationPolicyArgs{
			Name:                            pulumi.String("policy"),
			ResourceGroupName:               example.Name,
			RecoveryVaultName:               vault.Name,
			RecoveryPointRetentionInMinutes: int(24 * 60),
			ApplicationConsistentSnapshotFrequencyInMinutes: int(4 * 60),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = new Azure.Core.ResourceGroup("example", new()
    {
        Name = "tfex-network-mapping-secondary",
        Location = "East US",
    });

    var vault = new Azure.RecoveryServices.Vault("vault", new()
    {
        Name = "example-recovery-vault",
        Location = example.Location,
        ResourceGroupName = example.Name,
        Sku = "Standard",
    });

    var policy = new Azure.SiteRecovery.ReplicationPolicy("policy", new()
    {
        Name = "policy",
        ResourceGroupName = example.Name,
        RecoveryVaultName = vault.Name,
        RecoveryPointRetentionInMinutes = 24 * 60,
        ApplicationConsistentSnapshotFrequencyInMinutes = 4 * 60,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.recoveryservices.Vault;
import com.pulumi.azure.recoveryservices.VaultArgs;
import com.pulumi.azure.siterecovery.ReplicationPolicy;
import com.pulumi.azure.siterecovery.ReplicationPolicyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new ResourceGroup("example", ResourceGroupArgs.builder()
            .name("tfex-network-mapping-secondary")
            .location("East US")
            .build());

        var vault = new Vault("vault", VaultArgs.builder()
            .name("example-recovery-vault")
            .location(example.location())
            .resourceGroupName(example.name())
            .sku("Standard")
            .build());

        var policy = new ReplicationPolicy("policy", ReplicationPolicyArgs.builder()
            .name("policy")
            .resourceGroupName(example.name())
            .recoveryVaultName(vault.name())
            .recoveryPointRetentionInMinutes(24 * 60)
            .applicationConsistentSnapshotFrequencyInMinutes(4 * 60)
            .build());

    }
}
Copy
Coming soon!

Create ReplicationPolicy Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ReplicationPolicy(name: string, args: ReplicationPolicyArgs, opts?: CustomResourceOptions);
@overload
def ReplicationPolicy(resource_name: str,
                      args: ReplicationPolicyArgs,
                      opts: Optional[ResourceOptions] = None)

@overload
def ReplicationPolicy(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      application_consistent_snapshot_frequency_in_minutes: Optional[int] = None,
                      recovery_point_retention_in_minutes: Optional[int] = None,
                      recovery_vault_name: Optional[str] = None,
                      resource_group_name: Optional[str] = None,
                      name: Optional[str] = None)
func NewReplicationPolicy(ctx *Context, name string, args ReplicationPolicyArgs, opts ...ResourceOption) (*ReplicationPolicy, error)
public ReplicationPolicy(string name, ReplicationPolicyArgs args, CustomResourceOptions? opts = null)
public ReplicationPolicy(String name, ReplicationPolicyArgs args)
public ReplicationPolicy(String name, ReplicationPolicyArgs args, CustomResourceOptions options)
type: azure:siterecovery:ReplicationPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ReplicationPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ReplicationPolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ReplicationPolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ReplicationPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ReplicationPolicyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var replicationPolicyResource = new Azure.SiteRecovery.ReplicationPolicy("replicationPolicyResource", new()
{
    ApplicationConsistentSnapshotFrequencyInMinutes = 0,
    RecoveryPointRetentionInMinutes = 0,
    RecoveryVaultName = "string",
    ResourceGroupName = "string",
    Name = "string",
});
Copy
example, err := siterecovery.NewReplicationPolicy(ctx, "replicationPolicyResource", &siterecovery.ReplicationPolicyArgs{
	ApplicationConsistentSnapshotFrequencyInMinutes: pulumi.Int(0),
	RecoveryPointRetentionInMinutes:                 pulumi.Int(0),
	RecoveryVaultName:                               pulumi.String("string"),
	ResourceGroupName:                               pulumi.String("string"),
	Name:                                            pulumi.String("string"),
})
Copy
var replicationPolicyResource = new ReplicationPolicy("replicationPolicyResource", ReplicationPolicyArgs.builder()
    .applicationConsistentSnapshotFrequencyInMinutes(0)
    .recoveryPointRetentionInMinutes(0)
    .recoveryVaultName("string")
    .resourceGroupName("string")
    .name("string")
    .build());
Copy
replication_policy_resource = azure.siterecovery.ReplicationPolicy("replicationPolicyResource",
    application_consistent_snapshot_frequency_in_minutes=0,
    recovery_point_retention_in_minutes=0,
    recovery_vault_name="string",
    resource_group_name="string",
    name="string")
Copy
const replicationPolicyResource = new azure.siterecovery.ReplicationPolicy("replicationPolicyResource", {
    applicationConsistentSnapshotFrequencyInMinutes: 0,
    recoveryPointRetentionInMinutes: 0,
    recoveryVaultName: "string",
    resourceGroupName: "string",
    name: "string",
});
Copy
type: azure:siterecovery:ReplicationPolicy
properties:
    applicationConsistentSnapshotFrequencyInMinutes: 0
    name: string
    recoveryPointRetentionInMinutes: 0
    recoveryVaultName: string
    resourceGroupName: string
Copy

ReplicationPolicy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ReplicationPolicy resource accepts the following input properties:

ApplicationConsistentSnapshotFrequencyInMinutes This property is required. int

Specifies the frequency(in minutes) at which to create application consistent recovery points.

Note: The value of application_consistent_snapshot_frequency_in_minutes must be less than or equal to the value of recovery_point_retention_in_minutes.

RecoveryPointRetentionInMinutes This property is required. int
The duration in minutes for which the recovery points need to be stored.
RecoveryVaultName
This property is required.
Changes to this property will trigger replacement.
string
The name of the vault that should be updated. Changing this forces a new resource to be created.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
Name Changes to this property will trigger replacement. string
The name of the replication policy. Changing this forces a new resource to be created.
ApplicationConsistentSnapshotFrequencyInMinutes This property is required. int

Specifies the frequency(in minutes) at which to create application consistent recovery points.

Note: The value of application_consistent_snapshot_frequency_in_minutes must be less than or equal to the value of recovery_point_retention_in_minutes.

RecoveryPointRetentionInMinutes This property is required. int
The duration in minutes for which the recovery points need to be stored.
RecoveryVaultName
This property is required.
Changes to this property will trigger replacement.
string
The name of the vault that should be updated. Changing this forces a new resource to be created.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
Name Changes to this property will trigger replacement. string
The name of the replication policy. Changing this forces a new resource to be created.
applicationConsistentSnapshotFrequencyInMinutes This property is required. Integer

Specifies the frequency(in minutes) at which to create application consistent recovery points.

Note: The value of application_consistent_snapshot_frequency_in_minutes must be less than or equal to the value of recovery_point_retention_in_minutes.

recoveryPointRetentionInMinutes This property is required. Integer
The duration in minutes for which the recovery points need to be stored.
recoveryVaultName
This property is required.
Changes to this property will trigger replacement.
String
The name of the vault that should be updated. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. String
The name of the replication policy. Changing this forces a new resource to be created.
applicationConsistentSnapshotFrequencyInMinutes This property is required. number

Specifies the frequency(in minutes) at which to create application consistent recovery points.

Note: The value of application_consistent_snapshot_frequency_in_minutes must be less than or equal to the value of recovery_point_retention_in_minutes.

recoveryPointRetentionInMinutes This property is required. number
The duration in minutes for which the recovery points need to be stored.
recoveryVaultName
This property is required.
Changes to this property will trigger replacement.
string
The name of the vault that should be updated. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. string
The name of the replication policy. Changing this forces a new resource to be created.
application_consistent_snapshot_frequency_in_minutes This property is required. int

Specifies the frequency(in minutes) at which to create application consistent recovery points.

Note: The value of application_consistent_snapshot_frequency_in_minutes must be less than or equal to the value of recovery_point_retention_in_minutes.

recovery_point_retention_in_minutes This property is required. int
The duration in minutes for which the recovery points need to be stored.
recovery_vault_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the vault that should be updated. Changing this forces a new resource to be created.
resource_group_name
This property is required.
Changes to this property will trigger replacement.
str
Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. str
The name of the replication policy. Changing this forces a new resource to be created.
applicationConsistentSnapshotFrequencyInMinutes This property is required. Number

Specifies the frequency(in minutes) at which to create application consistent recovery points.

Note: The value of application_consistent_snapshot_frequency_in_minutes must be less than or equal to the value of recovery_point_retention_in_minutes.

recoveryPointRetentionInMinutes This property is required. Number
The duration in minutes for which the recovery points need to be stored.
recoveryVaultName
This property is required.
Changes to this property will trigger replacement.
String
The name of the vault that should be updated. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. String
The name of the replication policy. Changing this forces a new resource to be created.

Outputs

All input properties are implicitly available as output properties. Additionally, the ReplicationPolicy resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing ReplicationPolicy Resource

Get an existing ReplicationPolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ReplicationPolicyState, opts?: CustomResourceOptions): ReplicationPolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        application_consistent_snapshot_frequency_in_minutes: Optional[int] = None,
        name: Optional[str] = None,
        recovery_point_retention_in_minutes: Optional[int] = None,
        recovery_vault_name: Optional[str] = None,
        resource_group_name: Optional[str] = None) -> ReplicationPolicy
func GetReplicationPolicy(ctx *Context, name string, id IDInput, state *ReplicationPolicyState, opts ...ResourceOption) (*ReplicationPolicy, error)
public static ReplicationPolicy Get(string name, Input<string> id, ReplicationPolicyState? state, CustomResourceOptions? opts = null)
public static ReplicationPolicy get(String name, Output<String> id, ReplicationPolicyState state, CustomResourceOptions options)
resources:  _:    type: azure:siterecovery:ReplicationPolicy    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
ApplicationConsistentSnapshotFrequencyInMinutes int

Specifies the frequency(in minutes) at which to create application consistent recovery points.

Note: The value of application_consistent_snapshot_frequency_in_minutes must be less than or equal to the value of recovery_point_retention_in_minutes.

Name Changes to this property will trigger replacement. string
The name of the replication policy. Changing this forces a new resource to be created.
RecoveryPointRetentionInMinutes int
The duration in minutes for which the recovery points need to be stored.
RecoveryVaultName Changes to this property will trigger replacement. string
The name of the vault that should be updated. Changing this forces a new resource to be created.
ResourceGroupName Changes to this property will trigger replacement. string
Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
ApplicationConsistentSnapshotFrequencyInMinutes int

Specifies the frequency(in minutes) at which to create application consistent recovery points.

Note: The value of application_consistent_snapshot_frequency_in_minutes must be less than or equal to the value of recovery_point_retention_in_minutes.

Name Changes to this property will trigger replacement. string
The name of the replication policy. Changing this forces a new resource to be created.
RecoveryPointRetentionInMinutes int
The duration in minutes for which the recovery points need to be stored.
RecoveryVaultName Changes to this property will trigger replacement. string
The name of the vault that should be updated. Changing this forces a new resource to be created.
ResourceGroupName Changes to this property will trigger replacement. string
Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
applicationConsistentSnapshotFrequencyInMinutes Integer

Specifies the frequency(in minutes) at which to create application consistent recovery points.

Note: The value of application_consistent_snapshot_frequency_in_minutes must be less than or equal to the value of recovery_point_retention_in_minutes.

name Changes to this property will trigger replacement. String
The name of the replication policy. Changing this forces a new resource to be created.
recoveryPointRetentionInMinutes Integer
The duration in minutes for which the recovery points need to be stored.
recoveryVaultName Changes to this property will trigger replacement. String
The name of the vault that should be updated. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. String
Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
applicationConsistentSnapshotFrequencyInMinutes number

Specifies the frequency(in minutes) at which to create application consistent recovery points.

Note: The value of application_consistent_snapshot_frequency_in_minutes must be less than or equal to the value of recovery_point_retention_in_minutes.

name Changes to this property will trigger replacement. string
The name of the replication policy. Changing this forces a new resource to be created.
recoveryPointRetentionInMinutes number
The duration in minutes for which the recovery points need to be stored.
recoveryVaultName Changes to this property will trigger replacement. string
The name of the vault that should be updated. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. string
Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
application_consistent_snapshot_frequency_in_minutes int

Specifies the frequency(in minutes) at which to create application consistent recovery points.

Note: The value of application_consistent_snapshot_frequency_in_minutes must be less than or equal to the value of recovery_point_retention_in_minutes.

name Changes to this property will trigger replacement. str
The name of the replication policy. Changing this forces a new resource to be created.
recovery_point_retention_in_minutes int
The duration in minutes for which the recovery points need to be stored.
recovery_vault_name Changes to this property will trigger replacement. str
The name of the vault that should be updated. Changing this forces a new resource to be created.
resource_group_name Changes to this property will trigger replacement. str
Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
applicationConsistentSnapshotFrequencyInMinutes Number

Specifies the frequency(in minutes) at which to create application consistent recovery points.

Note: The value of application_consistent_snapshot_frequency_in_minutes must be less than or equal to the value of recovery_point_retention_in_minutes.

name Changes to this property will trigger replacement. String
The name of the replication policy. Changing this forces a new resource to be created.
recoveryPointRetentionInMinutes Number
The duration in minutes for which the recovery points need to be stored.
recoveryVaultName Changes to this property will trigger replacement. String
The name of the vault that should be updated. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. String
Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.

Import

Site Recovery Replication Policies can be imported using the resource id, e.g.

$ pulumi import azure:siterecovery/replicationPolicy:ReplicationPolicy mypolicy /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-group-name/providers/Microsoft.RecoveryServices/vaults/recovery-vault-name/replicationPolicies/policy-name
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.