1

The Hostnameof the Postgresql flexible is name.postgres.database.azure.com, it's inside a private network. Connecting with the private IP address using VPN (IKEv2) works for me. If I try to connect or ping to the hostname then it gives this error: [could not translate host name "name.postgres.database.azure.com." to address: Unknown host] The Azure Private DNS is also linked with the VNet. Any suggestion how it could be solved?

YusufD
  • 61
  • 1
  • 10
  • You can try to set the private DNS as the DNS server of your local machine that you want to access the Postgresql from. – Charles Xu Jun 16 '21 at 01:17
  • Thank you that worked on the VM, but how can I get it to work on my local machine after connecting with VPN. I tried to use 168.63.129.16 as DNS server in the virtual network, but didnt work. – YusufD Jun 16 '21 at 11:11
  • 1
    Your desktop is configured to use a DNS server. That DNS server knows nothing about your private hosts in Azure. You can configure split-horizon DNS which is complicated or use a shortcut - edit your desktop's hosts file and create a host entry with the IP address in Azure. https://learn.microsoft.com/en-us/azure/dns/private-dns-overview#:~:text=Split%2Dhorizon%20DNS%20support.,use%20inside%20your%20virtual%20network. – John Hanley Jul 11 '21 at 19:11

1 Answers1

0

As the comments have said, you need to configure DNS so that Azure understands what ip address name.postgres.database.azure.com is associated with. We need more details about your network setup, but if you're on premise, on a laptop for example, and you have an on-premise DNS server, you need to create a conditional forwarder on that server to re-direct all DNS queries ending in postgres.database.azure.com to the endpoint IP address of an Azure based DNS forwarder VM/DNS Private Resolver resource with inbound endpoint. This Azure side DNS resource will then go talk to the global Azure DNS backbone service, which will in turn talk to your Azure Private DNS zone you say you already have setup and linked to the correct VNet. It's complex for sure, but you need to make sure DNS queries are channeled in the correct way.

See here for more info: https://learn.microsoft.com/en-us/azure/architecture/example-scenario/networking/azure-dns-private-resolver#traffic-flow-for-an-on-premises-dns-query

Theo F
  • 1,197
  • 1
  • 11
  • 18