Share via


Backup Policies - Create Or Update

Creates or Updates a backup policy belonging to a backup vault

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}?api-version=2025-02-01

URI Parameters

Name In Required Type Description
backupPolicyName
path True

string

Name of the policy

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.

vaultName
path True

string

The name of the backup vault.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Request Body

Name Type Description
properties BaseBackupPolicy:

BackupPolicy

BaseBackupPolicy
BaseBackupPolicyResource properties

Responses

Name Type Description
200 OK

BaseBackupPolicyResource

OK

Other Status Codes

CloudError

Error response describing why the operation failed.

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

CreateOrUpdate BackupPolicy

Sample request

PUT https://management.azure.com/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/backupVaults/PrivatePreviewVault/backupPolicies/OSSDBPolicy?api-version=2025-02-01

{
  "properties": {
    "policyRules": [
      {
        "backupParameters": {
          "backupType": "Full",
          "objectType": "AzureBackupParams"
        },
        "trigger": {
          "schedule": {
            "repeatingTimeIntervals": [
              "R/2019-11-20T08:00:00-08:00/P1W"
            ]
          },
          "taggingCriteria": [
            {
              "tagInfo": {
                "tagName": "Default"
              },
              "taggingPriority": 99,
              "isDefault": true
            },
            {
              "tagInfo": {
                "tagName": "Weekly"
              },
              "taggingPriority": 20,
              "isDefault": false,
              "criteria": [
                {
                  "scheduleTimes": [
                    "2019-03-01T13:00:00Z"
                  ],
                  "daysOfTheWeek": [
                    "Sunday"
                  ],
                  "objectType": "ScheduleBasedBackupCriteria"
                }
              ]
            }
          ],
          "objectType": "ScheduleBasedTriggerContext"
        },
        "dataStore": {
          "dataStoreType": "VaultStore",
          "objectType": "DataStoreInfoBase"
        },
        "name": "BackupWeekly",
        "objectType": "AzureBackupRule"
      },
      {
        "lifecycles": [
          {
            "sourceDataStore": {
              "dataStoreType": "VaultStore",
              "objectType": "DataStoreInfoBase"
            },
            "deleteAfter": {
              "objectType": "AbsoluteDeleteOption",
              "duration": "P1W"
            }
          }
        ],
        "isDefault": true,
        "name": "Default",
        "objectType": "AzureRetentionRule"
      },
      {
        "lifecycles": [
          {
            "sourceDataStore": {
              "dataStoreType": "VaultStore",
              "objectType": "DataStoreInfoBase"
            },
            "deleteAfter": {
              "objectType": "AbsoluteDeleteOption",
              "duration": "P12W"
            }
          }
        ],
        "isDefault": false,
        "name": "Weekly",
        "objectType": "AzureRetentionRule"
      }
    ],
    "datasourceTypes": [
      "OssDB"
    ],
    "objectType": "BackupPolicy"
  }
}

Sample response

{
  "id": "/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/backupVaults/PrivatePreviewVault/backupPolicies/OSSDBPolicy",
  "name": "OSSDBPolicy",
  "type": "Microsoft.DataProtection/backupVaults/backupPolicies",
  "properties": {
    "policyRules": [
      {
        "backupParameters": {
          "backupType": "Full",
          "objectType": "AzureBackupParams"
        },
        "trigger": {
          "schedule": {
            "repeatingTimeIntervals": [
              "R/2019-11-20T08:00:00-08:00/P1W"
            ]
          },
          "taggingCriteria": [
            {
              "tagInfo": {
                "tagName": "Default",
                "id": "Default_"
              },
              "taggingPriority": 99,
              "isDefault": true
            },
            {
              "tagInfo": {
                "tagName": "Weekly",
                "id": "Weekly_"
              },
              "taggingPriority": 20,
              "isDefault": false,
              "criteria": [
                {
                  "scheduleTimes": [
                    "2019-03-01T13:00:00Z"
                  ],
                  "daysOfTheWeek": [
                    "Sunday"
                  ],
                  "objectType": "ScheduleBasedBackupCriteria"
                }
              ]
            }
          ],
          "objectType": "ScheduleBasedTriggerContext"
        },
        "dataStore": {
          "dataStoreType": "VaultStore",
          "objectType": "DataStoreInfoBase"
        },
        "name": "BackupWeekly",
        "objectType": "AzureBackupRule"
      },
      {
        "lifecycles": [
          {
            "sourceDataStore": {
              "dataStoreType": "VaultStore",
              "objectType": "DataStoreInfoBase"
            },
            "deleteAfter": {
              "objectType": "AbsoluteDeleteOption",
              "duration": "P1W"
            }
          }
        ],
        "isDefault": true,
        "name": "Default",
        "objectType": "AzureRetentionRule"
      },
      {
        "lifecycles": [
          {
            "sourceDataStore": {
              "dataStoreType": "VaultStore",
              "objectType": "DataStoreInfoBase"
            },
            "deleteAfter": {
              "objectType": "AbsoluteDeleteOption",
              "duration": "P12W"
            }
          }
        ],
        "isDefault": false,
        "name": "Weekly",
        "objectType": "AzureRetentionRule"
      }
    ],
    "datasourceTypes": [
      "OssDB"
    ],
    "objectType": "BackupPolicy"
  }
}

