I am trying to connect from Azure data factory to a Postgres Flexible server. I sticked to the official Microsoft documentation to achieve it: https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/how-to-connect-to-data-factory-private-endpoint
I had a identical setup with a postgres single server which worked, however, using the flexible server leaves me with a connection timeout when testing the connection from adf side using the "Test connection" button on the "linked services" menu.
We checked for firewall rules and nsg settings, nothing is blocking the traffic. The only difference in setup is the postgres server itself, all other settings are identical.
Also, we can connect to the database successfully from other resources in azure as well as from local machines.
How can I connect a postgres flexible server to the adf?
2
Answers
According to Microsoft support, there is a bug in the underlying postgres flexible server container which prevents the postgres from refreshing it's internal network interface when new private endpoints are added.
According to support, a stop and start of the server fixes the problem (NOT a restart). I did not test it on my own, they fixed it for us.
They plan to fix the issue in August, there might be an entry for the issue in the official release notes:
https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/release-notes#release-july-2024
The issue can cause because of several reasons like firewall issue, network issue between Postgres SQL and ADF instance or the azure Postgres SQL have timeout setting.
To resolve this first check the firewall you are correctly allowing all services to connect the Azure Postgres flexible server and add the timeout parameter in connection string using Additional connection properties add property name as
Timeout
and vale in the seconds as below:Also check your managed private endpoint is in approved sate and your selected target server is correct:
Here is my successful connection with Postgres flexible server using managed endpoint.