Gallery › SQL › Azure built-in policies
Geo-redundant backup should be enabled for Azure Database for PostgreSQL
Converted Policy Audit Disabled Mode Indexed Version 1.0.1
Azure Database for PostgreSQL allows you to choose the redundancy option for your database server. It can be set to a geo-redundant backup storage in which the data is not only stored within the region in which your server is hosted, but is also replicated to a paired region to provide recovery option in case of a region failure. Configuring geo-redundant storage for backup is only allowed during server create.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONGeoRedundant_DBForPostgreSQL_Audit.json · 49 lines
{
"properties": {
"displayName": "Geo-redundant backup should be enabled for Azure Database for PostgreSQL",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Azure Database for PostgreSQL allows you to choose the redundancy option for your database server. It can be set to a geo-redundant backup storage in which the data is not only stored within the region in which your server is hosted, but is also replicated to a paired region to provide recovery option in case of a region failure. Configuring geo-redundant storage for backup is only allowed during server create.",
"metadata": {
"version": "1.0.1",
"category": "SQL"
},
"version": "1.0.1",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "Audit",
"allowedValues": [
"Audit",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.DBforPostgreSQL/servers"
},
{
"field": "Microsoft.DBforPostgreSQL/servers/storageProfile.geoRedundantBackup",
"notEquals": "Enabled"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/48af4db5-9b8b-401c-8e74-076be876a430",
"name": "48af4db5-9b8b-401c-8e74-076be876a430"
}Bylaw48af4db5-9b8b-401c-8e74-076be876a430.bylaw.ps1 · 29 lines
# Converted from GeoRedundant_DBForPostgreSQL_Audit.json by ConvertTo-Bylaw.
Policy '48af4db5-9b8b-401c-8e74-076be876a430' {
Properties @{
DisplayName = 'Geo-redundant backup should be enabled for Azure Database for PostgreSQL'
Description = 'Azure Database for PostgreSQL allows you to choose the redundancy option for your database server. It can be set to a geo-redundant backup storage in which the data is not only stored within the region in which your server is hosted, but is also replicated to a paired region to provide recovery option in case of a region failure. Configuring geo-redundant storage for backup is only allowed during server create.'
Version = '1.0.1'
Category = 'SQL'
PolicyVersion = '1.0.1'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.DBforPostgreSQL/servers' {
Require 'storageProfile.geoRedundantBackup is Enabled' {
Field storageProfile.geoRedundantBackup | Must -Be 'Enabled'
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/SQL/GeoRedundant_DBForPostgreSQL_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw