π Azure PostgreSQL Flexible Server Firewall Rules allow access to Azure services π’
- Contextual name: π Flexible Server Firewall Rules allow access to Azure services π’
- ID:
/ce/ca/azure/postgresql-database/disable-flexible-server-allows-access-to-azure-services
- Located in: π Azure PostgreSQL Database
Flagsβ
- π’ Policy with categories
- π’ Policy with type
- π’ Production policy
Our Metadataβ
- Policy Type:
COMPLIANCE_POLICY
- Policy Category:
SECURITY
Similar Policiesβ
- Cloud Conformity
- Internal
dec-x-bf1f13f6
Similar Internal Rulesβ
Rule | Policies | Flags |
---|---|---|
βοΈ dec-x-bf1f13f6 | 1 |
Logicβ
- π§ prod.logic.yaml π’
Descriptionβ
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>
... [see more](description.md)
Remediationβ
Remediationβ
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
, uncheckAllow public access from any Azure service within Azure to this server
.- Click
Save
.From Azure CLIβ
Using the firewall rule name from the
Audit from Azure CLI
steps, use the below command to delete theAllowAllAzureServicesAndResourcesWithinAzureIps
rule for PostgreSQL flexible server:az postgres flexible-server firewall-rule delete --resource-group <resourceGroup> --name <serverName> --rule-name <ruleName>
Type
y
and press enter toconfirm
.From PowerShellβ
Using the firewall rule name from the
Audit from PowerShell
steps, use the below command to delete theAllowAllAzureServicesAndResourcesWithinAzureIps
rule for PostgreSQL flexible server:Remove-AzPostgreSqlFlexibleServerFirewallRule -ResourceGroupName <resourceGroup> -ServerName <serverName> -Name <ruleName>
... [see more](remediation.md)