Bylaw

Gallery › SQL › Azure built-in policies

A Microsoft Entra administrator should be provisioned for PostgreSQL servers

Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.1

Audit provisioning of a Microsoft Entra administrator for your PostgreSQL server to enable Microsoft Entra authentication. Microsoft Entra authentication enables simplified permission management and centralized identity management of database users and other Microsoft services

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

Azure Policy JSONPostgreSQL_AuditServerADAdmins_Audit.json · 45 lines
{
  "properties": {
    "displayName": "A Microsoft Entra administrator should be provisioned for PostgreSQL servers",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Audit provisioning of a Microsoft Entra administrator for your PostgreSQL server to enable Microsoft Entra authentication. Microsoft Entra authentication enables simplified permission management and centralized identity management of database users and other Microsoft services",
    "metadata": {
      "version": "1.0.1",
      "category": "SQL"
    },
    "version": "1.0.1",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "AuditIfNotExists",
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "equals": "Microsoft.DBforPostgreSQL/servers"
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.DBforPostgreSQL/servers/administrators"
        }
      }
    },
    "versions": [
      "1.0.1",
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/b4dec045-250a-48c2-b5cc-e0c4eec8b5b4",
  "name": "b4dec045-250a-48c2-b5cc-e0c4eec8b5b4"
}
Bylawb4dec045-250a-48c2-b5cc-e0c4eec8b5b4.bylaw.ps1 · 24 lines
# Converted from PostgreSQL_AuditServerADAdmins_Audit.json by ConvertTo-Bylaw.
Policy 'b4dec045-250a-48c2-b5cc-e0c4eec8b5b4' {

    Properties @{
        DisplayName   = 'A Microsoft Entra administrator should be provisioned for PostgreSQL servers'
        Description   = 'Audit provisioning of a Microsoft Entra administrator for your PostgreSQL server to enable Microsoft Entra authentication. Microsoft Entra authentication enables simplified permission management and centralized identity management of database users and other Microsoft services'
        Version       = '1.0.1'
        Category      = 'SQL'
        PolicyVersion = '1.0.1'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.DBforPostgreSQL/servers'

    AuditIfNotExists 'Microsoft.DBforPostgreSQL/servers/administrators' -Effect (Param Effect)
}

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