Gallery › SQL › Azure Community Policy
Azure PostgreSQL flexible server must have Microsoft Entra Only Authentication enabled
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0
Disabling local authentication methods and allowing only Microsoft Entra Authentication improves security by ensuring that Azure PostgreSQL flexible server can exclusively be accessed by Microsoft Entra identities.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 53 lines
{
"name": "7c90f6d1-f79a-4c1c-b44a-4a655d4774f0",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"mode": "Indexed",
"displayName": "Azure PostgreSQL flexible server must have Microsoft Entra Only Authentication enabled",
"description": "Disabling local authentication methods and allowing only Microsoft Entra Authentication improves security by ensuring that Azure PostgreSQL flexible server can exclusively be accessed by Microsoft Entra identities.",
"metadata": {
"version": "1.0.0",
"category": "SQL"
},
"parameters": {
"effect": {
"type": "String",
"defaultValue": "Deny",
"allowedValues": [
"Audit",
"Disabled",
"Deny"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.DBForPostgreSql/flexibleServers"
},
{
"anyOf": [
{
"field": "Microsoft.DBForPostgreSql/flexibleServers/authConfig.activeDirectoryAuth",
"notEquals": "Enabled"
},
{
"field": "Microsoft.DBForPostgreSql/flexibleServers/authConfig.passwordAuth",
"notEquals": "Disabled"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylaw7c90f6d1-f79a-4c1c-b44a-4a655d4774f0.bylaw.ps1 · 31 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '7c90f6d1-f79a-4c1c-b44a-4a655d4774f0' {
Properties @{
DisplayName = 'Azure PostgreSQL flexible server must have Microsoft Entra Only Authentication enabled'
Description = 'Disabling local authentication methods and allowing only Microsoft Entra Authentication improves security by ensuring that Azure PostgreSQL flexible server can exclusively be accessed by Microsoft Entra identities.'
Version = '1.0.0'
Category = 'SQL'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled', 'Deny')
Default = 'Deny'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.DBForPostgreSql/flexibleServers' {
Require 'authConfig.activeDirectoryAuth is Enabled' {
Field authConfig.activeDirectoryAuth | Must -Be 'Enabled'
}
Require 'authConfig.passwordAuth is Disabled' {
Field authConfig.passwordAuth | Must -Be 'Disabled'
}
}
Effect (Param Effect)
}Source: policyDefinitions/SQL/enforce-postgresql-entra-only-authentication/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw