PostgreSQL Flexible Server PrivateDnsZoneHasWrongZoneSuffix

Stefano Pezzino 21 Reputation points
2022-08-17T22:49:39.933+00:00

I'm trying to deploy a DBforPostgreSQL/flexibleServers with private dns in a vnet.
Following the guide here on Azure Portal, everything works as expected.
Now I'm trying to replicate this using a bicep file, and when deploying from the azure cli, I get this error

{
'status': 'Failed',
'error': {
'code': 'PrivateDnsZoneHasWrongZoneSuffix',
'message': 'The Private DNS Zone name provided is not valid. It has to end with my-database.'
}
}

sample bicep file

Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,131 questions
Azure Private Link
Azure Private Link
An Azure service that provides private connectivity from a virtual network to Azure platform as a service, customer-owned, or Microsoft partner services.
460 questions
Azure Database for PostgreSQL
{count} votes

Accepted answer
  1. msrini-MSFT 9,251 Reputation points Microsoft Employee
    2022-08-18T08:27:34.073+00:00

    Hi,

    You will need to create your Private DNS Zone without my-database. This should be your name: private.postgres.database.azure.com

    resource dnsZone 'Microsoft.Network/privateDnsZones@2020-06-01' = {
    name: 'private.postgres.database.azure.com'
    location: 'global'

    DB server name should be your A record which you will need to create later.

    Regards,
    Karthik Srinivas


0 additional answers

Sort by: Most helpful