Other Articles

Cosmos DB – Protect From Direct Internet Traffic

This check ensures that Azure Cosmos DB DocumentDB accounts are not directly accessible from the public internet. Access should be restricted using private endpoints, virtual network rules, or firewall IP restrictions to reduce exposure to external threats.

Check Details

  • Resource: Azure Cosmos DB (DocumentDB)
  • Check: Ensure Cosmos DB Is Protected from Direct Internet Access
  • Risk: Cosmos DB accounts that allow unrestricted public network access may be exposed to unauthorized access, data exfiltration, and malicious activity. Public endpoints increase the attack surface and may lead to data breaches if not properly secured.

Remediation via Azure Portal

  1. Log in to the Azure Portal. Azure Portal dashboard
  2. Navigate to Azure Cosmos DB and select the affected database account. Azure Cosmos DB accounts list
  3. Under Settings, select Networking. Cosmos DB networking settings
  4. Under Public network access, ensure access is set to Selected networks or Disabled. Cosmos DB Disable Public ip
  5. If public access is required, configure:
    • Specific IP address firewall rules, or
    • Virtual Network integration using service endpoints, or
    • Private Endpoint connections.
  6. 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 Cosmos DB account:
    az cosmosdb update \
     --resource-group <resource-group> \
     --name <cosmos-account-name> \
     --public-network-access Disabled
    
  3. Alternatively, restrict public access to selected IP ranges:
    az cosmosdb update \
     --resource-group <resource-group> \
     --name <cosmos-account-name> \
     --ip-range-filter <allowed-ip-address>
    
  4. Verify public network access status:
    az cosmosdb show \
     --resource-group <resource-group> \
     --name <cosmos-account-name> \
     --query publicNetworkAccess
    

The output should return "Disabled" or confirm that only selected networks are permitted.