Skip to content

Commit a33aecb

Browse files
committed
Update concepts-security.md
1 parent 2d1e71a commit a33aecb

File tree

1 file changed

+31
-17
lines changed

1 file changed

+31
-17
lines changed

articles/postgresql/flexible-server/concepts-security.md

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,19 @@ ms.devlang: python
2020

2121
Multiple layers of security are available to help protect the data on your Azure Database for PostgreSQL - Flexible Server instance. This article outlines those security options.
2222

23+
As organizations increasingly rely on data stored in databases to drive critical decision-making activities that drive competitive advantage, the need for solid database security measures has never been more important.
24+
A security lapse can trigger catastrophic consequences, including exposing confidential data, causing reputational damage to organization.
25+
26+
27+
> [!VIDEO https://learn-video.azurefd.net/vod/player?show=open-source-developer-series&ep=security-offered-by-azure-database-for-postgresql-flexible-server]
28+
2329
## Information protection and encryption
2430

2531
Azure Database for PostgreSQL - Flexible Server encrypts data in two ways:
2632

27-
- **Data in transit**: Azure Database for PostgreSQL - Flexible Server encrypts in-transit data with Secure Sockets Layer and Transport Layer Security (SSL/TLS). Encryption is enforced by default. For more detailed information on connection security with SSL\TLS see this [documentation](../flexible-server/concepts-networking-ssl-tls.md). For better security, you might choose to enable [SCRAM authentication in Azure Database for PostgreSQL - Flexible Server](how-to-connect-scram.md).
33+
- **Data in transit**: Azure Database for PostgreSQL - Flexible Server encrypts in-transit data with Secure Sockets Layer and Transport Layer Security (SSL/TLS). Encryption is enforced by default. For more detailed information on connection security with SSL\TLS, see this [documentation](../flexible-server/concepts-networking-ssl-tls.md). For better security, you might choose to enable [SCRAM authentication in Azure Database for PostgreSQL - Flexible Server](how-to-connect-scram.md).
2834

29-
Although it's highly not recommended, if needed, due to legacy client incompatibility, you have an option to disable TLS\SSL for connections to Azure Database for PostgreSQL - Flexible Server by updating the `require_secure_transport` server parameter to OFF. You can also set TLS version by setting `ssl_max_protocol_version` server parameters.
35+
Although **it's highly not recommended**, if needed, due to legacy client incompatibility, you have an option to disable TLS\SSL for connections to Azure Database for PostgreSQL - Flexible Server by updating the `require_secure_transport` server parameter to OFF. You can also set TLS version by setting `ssl_max_protocol_version` server parameters.
3036
- **Data at rest**: For storage encryption, Azure Database for PostgreSQL - Flexible Server uses the FIPS 140-2 validated cryptographic module. Data is encrypted on disk, including backups and the temporary files created while queries are running.
3137

3238
The service uses the AES 256-bit cipher included in Azure storage encryption, and the keys are system managed. This is similar to other at-rest encryption technologies, like transparent data encryption in SQL Server or Oracle databases. Storage encryption is always on and can't be disabled.
@@ -81,31 +87,33 @@ The Azure Database for PostgreSQL - Flexible Server instance is created with the
8187
```sql
8288
SELECT rolname FROM pg_roles;
8389
```
84-
- `azure_pg_admin`
90+
The roles are listed below:
8591

86-
- `azuresu`
92+
- azure_pg_admin
93+
- azuresu
8794
- administrator role
8895

8996
While you're creating the Azure Database for PostgreSQL - Flexible Server instance, you provide credentials for an **administrator role**. This administrator role can be used to create more [PostgreSQL roles](https://www.postgresql.org/docs/current/user-manag.html).
90-
For example, below we can create an example user/role called `demouser`,
97+
98+
For example, below we can create an example user/role called 'demouser'
9199

92100
```sql
93-
postgres=> CREATE USER demouser PASSWORD 'password123';
101+
102+
CREATE USER demouser PASSWORD password123;
103+
94104
```
95105
The **administrator role** should never be used by the application.
96106

97107
In cloud-based PaaS environments access to an Azure Database for PostgreSQL - Flexible Server superuser account is restricted to control plane operations only by cloud operators. Therefore, the `azure_pg_admin` account exists as a pseudo-superuser account. Your administrator role is a member of the `azure_pg_admin` role.
98108
However, the server admin account isn't part of the `azuresu` role, which has superuser privileges and is used to perform control plane operations. Since this service is a managed PaaS service, only Microsoft is part of the superuser role.
99109

100-
> [!NOTE]
101-
> Number of superuser only permissions, such as creation of certain [implicit casts](https://www.postgresql.org/docs/current/sql-createcast.html), are not available with Azure Database for PostgreSQL - Flexible Server, since `azure_pg_admin` role doesn't align to permissions of PostgreSQL superuser role.
110+
102111

103-
You can periodically audit the list of roles in your server. For example, you can connect using `psql` client and query the `pg_roles` table which lists all the roles along with privileges such as create additional roles, create databases, replication etc.
112+
You can periodically audit the list of roles in your server. For example, you can connect using `psql` client and query the `pg_roles` table , which lists all the roles along with privileges such as create additional roles, create databases, replication etc.
104113

105114
```sql
106-
postgres=> \x
107-
Expanded display is on.
108-
postgres=> select * from pg_roles where rolname='demouser';
115+
116+
select * from pg_roles where rolname='demouser';
109117
-[ RECORD 1 ]--+---------
110118
rolname | demouser
111119
rolsuper | f
@@ -120,10 +128,16 @@ rolvaliduntil |
120128
rolbypassrls | f
121129
rolconfig |
122130
oid | 24827
131+
123132
```
124133

134+
Important to note that number of **superuser only permissions**, such as creation of certain [implicit casts](https://www.postgresql.org/docs/current/sql-createcast.html), are **not available** with Azure Database for PostgreSQL - Flexible Server, since **`azure_pg_admin` role doesn't align to permissions of PostgreSQL superuser role**.
135+
136+
125137
[Audit logging in Azure Database for PostgreSQL - Flexible Server](concepts-audit.md) is also available with Azure Database for PostgreSQL - Flexible Server to track activity in your databases.
126138

139+
140+
127141
### Control schema access
128142

129143
Newly created databases in Azure Database for PostgreSQL - Flexible Server have a default set of privileges in the database's public schema that allow all database users and roles to create objects. To better limit application user access to the databases that you create on your Azure Database for PostgreSQL - Flexible Server instance, we recommend that you consider revoking these default public privileges. After doing so, you can then grant specific privileges for database users on a more granular basis. For example:
@@ -191,7 +205,7 @@ CREATE POLICY account_managers ON accounts TO managers
191205
```
192206

193207
The USING clause implicitly adds a `WITH CHECK` clause, ensuring that members of the manager role can't perform `SELECT`, `DELETE`, or `UPDATE` operations on rows that belong to other managers, and can't `INSERT` new rows belonging to another manager.
194-
You can drop a row security policy by using DROP POLICY command , as in his example:
208+
You can drop a row security policy by using DROP POLICY command, as in his example:
195209
```sql
196210

197211

@@ -207,9 +221,9 @@ ALTER TABLE accounts DISABLE ROW LEVEL SECURITY;
207221
## Bypassing Row Level Security
208222

209223
PostgreSQL has **BYPASSRLS** and **NOBYPASSRLS** permissions, which can be assigned to a role; NOBYPASSRLS is assigned by default.
210-
With **newly provisioned servers** in Azure Database for PostgreSQL - Flexible Server bypassing row level security privilege (BYPASSRLS)is implemented as follows:
211-
* For Postgres 16 and above versioned servers we follow [standard PostgreSQL 16 behavior](#postgresql-16-changes-with-role-based-security). Non-administrative users created by **azure_pg_admin** administrator role allow you to create roles with BYPASSRLS attribute\privilege as necessary.
212-
* For Postgres 15 and below versioned servers. , you can use **azure_pg_admin** user to do administrative tasks that require BYPASSRLS privilege, but cannot create non-admin users with BypassRLS privilege, since administrator role has no superuser privileges, as common in cloud based PaaS PostgreSQL services.
224+
With **newly provisioned servers** in Azure Database for PostgreSQL - Flexible Server bypassing row level security privilege (BYPASSRLS) is implemented as follows:
225+
* For Postgres 16 and above versioned servers we follow [standard PostgreSQL 16 behavior](#postgresql-16-changes-with-role-based-security). Non-administrative users created by **azure_pg_admin** administrator role allows you to create roles with BYPASSRLS attribute\privilege as necessary.
226+
* For Postgres 15 and below versioned servers. , you can use **azure_pg_admin** user to do administrative tasks that require BYPASSRLS privilege, but can't create non-admin users with BypassRLS privilege, since administrator role has no superuser privileges, as common in cloud based PaaS PostgreSQL services.
213227

214228

215229
## Update passwords
@@ -232,7 +246,7 @@ You can use client tools to update database user passwords.
232246
For example,
233247

234248
```sql
235-
postgres=> ALTER ROLE demouser PASSWORD 'Password123!';
249+
ALTER ROLE demouser PASSWORD 'Password123!';
236250
ALTER ROLE
237251
```
238252

0 commit comments

Comments
 (0)