Azure 资源管理器 - backupLongTermRetentionPolicies - 错误 "WeekOfYear is required to be set between 1 and 52 in order to set yearly retention."
Azure Resource Manager - backupLongTermRetentionPolicies - Error "WeekOfYear is required to be set between 1 and 52 in order to set yearly retention."
我们正在使用 Azure 资源管理器模板(ARM 模板)部署脚本,如果我们在生产或测试中,希望设置不同的保留策略。
为我们当前的 Dev SQL 服务器使用导出模板给出这些值:
如果这些值按原样复制到我们的部署脚本中:
{
"type": "Microsoft.Sql/servers/databases/backupLongTermRetentionPolicies",
"apiVersion": "2017-03-01-preview",
"name": "[concat(parameters('servers_prod_repository_name'), '/', parameters('servers_prod_repository_name'), '/default')]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers/databases', parameters('servers_prod_repository_name'), parameters('servers_prod_repository_name'))]",
"[resourceId('Microsoft.Sql/servers', parameters('servers_prod_repository_name'))]"
],
"properties": {
"weeklyRetention": "PT0S",
"monthlyRetention": "PT0S",
"yearlyRetention": "PT0S",
"weekOfYear": 0
}
},
我收到以下错误:
Resource
Microsoft.Sql/servers/databases/backupLongTermRetentionPolicies
'our-sql-server/our-sql-server/default' failed with message '{
11:14:50 - "error": { 11:14:50 - "code":
"LongTermRetentionMissingWeekOfYear", 11:14:50 - "message":
"WeekOfYear is required to be set between 1 and 52 in order to set
yearly retention." 11:14:50 - } 11:14:50 - }'
错误 "WeekOfYear is required to be set between 1 and 52 in order to set yearly retention."
出现在预期的响应中,但考虑到该值是标准值,它似乎是 yearlyRetention
设置为 PT0S
的错误。
通过删除 monthlyRetention
、yearlyRetention
和 weekOfYear
参数解决。
参数:
"weeklyRetention": {
"value": "P4W"
},
部署脚本:
{
"type": "Microsoft.Sql/servers/databases/backupLongTermRetentionPolicies",
"apiVersion": "2017-03-01-preview",
"name": "[concat(parameters('servers_prod_repository_name'), '/', parameters('servers_prod_repository_name'), '/default')]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers/databases', parameters('servers_prod_repository_name'), parameters('servers_prod_repository_name'))]",
"[resourceId('Microsoft.Sql/servers', parameters('servers_prod_repository_name'))]"
],
"properties": {
"weeklyRetention": "[parameters('weeklyRetention')]"
}
},
我们正在使用 Azure 资源管理器模板(ARM 模板)部署脚本,如果我们在生产或测试中,希望设置不同的保留策略。
为我们当前的 Dev SQL 服务器使用导出模板给出这些值:
如果这些值按原样复制到我们的部署脚本中:
{
"type": "Microsoft.Sql/servers/databases/backupLongTermRetentionPolicies",
"apiVersion": "2017-03-01-preview",
"name": "[concat(parameters('servers_prod_repository_name'), '/', parameters('servers_prod_repository_name'), '/default')]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers/databases', parameters('servers_prod_repository_name'), parameters('servers_prod_repository_name'))]",
"[resourceId('Microsoft.Sql/servers', parameters('servers_prod_repository_name'))]"
],
"properties": {
"weeklyRetention": "PT0S",
"monthlyRetention": "PT0S",
"yearlyRetention": "PT0S",
"weekOfYear": 0
}
},
我收到以下错误:
Resource Microsoft.Sql/servers/databases/backupLongTermRetentionPolicies 'our-sql-server/our-sql-server/default' failed with message '{ 11:14:50 - "error": { 11:14:50 - "code": "LongTermRetentionMissingWeekOfYear", 11:14:50 - "message": "WeekOfYear is required to be set between 1 and 52 in order to set yearly retention." 11:14:50 - } 11:14:50 - }'
错误 "WeekOfYear is required to be set between 1 and 52 in order to set yearly retention."
出现在预期的响应中,但考虑到该值是标准值,它似乎是 yearlyRetention
设置为 PT0S
的错误。
通过删除 monthlyRetention
、yearlyRetention
和 weekOfYear
参数解决。
参数:
"weeklyRetention": {
"value": "P4W"
},
部署脚本:
{
"type": "Microsoft.Sql/servers/databases/backupLongTermRetentionPolicies",
"apiVersion": "2017-03-01-preview",
"name": "[concat(parameters('servers_prod_repository_name'), '/', parameters('servers_prod_repository_name'), '/default')]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers/databases', parameters('servers_prod_repository_name'), parameters('servers_prod_repository_name'))]",
"[resourceId('Microsoft.Sql/servers', parameters('servers_prod_repository_name'))]"
],
"properties": {
"weeklyRetention": "[parameters('weeklyRetention')]"
}
},