Bicep: Private DNS zones, Private Endpoints, and DNS Records done right

Lee Johnson 6 Reputation points
2025-01-26T11:48:10.1766667+00:00

I am deploying PEs in my Vnet (dedicated Snet) that are linked to Web App resources deployed with Vnet integration. My understanding is that I need to add A records in the Private DNS Zone. This is turning out to be a lot harder than I would have expected.

How do I add my DNS records in this scenario since I can't add the records until I have deployed my PEs (need the IPs)? Any suggestions on best practices? I've gone in multiple different directions and still haven't found a solution that works effectively.

My thinking is to build an output based on something like this so that I can get each PE details, but I can't seem to get it right. Or maybe there is a better way?

 param privateEndpoints array
    
    // Deploy Private Endpoints
    resource privateEndpoint 'Microsoft.Network/privateEndpoints@2024-05-01' = [for pe in privateEndpoints: {
      name: pe.name
      location: pe.location
      properties: {
        subnet: {
          id: pe.properties.subnetId
        }
        privateLinkServiceConnections: [
          {
            name: 'link-to-${pe.name}' // Logical name for the private link service connection
            properties: {
              privateLinkServiceId: pe.properties.privateLinkServiceId // Reference the service being linked to
              groupIds: pe.properties.groupIds
            }
          }
        ]
      }
    }]
Azure DNS
Azure DNS
An Azure service that enables hosting Domain Name System (DNS) domains in Azure.
723 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,065 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Marcin Policht 33,775 Reputation points MVP
    2025-01-28T11:13:13.4366667+00:00

    Try https://learn.microsoft.com/en-us/azure/private-link/create-private-endpoint-bicep?tabs=CLI


    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.