turbot/steampipe-mod-azure-compliance

Control: 4.5.2 Ensure That Private Endpoints Are Used Where Possible

Description

Private endpoints limit network traffic to approved sources.

For sensitive data, private endpoints allow granular control of which services can communicate with Cosmos DB and ensure that this network traffic is private. You set this up on a case by case basis for each service you wish to be connected.

Remediation

From Azure Portal

  1. Open the portal menu.
  2. Select the Azure Cosmos DB blade.
  3. Select the Azure Cosmos DB account.
  4. Select Networking.
  5. Select Private access.
  6. Click + Private Endpoint.
  7. Provide a Name.
  8. Click Next.
  9. From the Resource type drop down, select Microsoft.AzureCosmosDB/databaseAccounts.
  10. From the Resource drop down, select the Cosmos DB account.
  11. Click Next.
  12. Provide appropriate Virtual Network details.
  13. Click Next.
  14. Provide appropriate DNS details.
  15. Click Next.
  16. Optionally provide Tags.
  17. Click Next : Review + create.
  18. Click Create.

Default Value

By default Cosmos DB does not have private endpoints enabled and its traffic is public to the network.

Usage

Run the control in your terminal:

powerpipe control run azure_compliance.control.cis_v210_4_5_2

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run azure_compliance.control.cis_v210_4_5_2 --share

SQL

This control uses a named query:

with cosmosdb_private_connection as (
select
distinct a.id
from
azure_cosmosdb_account as a,
jsonb_array_elements(private_endpoint_connections) as connection
where
connection -> 'properties' -> 'privateLinkServiceConnectionState' ->> 'status' = 'Approved'
)
select
a.id as resource,
case
when c.id is null then 'alarm'
else 'ok'
end as status,
case
when c.id is null then a.name || ' not uses private link.'
else a.name || ' uses private link.'
end as reason
, a.resource_group as resource_group
, sub.display_name as subscription
from
azure_cosmosdb_account as a
left join cosmosdb_private_connection as c on c.id = a.id,
azure_subscription as sub
where
sub.subscription_id = a.subscription_id;

Tags