Definitions

Name Description
AbsoluteDeleteOption

AbsoluteDeleteOption

AbsoluteMarker

it contains absolute values like "AllBackup" / "FirstOfDay" / "FirstOfWeek" / "FirstOfMonth" and should be part of AbsoluteMarker enum

AdhocBasedTaggingCriteria

AdhocBasedTaggingCriteria

AdhocBasedTriggerContext

AdhocBasedTriggerContext

AzureBackupParams

AzureBackupParams

AzureBackupRule

AzureBackupRule

AzureRetentionRule

AzureRetentionRule

BackupPolicy

BackupPolicy

BackupSchedule

BackupSchedule

BaseBackupPolicyResource

BaseBackupPolicyResource

CloudError

CloudError

CopyOnExpiryOption

CopyOnExpiryOption

createdByType

The type of identity that created the resource.

CustomCopyOption

CustomCopyOption

DataStoreInfoBase

DataStoreInfoBase

DataStoreTypes

type of datastore; Operational/Vault/Archive

Day

Day

DayOfWeek

It should be Sunday/Monday/T..../Saturday

Error

The resource management error response.

ErrorAdditionalInfo

The resource management error additional info.

ImmediateCopyOption

ImmediateCopyOption

Month

It should be January/February/....../December

RetentionTag

RetentionTag

ScheduleBasedBackupCriteria

ScheduleBasedBackupCriteria

ScheduleBasedTriggerContext

ScheduleBasedTriggerContext

SourceLifeCycle

SourceLifeCycle

systemData

Metadata pertaining to creation and last modification of the resource.

TaggingCriteria

TaggingCriteria

TargetCopySetting

TargetCopySetting

WeekNumber

It should be First/Second/Third/Fourth/Last

AbsoluteDeleteOption

AbsoluteDeleteOption

Name Type Description
duration

string

Duration of deletion after given timespan

objectType string:

AbsoluteDeleteOption

Type of the specific object - used for deserializing

AbsoluteMarker

it contains absolute values like "AllBackup" / "FirstOfDay" / "FirstOfWeek" / "FirstOfMonth" and should be part of AbsoluteMarker enum

Value Description
AllBackup
FirstOfDay
FirstOfMonth
FirstOfWeek
FirstOfYear

AdhocBasedTaggingCriteria

AdhocBasedTaggingCriteria

Name Type Description
tagInfo

RetentionTag

RetentionTag
Retention tag information

AdhocBasedTriggerContext

AdhocBasedTriggerContext

Name Type Description
objectType string:

AdhocBasedTriggerContext

Type of the specific object - used for deserializing

taggingCriteria

AdhocBasedTaggingCriteria

AdhocBasedTaggingCriteria
Tagging Criteria containing retention tag for adhoc backup.

AzureBackupParams

AzureBackupParams

Name Type Description
backupType

string

BackupType ; Full/Incremental etc

objectType string:

AzureBackupParams

Type of the specific object - used for deserializing

AzureBackupRule

AzureBackupRule

Name Type Description
backupParameters BackupParameters:

AzureBackupParams

BackupParameters
BackupParameters base

dataStore

DataStoreInfoBase

DataStoreInfoBase
DataStoreInfo base

name

string

objectType string:

AzureBackupRule

trigger TriggerContext:

TriggerContext
Trigger context

AzureRetentionRule

AzureRetentionRule

Name Type Description
isDefault

boolean

lifecycles

SourceLifeCycle[]

SourceLifeCycle
Source LifeCycle

name

string

objectType string:

AzureRetentionRule

BackupPolicy

BackupPolicy

Name Type Description
datasourceTypes

string[]

Type of datasource for the backup management

objectType string:

BackupPolicy

policyRules BasePolicyRule[]:

Policy rule dictionary that contains rules for each backuptype i.e Full/Incremental/Logs etc

BackupSchedule

BackupSchedule

Name Type Description
repeatingTimeIntervals

string[]

ISO 8601 repeating time interval format

timeZone

string

Time zone for a schedule. Example: Pacific Standard Time

