Bylaw

Gallery › PostgreSQL › Azure built-in policies

[Deprecated]: Connection throttling should be enabled for PostgreSQL flexible servers

Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.1.0-deprecated Deprecated

This policy is deprecated because connection_throttle.enable server parameter is deprecated after PG 18.

ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.

Azure Policy JSONFlexibleServers_ConnectionThrottling_Enabled_AINE.json · 51 lines
{
  "properties": {
    "displayName": "[Deprecated]: Connection throttling should be enabled for PostgreSQL flexible servers",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "This policy is deprecated because connection_throttle.enable server parameter is deprecated after PG 18.",
    "metadata": {
      "version": "1.1.0-deprecated",
      "category": "PostgreSQL",
      "deprecated": true
    },
    "version": "1.1.0",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "Disabled",
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "equals": "Microsoft.DBforPostgreSQL/flexibleServers"
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.DBforPostgreSQL/flexibleServers/configurations",
          "name": "connection_throttle.enable",
          "existenceCondition": {
            "field": "Microsoft.DBforPostgreSQL/flexibleServers/configurations/value",
            "equals": "ON"
          }
        }
      }
    },
    "versions": [
      "1.1.0",
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/dacf07fa-0eea-4486-80bc-b93fae88ac40",
  "name": "dacf07fa-0eea-4486-80bc-b93fae88ac40"
}
Bylawdacf07fa-0eea-4486-80bc-b93fae88ac40.bylaw.ps1 · 29 lines
# Converted from FlexibleServers_ConnectionThrottling_Enabled_AINE.json by ConvertTo-Bylaw.
Policy 'dacf07fa-0eea-4486-80bc-b93fae88ac40' {

    Properties @{
        DisplayName   = '[Deprecated]: Connection throttling should be enabled for PostgreSQL flexible servers'
        Description   = 'This policy is deprecated because connection_throttle.enable server parameter is deprecated after PG 18.'
        Version       = '1.1.0-deprecated'
        Category      = 'PostgreSQL'
        Deprecated    = $true
        PolicyVersion = '1.1.0'
        Mode          = 'Indexed'
    }

    Parameter Effect @{
        Type          = 'string'
        AllowedValues = @('AuditIfNotExists', 'Disabled')
        Default       = 'Disabled'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the policy'
    }

    Resource 'Microsoft.DBforPostgreSQL/flexibleServers'

    AuditIfNotExists 'Microsoft.DBforPostgreSQL/flexibleServers/configurations' -Name 'connection_throttle.enable' -Effect (Param Effect) {
        Require 'value is ON' {
            Field value | Must -Be 'ON'
        }
    }
}

Source: built-in-policies/policyDefinitions/PostgreSQL/FlexibleServers_ConnectionThrottling_Enabled_AINE.json in Azure/azure-policy, under the MIT licence.