Private Endpoint should have custom DNS configuration

Medium Azure General privateendpoints-private-endpoint-2

Applies to

  • Microsoft.Network/privateEndpoints

What CGPulse checks

A resource passes this rule when customDnsConfigs must be set true. Anything else is reported as a finding with the evaluated property value attached as evidence.

How to fix it

Configure custom DNS for proper name resolution to private IP addresses. In Azure Portal: Private Endpoint > DNS configuration > configure custom DNS. See: https://learn.microsoft.com/en-us/azure/private-link/private-endpoint-dns

CLI

az network private-dns zone create -g "{rg}" -n "<privatelink.zone.name>" && az network private-dns link vnet create -g "{rg}" -z "<privatelink.zone.name>" -n "{name}-dns-link" -v "<vnet-id>" -e false && az network private-endpoint dns-zone-group create -g "{rg}" --endpoint-name "{name}" -n "{name}-dzg" --zone-name "<zone>" --private-dns-zone "<dns-zone-id>"

Bicep

resource dnsZoneGroup 'Microsoft.Network/privateEndpoints/privateDnsZoneGroups@2023-11-01' = {
  name: '{name}-dzg'
  parent: privateEndpoint
  properties: {
    privateDnsZoneConfigs: [{
      name: 'config1'
      properties: { privateDnsZoneId: '<private-dns-zone-id>' }
    }]
  }
}

Terraform

resource "azurerm_private_endpoint" "{name}" {
  name                = "{name}"
  resource_group_name = "{rg}"
  location            = var.location
  subnet_id           = var.subnet_id
  private_service_connection {
    name                           = "{name}-plsc"
    private_connection_resource_id = "<target-resource-id>"
    subresource_names              = ["<group-id>"]
    is_manual_connection           = false
  }
  private_dns_zone_group {
    name                 = "{name}-dzg"
    private_dns_zone_ids = ["<private-dns-zone-id>"]
  }
}

Compliance frameworks

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.