Gallery › SQL › Azure built-in policies
Public network access should be disabled for PostgreSQL servers
Converted Policy Audit Deny Disabled Mode Indexed Version 2.0.1
Disable the public network access property to improve security and ensure your Azure Database for PostgreSQL can only be accessed from a private endpoint. This configuration disables access from any public address space outside of Azure IP range, and denies all logins that match IP or virtual network-based firewall rules.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONPostgreSQL_DisablePublicNetworkAccess_Audit.json · 50 lines
{
"properties": {
"displayName": "Public network access should be disabled for PostgreSQL servers",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Disable the public network access property to improve security and ensure your Azure Database for PostgreSQL can only be accessed from a private endpoint. This configuration disables access from any public address space outside of Azure IP range, and denies all logins that match IP or virtual network-based firewall rules.",
"metadata": {
"version": "2.0.1",
"category": "SQL"
},
"version": "2.0.1",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "Audit",
"allowedValues": [
"Audit",
"Deny",
"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/publicNetworkAccess",
"notEquals": "Disabled"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"2.0.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/b52376f7-9612-48a1-81cd-1ffe4b61032c",
"name": "b52376f7-9612-48a1-81cd-1ffe4b61032c"
}Bylawb52376f7-9612-48a1-81cd-1ffe4b61032c.bylaw.ps1 · 29 lines
# Converted from PostgreSQL_DisablePublicNetworkAccess_Audit.json by ConvertTo-Bylaw.
Policy 'b52376f7-9612-48a1-81cd-1ffe4b61032c' {
Properties @{
DisplayName = 'Public network access should be disabled for PostgreSQL servers'
Description = 'Disable the public network access property to improve security and ensure your Azure Database for PostgreSQL can only be accessed from a private endpoint. This configuration disables access from any public address space outside of Azure IP range, and denies all logins that match IP or virtual network-based firewall rules.'
Version = '2.0.1'
Category = 'SQL'
PolicyVersion = '2.0.1'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.DBforPostgreSQL/servers' {
Require 'publicNetworkAccess is Disabled' {
Field publicNetworkAccess | Must -Be 'Disabled'
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/SQL/PostgreSQL_DisablePublicNetworkAccess_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw