提供程序“Microsoft.Sql”和资源类型“服务器/数据库”下支持的别名是什么,用于创建天蓝色策略来审核pitr和ltr
我尝试了以下
{
"properties": {
"displayName": "Meijer PITR & LTR for SQL DB",
"policyType": "Custom",
"mode": "Indexed",
"description": "Audit the SQL databases in POC for correct PITR and backup settings",
"metadata": {
"category": "SQL"
},
"version": "1.0.0",
"parameters": {
"pitrRetentionDays": {
"type": "String",
"metadata": {
"displayName": "PITR retention",
"description": "The number of days to retain the point-in-time recovery."
},
"defaultValue": "15 days"
},
"differentialRetentionHours": {
"type": "String",
"metadata": {
"displayName": "Differential backup frequency",
"description": "The number of hours to retain backups with 12-hour differentials."
},
"defaultValue": "12 hours"
},
"weeklyBackupWeeks": {
"type": "String",
"metadata": {
"displayName": "Weekly LTR",
"description": "The number of weeks to retain weekly backups."
},
"defaultValue": "3 weeks"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Sql/servers/databases"
},
{
"field": "type",
"equals": "Microsoft.Sql/servers/databases/backupLongTermRetentionPolicy"
},
{
"anyOf": [
{
"field": "Microsoft.Sql/servers/databases/restorePointInTime",
"notEquals": "[parameters('pitrRetentionDays')]"
},
{
"field": "Microsoft.Sql/servers/databases/backupLongTermRetentionPolicy/dailyRetention",
"notEquals": "[parameters('differentialRetentionHours')]"
},
{
"field": "Microsoft.Sql/servers/databases/backupLongTermRetentionPolicy/weeklyRetention",
"notEquals": "[parameters('weeklyBackupWeeks')]"
}
]
}
]
},
"then": {
"effect": "audit"
}
},
"versions": [
"1.0.0"
]
}
}
提供程序“Microsoft.Sql”和资源类型“服务器/数据库”下支持的别名是什么,用于创建天蓝色策略来审计pitr和ltr。
以下是
Microsoft.Sql/servers/databases
支持的资源类型,用于创建用于审核 PITR
和 LTR
的 Azure 策略。
资源字段类型 dailyRetention 在 backupLongTermRetentionPolicy 资源类型中不可用。
政策错误:
对于上述支持的类型,您可以使用 backupShortTermRetentionPolicies 代替 backupLongTermRetentionPolicy。
这是审核
PITR
和 Ltr
的更新政策。
{
"mode": "Indexed",
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Sql/servers/databases/backupShortTermRetentionPolicies"
},
{
"anyOf": [
{
"field": "Microsoft.Sql/servers/databases/restorePointInTime",
"notEquals": "[parameters('pitrRetentionDays')]"
},
{
"field": "Microsoft.Sql/servers/databases/backupShortTermRetentionPolicies/retentionDays",
"notEquals": "[parameters('rentalDays')]"
},
{
"field": "Microsoft.Sql/servers/databases/backupShortTermRetentionPolicies/default.diffBackupIntervalInHours",
"notEquals": "[parameters('internalInHours')]"
}
]
}
]
},
"then": {
"effect": "audit"
}
},
"parameters": {
"rentalDays": {
"type": "String",
"metadata": {
"displayName": "PITR retention",
"description": "The number of days to retain the point-in-time recovery."
},
"defaultValue": "15 days"
},
"pitrRetentionDays": {
"type": "String",
"metadata": {
"displayName": "PITR retention",
"description": "The number of days to retain the point-in-time recovery."
},
"defaultValue": "30 days"
},
"internalInHours": {
"type": "String",
"metadata": {
"displayName": "Weekly LTR",
"description": "The number of weeks to retain weekly backups."
},
"defaultValue": "12 hours"
}
}
}
策略已成功创建并分配了所需的参数。