-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding update policies for PostgreSQL
- Loading branch information
Sebastian Claesson
committed
Feb 11, 2025
1 parent
bad8e9b
commit 8be960c
Showing
13 changed files
with
387 additions
and
63 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
policyDefinitions/PostgreSql/deny-postgresql-administrator-login/azurepolicy.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{ | ||
"name": "7c90f6d1-f79a-4c1c-b44a-4a655d4774f0", | ||
"type": "Microsoft.Authorization/policyDefinitions", | ||
"properties": { | ||
"policyType": "Custom", | ||
"mode": "Indexed", | ||
"displayName": "PostgreSQL flexible servers - Disable local administrator login", | ||
"description": "PostgreSQL flexible servers supports local administrator login", | ||
"metadata": { | ||
"version": "1.0.0", | ||
"category": "PostgreSql" | ||
}, | ||
"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": [ | ||
{ | ||
"allOf": [ | ||
{ | ||
"field": "Microsoft.DBForPostgreSql/flexibleServers/administratorLogin", | ||
"exists": "true" | ||
}, | ||
{ | ||
"value": "empty(Microsoft.DBForPostgreSql/flexibleServers/administratorLogin)", | ||
"notEquals": "true" | ||
} | ||
] | ||
}, | ||
{ | ||
"allOf": [ | ||
{ | ||
"field": "Microsoft.DBForPostgreSql/flexibleServers/administratorLoginPassword", | ||
"exists": "true" | ||
}, | ||
{ | ||
"value": "empty(Microsoft.DBForPostgreSql/flexibleServers/administratorLoginPassword)", | ||
"notEquals": "true" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"then": { | ||
"effect": "[parameters('effect')]" | ||
} | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
policyDefinitions/PostgreSql/deny-postgresql-administrator-login/azurepolicy.parameters.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"effect": { | ||
"type": "String", | ||
"defaultValue": "Deny", | ||
"allowedValues": [ | ||
"Audit", | ||
"Disabled", | ||
"Deny" | ||
], | ||
"metadata": { | ||
"displayName": "Effect", | ||
"description": "Enable or disable the execution of the policy" | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
policyDefinitions/PostgreSql/deny-postgresql-administrator-login/azurepolicy.rules.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"if": { | ||
"allOf": [ | ||
{ | ||
"field": "type", | ||
"equals": "Microsoft.DBforPostgreSQL/flexibleServers" | ||
}, | ||
{ | ||
"anyOf": [ | ||
{ | ||
"allOf": [ | ||
{ | ||
"field": "Microsoft.DBForPostgreSql/flexibleServers/administratorLogin", | ||
"exists": "true" | ||
}, | ||
{ | ||
"value": "empty(Microsoft.DBForPostgreSql/flexibleServers/administratorLogin)", | ||
"notEquals": "true" | ||
} | ||
] | ||
}, | ||
{ | ||
"allOf": [ | ||
{ | ||
"field": "Microsoft.DBForPostgreSql/flexibleServers/administratorLoginPassword", | ||
"exists": "true" | ||
}, | ||
{ | ||
"value": "empty(Microsoft.DBForPostgreSql/flexibleServers/administratorLoginPassword)", | ||
"notEquals": "true" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"then": { | ||
"effect": "[parameters('effect')]" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,6 @@ | |
"allowedVersions": { | ||
"type": "array", | ||
"defaultValue": [ | ||
"15", | ||
"16", | ||
"17" | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
.../PostgreSql/enforce-postgresql-administrator-group-principal-name-prefix/azurepolicy.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"name": "d78f353a-a5e7-4747-8d31-62f361bafac5", | ||
"type": "Microsoft.Authorization/policyDefinitions", | ||
"properties": { | ||
"policyType": "Custom", | ||
"mode": "All", | ||
"displayName": "PostgreSQL flexible servers administrator - Enforce a naming convention to be used for Administrator groups", | ||
"description": "PostgreSQL flexible servers supports Entra ID Security groups to be PostgreSQL Administrator, This policy will only allow groups following a certain naming convention to be allowed as Administrator.", | ||
"metadata": { | ||
"version": "1.0.0", | ||
"category": "PostgreSql" | ||
}, | ||
"parameters": { | ||
"effect": { | ||
"type": "String", | ||
"defaultValue": "Deny", | ||
"allowedValues": [ | ||
"Audit", | ||
"Disabled", | ||
"Deny" | ||
], | ||
"metadata": { | ||
"displayName": "Effect", | ||
"description": "Enable or disable the execution of the policy" | ||
} | ||
}, | ||
"namePattern": { | ||
"type": "string", | ||
"metadata": { | ||
"displayName": "Naming pattern to enforce", | ||
"description": "Allowed Entra ID Security group name pattern to enforce, for example Admin_* will enforce that the group starts with Admin_" | ||
} | ||
} | ||
}, | ||
"policyRule": { | ||
"if": { | ||
"allOf": [ | ||
{ | ||
"field": "type", | ||
"equals": "Microsoft.DBforPostgreSQL/flexibleServers/administrators" | ||
}, | ||
{ | ||
"field": "Microsoft.DBforPostgreSQL/flexibleServers/administrators/principalType", | ||
"equals": "Group" | ||
}, | ||
{ | ||
"field": "Microsoft.DBforPostgreSQL/flexibleServers/administrators/principalName", | ||
"notLike": "[parameters('namePattern')]" | ||
} | ||
] | ||
}, | ||
"then": { | ||
"effect": "[parameters('effect')]" | ||
} | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
.../enforce-postgresql-administrator-group-principal-name-prefix/azurepolicy.parameters.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"effect": { | ||
"type": "String", | ||
"defaultValue": "Deny", | ||
"allowedValues": [ | ||
"Audit", | ||
"Disabled", | ||
"Deny" | ||
], | ||
"metadata": { | ||
"displayName": "Effect", | ||
"description": "Enable or disable the execution of the policy" | ||
} | ||
}, | ||
"namePattern": { | ||
"type": "string", | ||
"metadata": { | ||
"displayName": "Naming pattern to enforce", | ||
"description": "Allowed Entra ID Security group name pattern to enforce, for example Admin_* will enforce that the group starts with Admin_" | ||
} | ||
} | ||
} |
Oops, something went wrong.