Skip to content

Commit 74d0cf8

Browse files
authored
Quality updates to PostgreSQL docs (Azure#2808)
1 parent 6a23145 commit 74d0cf8

7 files changed

+386
-32
lines changed
+59-24
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,74 @@
11
---
2+
reviewed: 2024-04-09
23
severity: Important
34
pillar: Security
4-
category: Identity and access management
5+
category: SE:05 Identity and access management
56
resource: Azure Database for PostgreSQL
67
online version: https://azure.github.io/PSRule.Rules.Azure/en/rules/Azure.PostgreSQL.AADOnly/
78
---
89

9-
# Azure AD-only authentication
10+
# Entra ID only authentication with PostgreSQL databases
1011

1112
## SYNOPSIS
1213

13-
Ensure Azure AD-only authentication is enabled with Azure Database for PostgreSQL databases.
14+
Ensure Entra ID only authentication is enabled with Azure Database for PostgreSQL databases.
1415

1516
## DESCRIPTION
1617

17-
Azure Database for PostgreSQL supports authentication with PostgreSQL logins and Azure AD authentication.
18+
Azure Database for PostgreSQL supports authentication with PostgreSQL logins and Entra ID authentication.
1819

1920
By default, authentication with PostgreSQL logins is enabled.
2021
PostgreSQL logins are unable to provide sufficient protection for identities.
21-
Azure AD authentication provides strong protection controls including conditional access, identity governance, and privileged identity management.
22+
Entra ID authentication provides strong protection controls including conditional access, identity governance,
23+
and privileged identity management.
2224

23-
Once you decide to use Azure AD authentication, you can disable authentication with PostgreSQL logins.
25+
Once you decide to use Entra ID authentication, you can disable authentication with PostgreSQL logins.
2426

25-
Azure AD-only authentication is only supported for the flexible server deployment model.
27+
Entra ID only authentication is only supported for the flexible server deployment model.
2628

2729
## RECOMMENDATION
2830

29-
Consider using Azure AD-only authentication.
30-
Also consider using Azure Policy for Azure AD-only authentication with Azure Database for PostgreSQL.
31+
Consider using Entra ID only authentication.
32+
Also consider using Azure Policy for Entra ID only authentication with Azure Database for PostgreSQL.
3133

3234
## EXAMPLES
3335

3436
### Configure with Azure template
3537

3638
To deploy Azure Database for PostgreSQL flexible servers that pass this rule:
3739

38-
- Set the `properties.authConfig.activeDirectoryAuth` property to `true`.
39-
- Set the `properties.authConfig.passwordAuth` property to `false`.
40+
- Set the `properties.authConfig.activeDirectoryAuth` property to `Enabled`.
41+
- Set the `properties.authConfig.passwordAuth` property to `Disabled`.
4042

4143
For example:
4244

4345
```json
4446
{
4547
"type": "Microsoft.DBforPostgreSQL/flexibleServers",
4648
"apiVersion": "2022-12-01",
47-
"name": "[parameters('serverName')]",
49+
"name": "[parameters('name')]",
4850
"location": "[parameters('location')]",
51+
"sku": {
52+
"name": "Standard_D2ds_v4",
53+
"tier": "GeneralPurpose"
54+
},
4955
"properties": {
56+
"createMode": "Default",
5057
"authConfig": {
5158
"activeDirectoryAuth": "Enabled",
5259
"passwordAuth": "Disabled",
53-
"tenantId": "[parameters('tenantId')]"
60+
"tenantId": "[tenant().tenantId]"
61+
},
62+
"version": "14",
63+
"storage": {
64+
"storageSizeGB": 32
65+
},
66+
"backup": {
67+
"backupRetentionDays": 7,
68+
"geoRedundantBackup": "Enabled"
69+
},
70+
"highAvailability": {
71+
"mode": "ZoneRedundant"
5472
}
5573
}
5674
}
@@ -60,35 +78,52 @@ For example:
6078

6179
To deploy Azure Database for PostgreSQL flexible servers that pass this rule:
6280

63-
- Set the `properties.authConfig.activeDirectoryAuth` property to `true`.
64-
- Set the `properties.authConfig.passwordAuth` property to `false`.
81+
- Set the `properties.authConfig.activeDirectoryAuth` property to `Enabled`.
82+
- Set the `properties.authConfig.passwordAuth` property to `Disabled`.
6583

6684
For example:
6785

6886
```bicep
69-
resource postgreSqlFlexibleServer 'Microsoft.DBforPostgreSQL/flexibleServers@2022-12-01' = {
70-
name: serverName
87+
resource flexible 'Microsoft.DBforPostgreSQL/flexibleServers@2022-12-01' = {
88+
name: name
7189
location: location
90+
sku: {
91+
name: 'Standard_D2ds_v4'
92+
tier: 'GeneralPurpose'
93+
}
7294
properties: {
95+
createMode: 'Default'
7396
authConfig: {
7497
activeDirectoryAuth: 'Enabled'
7598
passwordAuth: 'Disabled'
76-
tenantId: tenantId
99+
tenantId: tenant().tenantId
100+
}
101+
version: '14'
102+
storage: {
103+
storageSizeGB: 32
104+
}
105+
backup: {
106+
backupRetentionDays: 7
107+
geoRedundantBackup: 'Enabled'
108+
}
109+
highAvailability: {
110+
mode: 'ZoneRedundant'
77111
}
78112
}
79113
}
80114
```
81115

82116
## NOTES
83117

84-
The Azure AD admin must be set before enabling Azure AD-only authentication.
85-
Azure AD-only authentication is only suppored for the flexible server deployment model.
118+
The Entra ID admin must be set before enabling Entra ID only authentication.
119+
Entra ID only authentication is only supported for the flexible server deployment model.
86120

87121
## LINKS
88122

89-
- [Use modern password protection](https://learn.microsoft.com/azure/architecture/framework/security/design-identity-authentication#use-modern-password-protection)
90-
- [Use Azure AD for authentication with Azure Database for PostgreSQL - Flexible Server](https://learn.microsoft.com/azure/postgresql/flexible-server/how-to-configure-sign-in-azure-ad-authentication)
91-
- [Azure Active Directory Authentication (Single Server VS Flexible Server)](https://learn.microsoft.com/azure/postgresql/flexible-server/concepts-azure-ad-authentication#azure-active-directory-authentication-single-server-vs-flexible-server)
92-
- [Azure security baseline for Azure Database for PostgreSQL - Flexible Server](https://learn.microsoft.com/security/benchmark/azure/baselines/azure-database-for-postgresql-flexible-server-security-baseline)
123+
- [SE:05 Identity and access management](https://learn.microsoft.com/azure/well-architected/security/identity-access)
124+
- [How Microsoft Entra ID Works in Azure Database for PostgreSQL flexible server](https://learn.microsoft.com/azure/postgresql/flexible-server/concepts-azure-ad-authentication#how-azure-ad-works-in-flexible-server)
125+
- [Use Microsoft Entra ID for authentication with Azure Database for PostgreSQL - Flexible Server](https://learn.microsoft.com/azure/postgresql/flexible-server/how-to-configure-sign-in-azure-ad-authentication)
126+
- [Use Microsoft Entra ID for authentication with PostgreSQL](https://learn.microsoft.com/azure/postgresql/single-server/how-to-configure-sign-in-azure-ad-authentication)
127+
- [Microsoft Entra authentication (Azure Database for PostgreSQL single Server vs Azure Database for PostgreSQL flexible server)](https://learn.microsoft.com/azure/postgresql/flexible-server/concepts-azure-ad-authentication#microsoft-entra-authentication-azure-database-for-postgresql-single-server-vs-azure-database-for-postgresql-flexible-server)
93128
- [IM-1: Use centralized identity and authentication system](https://learn.microsoft.com/security/benchmark/azure/baselines/azure-database-for-postgresql-flexible-server-security-baseline#im-1-use-centralized-identity-and-authentication-system)
94129
- [Azure deployment reference](https://learn.microsoft.com/azure/templates/microsoft.dbforpostgresql/flexibleservers#authconfig)

docs/en/rules/Azure.PostgreSQL.MinTLS.md

+62-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2+
reviewed: 2024-04-09
23
severity: Critical
34
pillar: Security
4-
category: Encryption
5+
category: SE:07 Encryption
56
resource: Azure Database for PostgreSQL
67
online version: https://azure.github.io/PSRule.Rules.Azure/en/rules/Azure.PostgreSQL.MinTLS/
78
---
@@ -24,10 +25,66 @@ By default, TLS 1.0, TLS 1.1, and TLS 1.2 is accepted.
2425

2526
Consider configuring the minimum supported TLS version to be 1.2.
2627

28+
## EXAMPLES
29+
30+
### Configure with Azure template
31+
32+
To deploy servers that pass this rule:
33+
34+
- Set the `properties.minimalTlsVersion` property to `TLS1_2`.
35+
36+
For example:
37+
38+
```json
39+
{
40+
"type": "Microsoft.DBforPostgreSQL/servers",
41+
"apiVersion": "2017-12-01",
42+
"name": "[parameters('name')]",
43+
"location": "[parameters('location')]",
44+
"properties": {
45+
"createMode": "Default",
46+
"administratorLogin": "[parameters('localAdministrator')]",
47+
"administratorLoginPassword": "[parameters('localAdministratorPassword')]",
48+
"minimalTlsVersion": "TLS1_2",
49+
"sslEnforcement": "Enabled",
50+
"publicNetworkAccess": "Disabled",
51+
"version": "11"
52+
}
53+
}
54+
```
55+
56+
### Configure with Bicep
57+
58+
To deploy servers that pass this rule:
59+
60+
- Set the `properties.minimalTlsVersion` property to `TLS1_2`.
61+
62+
For example:
63+
64+
```bicep
65+
resource single 'Microsoft.DBforPostgreSQL/servers@2017-12-01' = {
66+
name: name
67+
location: location
68+
properties: {
69+
createMode: 'Default'
70+
administratorLogin: localAdministrator
71+
administratorLoginPassword: localAdministratorPassword
72+
minimalTlsVersion: 'TLS1_2'
73+
sslEnforcement: 'Enabled'
74+
publicNetworkAccess: 'Disabled'
75+
version: '11'
76+
}
77+
}
78+
```
79+
80+
## NOTES
81+
82+
This rule is not applicable to PostgreSQL using the flexible server model.
83+
2784
## LINKS
2885

29-
- [Data encryption in Azure](https://learn.microsoft.com/azure/architecture/framework/security/design-storage-encryption#data-in-transit)
30-
- [TLS enforcement in Azure Database for PostgreSQL Single server](https://learn.microsoft.com/azure/postgresql/concepts-ssl-connection-security#tls-enforcement-in-azure-database-for-postgresql-single-server)
31-
- [Set TLS configurations for Azure Database for PostgreSQL - Single server](https://learn.microsoft.com/azure/postgresql/howto-tls-configurations#set-tls-configurations-for-azure-database-for-postgresql---single-server)
86+
- [SE:07 Encryption](https://learn.microsoft.com/azure/well-architected/security/encryption#data-in-transit)
87+
- [TLS enforcement in Azure Database for PostgreSQL Single server](https://learn.microsoft.com/azure/postgresql/single-server/concepts-ssl-connection-security#tls-enforcement-in-azure-database-for-postgresql-single-server)
88+
- [Set TLS configurations for Azure Database for PostgreSQL - Single server](https://learn.microsoft.com/azure/postgresql/single-server/how-to-tls-configurations#set-tls-configurations-for-azure-database-for-postgresql---single-server)
3289
- [Preparing for TLS 1.2 in Microsoft Azure](https://azure.microsoft.com/updates/azuretls12/)
33-
- [Azure deployment reference](https://learn.microsoft.com/azure/templates/microsoft.dbforpostgresql/servers#ServerPropertiesForCreate)
90+
- [Azure deployment reference](https://learn.microsoft.com/azure/templates/microsoft.dbforpostgresql/servers)

docs/en/rules/Azure.PostgreSQL.UseSSL.md

+61-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2+
reviewed: 2024-04-09
23
severity: Critical
34
pillar: Security
4-
category: Data protection
5+
category: SE:07 Encryption
56
resource: Azure Database for PostgreSQL
67
online version: https://azure.github.io/PSRule.Rules.Azure/en/rules/Azure.PostgreSQL.UseSSL/
78
ms-content-id: 80d34e65-8ab5-4cf3-a0dd-3b5e56e06f40
@@ -28,7 +29,64 @@ Unless explicitly required, consider enabling _enforce SSL connections_.
2829

2930
Also consider using Azure Policy to audit or enforce this configuration.
3031

32+
## EXAMPLES
33+
34+
### Configure with Azure template
35+
36+
To deploy servers that pass this rule:
37+
38+
- Set the `properties.sslEnforcement` property to `Enabled`.
39+
40+
For example:
41+
42+
```json
43+
{
44+
"type": "Microsoft.DBforPostgreSQL/servers",
45+
"apiVersion": "2017-12-01",
46+
"name": "[parameters('name')]",
47+
"location": "[parameters('location')]",
48+
"properties": {
49+
"createMode": "Default",
50+
"administratorLogin": "[parameters('localAdministrator')]",
51+
"administratorLoginPassword": "[parameters('localAdministratorPassword')]",
52+
"minimalTlsVersion": "TLS1_2",
53+
"sslEnforcement": "Enabled",
54+
"publicNetworkAccess": "Disabled",
55+
"version": "11"
56+
}
57+
}
58+
```
59+
60+
### Configure with Bicep
61+
62+
To deploy servers that pass this rule:
63+
64+
- Set the `properties.sslEnforcement` property to `Enabled`.
65+
66+
For example:
67+
68+
```bicep
69+
resource single 'Microsoft.DBforPostgreSQL/servers@2017-12-01' = {
70+
name: name
71+
location: location
72+
properties: {
73+
createMode: 'Default'
74+
administratorLogin: localAdministrator
75+
administratorLoginPassword: localAdministratorPassword
76+
minimalTlsVersion: 'TLS1_2'
77+
sslEnforcement: 'Enabled'
78+
publicNetworkAccess: 'Disabled'
79+
version: '11'
80+
}
81+
}
82+
```
83+
84+
## NOTES
85+
86+
This rule is not applicable to PostgreSQL using the flexible server model.
87+
3188
## LINKS
3289

33-
- [Data encryption in Azure](https://learn.microsoft.com/azure/architecture/framework/security/design-storage-encryption#data-in-transit)
34-
- [Configure SSL connectivity in Azure Database for PostgreSQL](https://learn.microsoft.com/azure/postgresql/concepts-ssl-connection-security)
90+
- [SE:07 Encryption](https://learn.microsoft.com/azure/well-architected/security/encryption#data-in-transit)
91+
- [Configure SSL connectivity in Azure Database for PostgreSQL](https://learn.microsoft.com/azure/postgresql/single-server/concepts-ssl-connection-security)
92+
- [Azure deployment reference](https://learn.microsoft.com/azure/templates/microsoft.dbforpostgresql/servers)
File renamed without changes.
File renamed without changes.

docs/examples-postgresql.bicep

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
// Bicep documentation examples
5+
6+
@sys.description('The name of the resource.')
7+
param name string
8+
9+
@sys.description('The location resources will be deployed.')
10+
param location string = resourceGroup().location
11+
12+
@sys.description('The login for an administrator.')
13+
param localAdministrator string
14+
15+
@secure()
16+
@description('A default administrator password.')
17+
param localAdministratorPassword string
18+
19+
@sys.description('The object GUID for an administrator account.')
20+
param loginObjectId string
21+
22+
// An example PostgreSQL server.
23+
resource single 'Microsoft.DBforPostgreSQL/servers@2017-12-01' = {
24+
name: name
25+
location: location
26+
properties: {
27+
createMode: 'Default'
28+
administratorLogin: localAdministrator
29+
administratorLoginPassword: localAdministratorPassword
30+
minimalTlsVersion: 'TLS1_2'
31+
sslEnforcement: 'Enabled'
32+
publicNetworkAccess: 'Disabled'
33+
version: '11'
34+
}
35+
}
36+
37+
// Configure administrators for single server.
38+
resource single_admin 'Microsoft.DBforPostgreSQL/servers/administrators@2017-12-01' = {
39+
parent: single
40+
name: 'activeDirectory'
41+
properties: {
42+
administratorType: 'ActiveDirectory'
43+
login: localAdministrator
44+
sid: loginObjectId
45+
tenantId: tenant().tenantId
46+
}
47+
}
48+
49+
// An example PostgreSQL using the flexible server model.
50+
resource flexible 'Microsoft.DBforPostgreSQL/flexibleServers@2022-12-01' = {
51+
name: name
52+
location: location
53+
sku: {
54+
name: 'Standard_D2ds_v4'
55+
tier: 'GeneralPurpose'
56+
}
57+
properties: {
58+
createMode: 'Default'
59+
authConfig: {
60+
activeDirectoryAuth: 'Enabled'
61+
passwordAuth: 'Disabled'
62+
tenantId: tenant().tenantId
63+
}
64+
version: '14'
65+
storage: {
66+
storageSizeGB: 32
67+
}
68+
backup: {
69+
backupRetentionDays: 7
70+
geoRedundantBackup: 'Enabled'
71+
}
72+
highAvailability: {
73+
mode: 'ZoneRedundant'
74+
}
75+
}
76+
}
77+
78+
// Configure administrators for a flexible server.
79+
resource flexible_admin 'Microsoft.DBforPostgreSQL/flexibleServers/administrators@2022-12-01' = {
80+
parent: flexible
81+
name: loginObjectId
82+
properties: {
83+
principalType: 'ServicePrincipal'
84+
principalName: localAdministrator
85+
tenantId: tenant().tenantId
86+
}
87+
}

0 commit comments

Comments
 (0)