BaseBackupPolicyResource

BaseBackupPolicyResource

Name Type Description
id

string

Resource Id represents the complete path to the resource.

name

string

Resource name associated with the resource.

properties BaseBackupPolicy:

BackupPolicy

BaseBackupPolicy
BaseBackupPolicyResource properties

systemData

systemData

Metadata pertaining to creation and last modification of the resource.

type

string

Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/...

CloudError

CloudError

Name Type Description
error

Error

The resource management error response.

CopyOnExpiryOption

CopyOnExpiryOption

Name Type Description
objectType string:

CopyOnExpiryOption

Type of the specific object - used for deserializing

createdByType

The type of identity that created the resource.

Value Description
Application
Key
ManagedIdentity
User

CustomCopyOption

CustomCopyOption

Name Type Description
duration

string

Data copied after given timespan

objectType string:

CustomCopyOption

Type of the specific object - used for deserializing

DataStoreInfoBase

DataStoreInfoBase

Name Type Description
dataStoreType

DataStoreTypes

type of datastore; Operational/Vault/Archive

objectType

string

Type of Datasource object, used to initialize the right inherited type

DataStoreTypes

type of datastore; Operational/Vault/Archive

Value Description
ArchiveStore
OperationalStore
VaultStore

Day

Day

Name Type Description
date

integer (int32)

Date of the month

isLast

boolean

Whether Date is last date of month

DayOfWeek

It should be Sunday/Monday/T..../Saturday

Value Description
Friday
Monday
Saturday
Sunday
Thursday
Tuesday
Wednesday

Error

The resource management error response.

Name Type Description
additionalInfo

ErrorAdditionalInfo[]

The error additional info.

code

string

The error code.

details

Error[]

The error details.

message

string

The error message.

target

string

The error target.

ErrorAdditionalInfo

The resource management error additional info.

Name Type Description
info

object

The additional info.

type

string

The additional info type.

ImmediateCopyOption

ImmediateCopyOption

Name Type Description
objectType string:

ImmediateCopyOption

Type of the specific object - used for deserializing

Month

It should be January/February/....../December

Value Description
April
August
December
February
January
July
June
March
May
November
October
September

RetentionTag

RetentionTag

Name Type Description
eTag

string

Retention Tag version.

id

string

Retention Tag version.

tagName

string

Retention Tag Name to relate it to retention rule.

ScheduleBasedBackupCriteria

ScheduleBasedBackupCriteria

Name Type Description
absoluteCriteria

AbsoluteMarker[]

it contains absolute values like "AllBackup" / "FirstOfDay" / "FirstOfWeek" / "FirstOfMonth" and should be part of AbsoluteMarker enum

daysOfMonth

Day[]

This is day of the month from 1 to 28 other wise last of month

daysOfTheWeek

DayOfWeek[]

It should be Sunday/Monday/T..../Saturday

monthsOfYear

Month[]

It should be January/February/....../December

objectType string:

ScheduleBasedBackupCriteria

Type of the specific object - used for deserializing

scheduleTimes

string[] (date-time)

List of schedule times for backup

weeksOfTheMonth

WeekNumber[]

It should be First/Second/Third/Fourth/Last

ScheduleBasedTriggerContext

ScheduleBasedTriggerContext

Name Type Description
objectType string:

ScheduleBasedTriggerContext

Type of the specific object - used for deserializing

schedule

BackupSchedule

BackupSchedule
Schedule for this backup

taggingCriteria

TaggingCriteria[]

List of tags that can be applicable for given schedule.

SourceLifeCycle

SourceLifeCycle

Name Type Description
deleteAfter DeleteOption:

AbsoluteDeleteOption

DeleteOption
Delete Option

sourceDataStore

DataStoreInfoBase

DataStoreInfoBase
DataStoreInfo base

targetDataStoreCopySettings

TargetCopySetting[]

TargetCopySetting
Target copy settings

systemData

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.

TaggingCriteria

TaggingCriteria

Name Type Description
criteria BackupCriteria[]:

ScheduleBasedBackupCriteria[]

Criteria which decides whether the tag can be applied to a triggered backup.

isDefault

boolean

Specifies if tag is default.

tagInfo

RetentionTag

RetentionTag
Retention tag information

taggingPriority

integer (int64)

Retention Tag priority.

TargetCopySetting

TargetCopySetting

Name Type Description
copyAfter CopyOption:

CopyOption
It can be CustomCopyOption or ImmediateCopyOption.

dataStore

DataStoreInfoBase

DataStoreInfoBase
Info of target datastore

WeekNumber

It should be First/Second/Third/Fourth/Last

Value Description
First
Fourth
Last
Second
Third