Backup Policies - Create Or Update
建立或更新屬於備份保存庫的備份原則
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}?api-version=2025-09-01
URI 參數
| 名稱 | 位於 | 必要 | 類型 | Description |
|---|---|---|---|---|
|
backup
|
path | True |
string |
|
|
resource
|
path | True |
string minLength: 1maxLength: 90 |
資源群組的名稱。 名稱不區分大小寫。 |
|
subscription
|
path | True |
string (uuid) |
目標訂用帳戶的標識碼。 此值必須是 UUID。 |
|
vault
|
path | True |
string |
備份保存庫的名稱。 |
|
api-version
|
query | True |
string minLength: 1 |
用於此作業的 API 版本。 |
要求本文
| 名稱 | 類型 | Description |
|---|---|---|
| properties | BaseBackupPolicy: |
BaseBackupPolicyResource 屬性 |
回應
| 名稱 | 類型 | Description |
|---|---|---|
| 200 OK |
資源 'BaseBackupPolicyResource' 更新作業成功 |
|
| Other Status Codes |
未預期的錯誤回應。 |
安全性
azure_auth
Azure Active Directory OAuth2 Flow。
類型:
oauth2
Flow:
implicit
授權 URL:
https://login.microsoftonline.com/common/oauth2/authorize
範圍
| 名稱 | Description |
|---|---|
| user_impersonation | 模擬您的用戶帳戶 |
範例
CreateOrUpdate BackupPolicy
範例要求
PUT https://management.azure.com/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/backupVaults/PrivatePreviewVault/backupPolicies/OSSDBPolicy?api-version=2025-09-01
{
"properties": {
"datasourceTypes": [
"OssDB"
],
"objectType": "BackupPolicy",
"policyRules": [
{
"name": "BackupWeekly",
"backupParameters": {
"backupType": "Full",
"objectType": "AzureBackupParams"
},
"dataStore": {
"dataStoreType": "VaultStore",
"objectType": "DataStoreInfoBase"
},
"objectType": "AzureBackupRule",
"trigger": {
"objectType": "ScheduleBasedTriggerContext",
"schedule": {
"repeatingTimeIntervals": [
"R/2019-11-20T08:00:00-08:00/P1W"
]
},
"taggingCriteria": [
{
"isDefault": true,
"tagInfo": {
"tagName": "Default"
},
"taggingPriority": 99
},
{
"criteria": [
{
"daysOfTheWeek": [
"Sunday"
],
"objectType": "ScheduleBasedBackupCriteria",
"scheduleTimes": [
"2019-03-01T13:00:00Z"
]
}
],
"isDefault": false,
"tagInfo": {
"tagName": "Weekly"
},
"taggingPriority": 20
}
]
}
},
{
"name": "Default",
"isDefault": true,
"lifecycles": [
{
"deleteAfter": {
"duration": "P1W",
"objectType": "AbsoluteDeleteOption"
},
"sourceDataStore": {
"dataStoreType": "VaultStore",
"objectType": "DataStoreInfoBase"
}
}
],
"objectType": "AzureRetentionRule"
},
{
"name": "Weekly",
"isDefault": false,
"lifecycles": [
{
"deleteAfter": {
"duration": "P12W",
"objectType": "AbsoluteDeleteOption"
},
"sourceDataStore": {
"dataStoreType": "VaultStore",
"objectType": "DataStoreInfoBase"
}
}
],
"objectType": "AzureRetentionRule"
}
]
}
}
範例回覆
{
"name": "OSSDBPolicy",
"type": "Microsoft.DataProtection/backupVaults/backupPolicies",
"id": "/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/backupVaults/PrivatePreviewVault/backupPolicies/OSSDBPolicy",
"properties": {
"datasourceTypes": [
"OssDB"
],
"objectType": "BackupPolicy",
"policyRules": [
{
"name": "BackupWeekly",
"backupParameters": {
"backupType": "Full",
"objectType": "AzureBackupParams"
},
"dataStore": {
"dataStoreType": "VaultStore",
"objectType": "DataStoreInfoBase"
},
"objectType": "AzureBackupRule",
"trigger": {
"objectType": "ScheduleBasedTriggerContext",
"schedule": {
"repeatingTimeIntervals": [
"R/2019-11-20T08:00:00-08:00/P1W"
]
},
"taggingCriteria": [
{
"isDefault": true,
"tagInfo": {
"id": "Default_",
"tagName": "Default"
},
"taggingPriority": 99
},
{
"criteria": [
{
"daysOfTheWeek": [
"Sunday"
],
"objectType": "ScheduleBasedBackupCriteria",
"scheduleTimes": [
"2019-03-01T13:00:00Z"
]
}
],
"isDefault": false,
"tagInfo": {
"id": "Weekly_",
"tagName": "Weekly"
},
"taggingPriority": 20
}
]
}
},
{
"name": "Default",
"isDefault": true,
"lifecycles": [
{
"deleteAfter": {
"duration": "P1W",
"objectType": "AbsoluteDeleteOption"
},
"sourceDataStore": {
"dataStoreType": "VaultStore",
"objectType": "DataStoreInfoBase"
}
}
],
"objectType": "AzureRetentionRule"
},
{
"name": "Weekly",
"isDefault": false,
"lifecycles": [
{
"deleteAfter": {
"duration": "P12W",
"objectType": "AbsoluteDeleteOption"
},
"sourceDataStore": {
"dataStoreType": "VaultStore",
"objectType": "DataStoreInfoBase"
}
}
],
"objectType": "AzureRetentionRule"
}
]
}
}
定義
| 名稱 | Description |
|---|---|
|
Absolute |
包含持續時間的刪除選項 |
|
Absolute |
|
|
Adhoc |
Adhoc 備份標記準則 |
|
Adhoc |
Adhoc 觸發程序內容 |
|
Azure |
Azure 備份參數 |
|
Azure |
Azure 備份規則 |
|
Azure |
Azure 保留規則 |
|
Backup |
以規則為基礎的備份原則 |
|
Backup |
備份排程 |
|
Base |
BaseBackupPolicy 資源 |
|
Cloud |
來自 Azure 備份的錯誤回應。 |
|
Copy |
複製到期選項 |
|
created |
建立資源的身分識別類型。 |
|
Custom |
要複製的持續時間型自定義選項 |
|
Data |
DataStoreInfo 基底 |
|
Data |
數據存放區的類型;Operational/Vault/Archive |
| Day |
一周中的一天 |
|
Day |
|
| Error |
資源管理錯誤回應。 |
|
Error |
資源管理錯誤其他資訊。 |
|
Immediate |
立即複製選項 |
| Month | |
|
Retention |
保留標籤 |
|
Schedule |
排程型備份準則 |
|
Schedule |
排程型觸發程序內容 |
|
Source |
來源 LifeCycle |
|
system |
與建立和上次修改資源相關的元數據。 |
|
Tagging |
標記條件 |
|
Target |
目標複製設定 |
|
Week |
AbsoluteDeleteOption
包含持續時間的刪除選項
| 名稱 | 類型 | Description |
|---|---|---|
| duration |
string |
指定時間範圍之後刪除的持續時間 |
| objectType | string: |
特定物件的類型 - 用於還原串行化 |
AbsoluteMarker
| 值 | Description |
|---|---|
| AllBackup | |
| FirstOfDay | |
| FirstOfMonth | |
| FirstOfWeek | |
| FirstOfYear |
AdhocBasedTaggingCriteria
Adhoc 備份標記準則
| 名稱 | 類型 | Description |
|---|---|---|
| tagInfo |
保留標記資訊 |
AdhocBasedTriggerContext
Adhoc 觸發程序內容
| 名稱 | 類型 | Description |
|---|---|---|
| objectType | string: |
特定物件的類型 - 用於還原串行化 |
| taggingCriteria |
標記準則,其中包含臨機作備份的保留標記。 |
AzureBackupParams
Azure 備份參數
| 名稱 | 類型 | Description |
|---|---|---|
| backupType |
string |
BackupType ;完整/累加等 |
| objectType | string: |
特定物件的類型 - 用於還原串行化 |
AzureBackupRule
Azure 備份規則
| 名稱 | 類型 | Description |
|---|---|---|
| backupParameters | BackupParameters: |
BackupParameters 基底 |
| dataStore |
DataStoreInfo 基底 |
|
| name |
string |
|
| objectType | string: | |
| trigger | TriggerContext: |
觸發程序內容 |
AzureRetentionRule
Azure 保留規則
| 名稱 | 類型 | Description |
|---|---|---|
| isDefault |
boolean |
|
| lifecycles |
來源 LifeCycle |
|
| name |
string |
|
| objectType | string: |
BackupPolicy
以規則為基礎的備份原則
| 名稱 | 類型 | Description |
|---|---|---|
| datasourceTypes |
string[] |
備份管理的數據源類型 |
| objectType | string: | |
| policyRules | BasePolicyRule[]: |
原則規則字典,其中包含每個備份類型的規則,例如完整/累加/記錄等 |
BackupSchedule
備份排程
| 名稱 | 類型 | Description |
|---|---|---|
| repeatingTimeIntervals |
string[] |
重複的時間間隔,支援 ISO 8601 格式及不支援或部分支援格式。 支援的 ISO 8601 時間格式 以下時間格式已驗證成功解析並支援:
上述所有指標可能包含時區指示器,如「Z」、「+05:30」、「-08:00」。 支援時間戳的範例:
不支援或部分支援的格式:
|
| timeZone |
string |
時區是排班表。 支援的時區指標包括:
範例:
|
BaseBackupPolicyResource
BaseBackupPolicy 資源
| 名稱 | 類型 | Description |
|---|---|---|
| id |
string (arm-id) |
資源的完整資源標識碼。 例如 “/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}” |
| name |
string |
資源的名稱 |
| properties | BaseBackupPolicy: |
BaseBackupPolicyResource 屬性 |
| systemData |
包含 createdBy 和 modifiedBy 資訊的 Azure Resource Manager 元數據。 |
|
| type |
string |
資源的類型。 例如“Microsoft.Compute/virtualMachines” 或 “Microsoft.Storage/storageAccounts” |
CloudError
來自 Azure 備份的錯誤回應。
| 名稱 | 類型 | Description |
|---|---|---|
| error |
資源管理錯誤回應。 |
CopyOnExpiryOption
複製到期選項
| 名稱 | 類型 | Description |
|---|---|---|
| objectType | string: |
特定物件的類型 - 用於還原串行化 |
createdByType
建立資源的身分識別類型。
| 值 | Description |
|---|---|
| User | |
| Application | |
| ManagedIdentity | |
| Key |
CustomCopyOption
要複製的持續時間型自定義選項
| 名稱 | 類型 | Description |
|---|---|---|
| duration |
string |
在指定時間範圍之後複製的數據 |
| objectType | string: |
特定物件的類型 - 用於還原串行化 |
DataStoreInfoBase
DataStoreInfo 基底
| 名稱 | 類型 | Description |
|---|---|---|
| dataStoreType |
數據存放區的類型;Operational/Vault/Archive |
|
| objectType |
string |
Datasource 物件的類型,用來初始化正確的繼承類型 |
DataStoreTypes
數據存放區的類型;Operational/Vault/Archive
| 值 | Description |
|---|---|
| OperationalStore | |
| VaultStore | |
| ArchiveStore |
Day
一周中的一天
| 名稱 | 類型 | Description |
|---|---|---|
| date |
integer (int32) |
月份的日期 |
| isLast |
boolean |
Date 是否為月份的最後一個日期 |
DayOfWeek
| 值 | Description |
|---|---|
| Friday | |
| Monday | |
| Saturday | |
| Sunday | |
| Thursday | |
| Tuesday | |
| Wednesday |
Error
資源管理錯誤回應。
| 名稱 | 類型 | Description |
|---|---|---|
| additionalInfo |
錯誤其他資訊。 |
|
| code |
string |
錯誤碼。 |
| details |
Error[] |
錯誤詳細數據。 |
| message |
string |
錯誤訊息。 |
| target |
string |
錯誤目標。 |
ErrorAdditionalInfo
資源管理錯誤其他資訊。
| 名稱 | 類型 | Description |
|---|---|---|
| info |
object |
其他資訊。 |
| type |
string |
其他信息類型。 |
ImmediateCopyOption
立即複製選項
| 名稱 | 類型 | Description |
|---|---|---|
| objectType | string: |
特定物件的類型 - 用於還原串行化 |
Month
| 值 | Description |
|---|---|
| April | |
| August | |
| December | |
| February | |
| January | |
| July | |
| June | |
| March | |
| May | |
| November | |
| October | |
| September |
RetentionTag
保留標籤
| 名稱 | 類型 | Description |
|---|---|---|
| eTag |
string |
保留標記版本。 |
| id |
string |
保留標記版本。 |
| tagName |
string |
保留標記名稱,使其與保留規則相關聯。 |
ScheduleBasedBackupCriteria
排程型備份準則
| 名稱 | 類型 | Description |
|---|---|---|
| absoluteCriteria |
它包含絕對值,例如 “AllBackup” / “FirstOfDay” / “FirstOfWeek” / “FirstOfMonth” ,且應該是 AbsoluteMarker 列舉的一部分 |
|
| daysOfMonth |
Day[] |
這是當月 1 到 28 日的日期,否則為上個月 |
| daysOfTheWeek |
應該是星期日/星期一/T..../星期六 |
|
| monthsOfYear |
Month[] |
應該是 1 月/2 月/....../12 月 |
| objectType | string: |
特定物件的類型 - 用於還原串行化 |
| scheduleTimes |
string[] (date-time) |
備份的排程時間清單 |
| weeksOfTheMonth |
應該是 First/Second/Third/Fourth/Last |
ScheduleBasedTriggerContext
排程型觸發程序內容
| 名稱 | 類型 | Description |
|---|---|---|
| objectType | string: |
特定物件的類型 - 用於還原串行化 |
| schedule |
此備份的排程 |
|
| taggingCriteria |
適用於指定排程的標記清單。 |
SourceLifeCycle
來源 LifeCycle
| 名稱 | 類型 | Description |
|---|---|---|
| deleteAfter | DeleteOption: |
刪除選項 |
| sourceDataStore |
DataStoreInfo 基底 |
|
| targetDataStoreCopySettings |
目標複製設定 |
systemData
與建立和上次修改資源相關的元數據。
| 名稱 | 類型 | Description |
|---|---|---|
| createdAt |
string (date-time) |
資源建立的時間戳(UTC)。 |
| createdBy |
string |
建立資源的身分識別。 |
| createdByType |
建立資源的身分識別類型。 |
|
| lastModifiedAt |
string (date-time) |
上次修改的資源時間戳 (UTC) |
| lastModifiedBy |
string |
上次修改資源的身分識別。 |
| lastModifiedByType |
上次修改資源的身分識別類型。 |
TaggingCriteria
標記條件
| 名稱 | 類型 | Description |
|---|---|---|
| criteria | BackupCriteria[]: |
決定標籤是否可以套用至觸發備份的準則。 |
| isDefault |
boolean |
指定標籤是否為預設值。 |
| tagInfo |
保留標記資訊 |
|
| taggingPriority |
integer (int64) |
保留標記優先順序。 |
TargetCopySetting
目標複製設定
| 名稱 | 類型 | Description |
|---|---|---|
| copyAfter | CopyOption: |
它可以是 CustomCopyOption 或 ImmediateCopyOption。 |
| dataStore |
目標數據存放區的資訊 |
WeekNumber
| 值 | Description |
|---|---|
| First | |
| Fourth | |
| Last | |
| Second | |
| Third |