Other Articles

Cosmos DB for PostgreSQL – Protect From Direct Internet Traffic

This check ensures that Azure Cosmos DB for PostgreSQL clusters are not directly exposed to the public internet. Deploying clusters within private virtual networks and restricting public access reduces the risk of unauthorised access and external threats.

Check Details

  • Resource: Azure Cosmos DB for PostgreSQL
  • Check: Ensure Protection From Direct Internet Traffic
  • Risk: If public network access is enabled or firewall rules allow unrestricted access (such as 0.0.0.0/0), the PostgreSQL cluster may be exposed to brute-force attacks, unauthorized connections, and potential data compromise.

Remediation via Azure Portal

  1. Log in to the Azure Portal. Azure Portal dashboard
  2. Navigate to Azure Cosmos DB for PostgreSQL and select the affected cluster. Cosmos DB for PostgreSQL clusters list
  3. Under Settings, select Networking. Cosmos DB for PostgreSQL networking settings
  4. Ensure Public access is set to Disabled. Cosmos DB for PostgreSQL public access settings
  5. If public access is required, ensure firewall rules restrict access to specific trusted IP address ranges only.
  6. Confirm the cluster is deployed within a Virtual Network (VNet) for private connectivity.
  7. Click Save to apply the configuration.

Remediation via Azure CLI

  1. Open Azure Cloud Shell or a local terminal with Azure CLI installed. Azure Cloud Shell
  2. Disable public network access for the PostgreSQL cluster:
    az postgres flexible-server update \
     --resource-group <resource-group> \
     --name <cluster-name> \
     --public-access none
    
  3. Verify that public access is disabled:
    az postgres flexible-server show \
     --resource-group <resource-group> \
     --name <cluster-name> \
     --query publicNetworkAccess
    

The output should return "Disabled", confirming that the PostgreSQL cluster is protected from direct internet traffic.