Description
Disable access from Azure services to PostgreSQL flexible server
.
Rationaleβ
If access from Azure services is enabled, the server's firewall will accept connections from all Azure resources, including resources not in your subscription. This is usually not a desired configuration. Instead, set up firewall rules to allow access from specific network ranges or VNET rules to allow access from specific virtual networks.
Auditβ
From Azure Portalβ
- Login to Azure Portal using https://portal.azure.com.
- Go to
Azure Database for PostgreSQL flexible servers
. - For each database, under
Settings
, clickNetworking
. - Under
Firewall rules
, ensureAllow public access from any Azure service within Azure to this server
is not checked.
From Azure CLIβ
Ensure the below command does not return a rule with a name beginning AllowAllAzureServicesAndResourcesWithinAzureIps
or with "startIpAddress": "0.0.0.0"
or "endIpAddress": "0.0.0.0"
:
az postgres flexible-server firewall-rule list --resource-group <resourceGroup> --name <serverName>
From PowerShellβ
Ensure the below command does not return a rule with a name beginning AllowAllAzureServicesAndResourcesWithinAzureIps
:
Get-AzPostgreSqlFlexibleServerFirewallRule -ResourceGroupName <resourceGroup> -ServerName <serverName>
From Azure Policyβ
If referencing a digital copy of this Benchmark, clicking a Policy ID will open a link to the associated Policy definition in Azure.
- Policy ID: 5e1de0e3-42cb-4ebc-a86d-61d0c619ca48 - Name:
Public network access should be disabled for PostgreSQL flexible servers
Default Valueβ
The Azure Postgres firewall is set to block all access by default.
Referencesβ
- https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/concepts-firewall-rules
- https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/how-to-manage-firewall-cli
- https://learn.microsoft.com/en-us/security/benchmark/azure/mcsb-network-security#ns-1-establish-network-segmentation-boundaries
- https://learn.microsoft.com/en-us/security/benchmark/azure/mcsb-network-security#ns-6-deploy-web-application-firewall