Create or update a policy
You can create backup policy in Recovery Services, which can be associated with protectable items. You can also update existing Recovery Services policies which the effect the protected items.
Request
Method | Request URI | HTTP Version |
---|---|---|
PUT | https://<VaultUrl>/backupPolicies/{policyName}?api-version=<api-version> |
HTTP/1.1 |
Request Header:
Common request headers described here.
Request Body:
Policy resource to be created or updated.
Example request:
{
"properties": {
"backupManagementType": "AzureIaaSVM",
"schedulePolicy": {
"schedulePolicyType": "SimpleSchedulePolicy",
"scheduleRunType": "Daily",
"scheduleRunTimes": [
"2015-11-20T01:00:00"
]
},
"retentionPolicy": {
"retentionPolicyType": "LongTermRetentionPolicy",
"dailySchedule": {
"retentionTimes": [
"2015-08-13T08:30:00Z"
],
"retentionDuration": {
"count": 180,
"durationType": "Weeks"
}
},
"weeklySchedule": {
"daysOfTheWeek": [
"Sunday"
],
"retentionTimes": [
"2015-08-13T08:30:00Z"
],
"retentionDuraction": {
"count": 104,
"durationType:" "Days"
}
},
"monthlySchedule": {
"retentionScheduleFormat": "Weekly",
"retentionScheduleWeekly": {
"daysOfTheWeek": [
"Sunday"
],
"weeksOfTheMonth": [
"Second"
]
},
"retentionTimes": [
"2015-08-13T08:30:00Z""
],
"retentionDuration": {
"count": 60,
"durationType": "Months"
}
},
"yearlySchedule": {
"retentionScheduleFormat": "Weekly",
"monthsOfYear": [
"January"
],
"retentionScheduleWeekly": {
"daysOfTheWeek": [
"Sunday"
],
"weeksOfTheMonth": [
"Second"
]
},
"retentionTimes": [
"2015-08-13T08:30:00Z"
],
"retentionDuration": {
"retentionDuration": {
"count": 10,
"durationType": "Years"
}
}
}
}
}
Parameter | Description |
---|---|
backupManagementType | Required: String Backup management type can be: AzureIaaSVM, MAB, DPM, or AzureSQL. |
schedulePolicy | Required: String Configuration object for backup schedule |
schedulePolicy.schedulePolicyType | Required: String Object type can be SimpleSchedulePolicy.Object types to support configuration settings such as incremental, differential, and log backup will be added later. |
schedulePolicy.scheduleRunType | Required: String Type of schedule can have one of the following values: Daily, Weekly. |
schedulePolicy.scheduleRunDays | Required: List<DayOfWeek> Days of week for running backup. Applicable for weekly schedule. |
schedule.Policy.scheduleRunTimes | Required: List<DateTime> Times of day for running backup. |
retentionPolicy | Required: String Configuration object for backup retention. |
retentionPolicy.retentionPolicyType | Required:String Object type can be SimpleRetentionPolicy or LongTermRetentionPolicy. |
retentionPolicy.dailySchedule.retentionTimes | Required: List<DateTime> Determines daily schedule time for retention. |
retentionPolicy.dailySchedule.retentionDuration.count | Required: Int Duration of retention for the recovery point in units specified by durationType. |
retentionPolicy.dailySchedule.retentionDuration.durationType | Required: String(RetentionDurationType) Unit of retention for the recovery point, can have one of these values: Days, Weeks, Months, Years. |
retentionPolicy.weeklySchedule.daysOfTheWeek | Required: List<DayOfWeek> Days of the week is an array of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday. |
retentionPolicy.weeklySchedule.retentionTimes | Required: List<DateTime> Determines weekly schedule time for retention. |
retentionPolicy.weeklySchedule.retentionDuration.count | Required: int Duration of retention for the recovery point in units specified by durationType. |
retentionPolicy.weeklySchedule.retentionDuration.durationType | Required: String(RetentionScheduleFormat) Determines format of monthly retention schedule. Can have one of these values: Daily or Weekly. |
retentionPolicy.monthlySchedule.retentionScheduleFormat | Required: String(RetentionScheduleFormat) Determines format of monthly retention schedule. Can have one of these values: Daily or Weekly. |
retentionPolicy.monthlySchedule.retentionScheduleDaily.daysOfTheMonth[].date | Required: int Day can be a number from 1 to 28 (except when isLast is true). |
retentionPolicy.monthlySchedule.retentionScheduleDaily.daysOfTheMonth[].isLast | Required: bool true for last day of the month |
retentionPolicy.montlySchedule.retentionScheduleDaily.daysOfTheWeek[] | Required: String true for last day of the month |
retentionPolicy.monthlySchedule.retentionScheduleWeekly.daysOfTHeWeek | Required: List<DayOfWeek> Days of the week is an array of Sunday, Monday, Tuesday, Wednesday,Thursday, Friday, Saturday. |
retentionPolicy.monthlySchedule.retentionScheduleWeekly.weeksOfTheMonth | Required: List<WeekNumber> Weeks of the month is an array of First, Second, Third, Fourth, Last. |
retentionPolicy.monthlySchedule.retentionTimes | Required: List<DateTime> Determines monthly schedule time for retention. |
retentionPolicy.monthlySchedule.retentionDuration.count | Required: int Duration of retention for the recovery point, can have one of these values: Days, Weeks, Months, Years. |
retentionPolicy.monthlySchedule.retentionDuration.durationType | Required: String Unit of retention for the recovery point, can hae one of these values: Days, Weeks, Months, Years. |
retentionPolicy.yearlySchedule.retentionScheduleFormat | Required: String(RetentionScheduleFormat) Determines format of monthly retention schedule. Can have one of these values: Daily or Weekly. |
retentionPolicy.yearlySchedule.monthsOfYear | Required: List<Month> Months of the year is an array of January, February, March, April, May, June, July, August, September, October, November, December |
retentionPolicy.yearlySchedule.retentionScheduleDaily.daysOfTheMonth[].isLast | Required: bool true for last day of the month. |
retentionPolicy.yearlySchedule.retentionScheduleWeekly.daysOfTheWeek | Required: String true for the last day of the month. |
retentionPolicy.yearlySchedule.retentionScheduleWeekly.daysOfTheWeek | Required:List<DayOfTheWeek> Days of the week is an array of Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday. |
retentionPolicy.yearlySchedule.retentionScheduleWeekly.weeksOfTheMonth | Required: List<WeekNumber> Weeks of the month is an array of First, Second, Third, Fourth, Last. |
Response
The response includes an HTTP status code, a set of response headers, and a response body. Response body will be a Policy resouce with 200 status code, or empty with 202 status code with Location and Azure-AsyncOperation common headers. Successful completion of the async operation tracked via Location header will have Policy object in response with 200 status code. To get more details of job performing requested operation, make a GET call on URL specified in Azure-AsyncOperation response header.
Response Header
Common response headers described here.
Response Body:
Single policy resource or empty body with 202 status code.
Example Response:
{
"id": "/Subscriptions/{id}/resourceGroups/{groupName}/providers/Microsoft.RecoveryServices/vaults{vaultName}/backupPolicies/testpolicy",
"name": "testpolicy"
"type": "Microsoft.RecoveryServices/vaults/backupPolicies",
"properties": {
"backupManagementType": "AzureIaaSVM",
"schedulePolicy": {
"scheduleRunType": "Daily",
"scheduleRunTimes": [
"2015-11-20T01:00:00"
]
},
"retentionPolicy": {
"retentionPolicyType": "LongTermRetentionPolicy",
"dailySchedule": {
"retentionTimes": [
2015-08-13T08:30:00Z"
],
"retentionDuration": {
"count": 180,
"durationType": "Days"
}
},
"weeklySchedule": {
"daysOfTheWeek": [
"Sunday"
],
"retentionTimes": {
"count": 104,
"durationType": "Months"
}
},
"montlySchedule": {
"retentionScheduleFormat": "Weekly",
"retentionScheduleWeekly": {
"daysOfTheWeek": [
"Sunday"
]
"weeksOfTheMonth": [
"Second"
]
},
"retentionTimes": [
"2015-09-13T08:30:00Z"
],
"retentionDuration": {
"count": 60,
"durationType": "Weeks"
}
},
"yearlySchedule": {
"retentionScheduleFormat": "Weekly",
"monthsOfYear": [
"January"
],
"retentionScheduleWeekly": {
"daysOfTheWeek": [
"Sunday"
],
"weeksOfTheMonth": [
"Second"
]
},
"retentionDuration": {
"count": 10,
"durationType": "Years"
}
}
}
}
}
Policy resource object attributes are the same as described in Create or Update policy section.