Gallery › SQL › Azure Community Policy
Geo replicated Microsoft SQL databases
Converted Policy Audit Disabled Mode Indexed Version 1.0.0
This policy audits geo replicated Microsoft SQL databases. This will only list the stand-by geo-redundant database as compliant and the primary as non-compliant, please note that this is a false-positive.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 44 lines
{
"name": "2ba488a2-471a-48aa-8885-7b24fc5b93d7",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Geo replicated Microsoft SQL databases",
"description": "This policy audits geo replicated Microsoft SQL databases. This will only list the stand-by geo-redundant database as compliant and the primary as non-compliant, please note that this is a false-positive.",
"metadata": {
"version": "1.0.0",
"category": "SQL"
},
"mode": "Indexed",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Audit or Disabled the execution of the Policy"
},
"allowedValues": [
"Audit",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Sql/servers/databases"
},
{
"field": "Microsoft.Sql/servers/databases/secondaryType",
"notEquals": "Geo"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylaw2ba488a2-471a-48aa-8885-7b24fc5b93d7.bylaw.ps1 · 27 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '2ba488a2-471a-48aa-8885-7b24fc5b93d7' {
Properties @{
DisplayName = 'Geo replicated Microsoft SQL databases'
Description = 'This policy audits geo replicated Microsoft SQL databases. This will only list the stand-by geo-redundant database as compliant and the primary as non-compliant, please note that this is a false-positive.'
Version = '1.0.0'
Category = 'SQL'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Audit or Disabled the execution of the Policy'
}
Resource 'Microsoft.Sql/servers/databases' {
Require 'secondaryType is Geo' {
Field secondaryType | Must -Be 'Geo'
}
}
Effect (Param Effect)
}Source: policyDefinitions/SQL/geo-replicated-microsoft-sql-databases/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw