Cosmos DB should use private endpoints

High Azure General cosmosdb-private-endpoint

Applies to

  • Microsoft.DocumentDB/databaseAccounts

What CGPulse checks

A resource passes this rule when privateEndpointConnections.hasConnections must equal true. Anything else is reported as a finding with the evaluated property value attached as evidence.

How to fix it

Add a private endpoint to route traffic privately and eliminate public internet exposure. In Azure Portal: Cosmos DB > Networking > Private endpoint connections > Add. See: https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-configure-private-endpoints

CLI

az network private-endpoint create -g "{rg}" -n "{name}-pe" --vnet-name var.vnet_name --subnet "<subnet-name>" --private-connection-resource-id "{id}" --group-id "Sql" --connection-name "{name}-plsc"

Terraform

resource "azurerm_private_endpoint" "cosmosdb" {
  name                = "{name}-pe"
  resource_group_name = "{rg}"
  location            = var.location
  subnet_id           = var.subnet_id
  private_service_connection {
    name                           = "{name}-plsc"
    private_connection_resource_id = "{id}"
    subresource_names              = ["Sql"]
    is_manual_connection           = false
  }
  # Configure private_dns_zone_group with your existing DNS zone ID
}

Compliance frameworks

Vendor documentation

Is your environment compliant with this rule?

CGPulse checks it — and 621 others — against your Azure and AWS accounts with read-only access.

Run a free scan

Related Azure rules

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please reload the page.