Information
Disable access from Azure services to PostgreSQL Database 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, setup firewall rules to allow access from specific network ranges or VNET rules to allow access from specific virtual networks.
Solution
From Azure Console
Login to Azure Portal using https://portal.azure.com
Go to Azure Database for PostgreSQL server
For each database, click on Connection security
In Firewall rules
Ensure Allow access to Azure services is set to OFF.
Click Save to apply the changed rule.
Using Azure Command Line Interface 2.0
Use the below command to delete the AllowAllAzureIps rule for PostgreSQL Database.
az postgres server firewall-rule delete --name AllowAllAzureIps --resource-group <resourceGroupName> --server-name <serverName>