An Azure managed PostgreSQL database service for app development and deployment.
Hi Alexandru,
Thanks for sharing the details, I understand how frustrating it is to hit this error, especially when connectivity seems to be working from your side.
Based on what you described, the fact that you’re able to connect successfully using psql from an Azure Container Apps instance in the same VNET confirms that basic network connectivity to the source PostgreSQL server is in place. However, the migration tool used for Azure Database for PostgreSQL flexible server operates slightly differently and depends on additional service-level access and configuration.
This “unexpected error” during source connection is commonly seen in scenarios where the Azure migration service cannot reach the source endpoint, even though a test client (like psql) can. This usually happens due to one of the following:
The migration service runs outside your VNET unless explicitly configured, so it may not be able to access private endpoints or VNET-isolated resources. Even if your Flexible Server is in a VNET, the migration tool itself needs network line-of-sight to the source server.
If your source PostgreSQL is behind a private network, firewall, or restricted to specific IP ranges, you’ll need to explicitly allow access from Azure services (or configure a proper integration such as Private Link or a self-hosted integration runtime).
DNS resolution can also play a role, the migration service must be able to resolve the source server hostname correctly from its execution environment.
To address this, I recommend the following approach:
First, confirm whether your source server is publicly accessible or restricted to a private network. If it’s private, the migration service won’t be able to reach it unless you configure a supported network path.
If the source is private, consider using Azure Database Migration Service (DMS) with VNET integration, which allows you to deploy the migration service inside your VNET so it can access private endpoints directly.
Alternatively, temporarily allow access to the source PostgreSQL server from Azure services (for testing purposes) and verify if the migration tool connection succeeds.
Also, ensure that firewall rules, NSGs, and routing configurations allow traffic not just from your container app, but from Azure service infrastructure as well.
You can refer to the official Microsoft documentation for detailed guidance:
Azure Database for PostgreSQL migration overview:
https://learn.microsoft.com/azure/postgresql/migrate/concepts-migration-service-postgresql
Networking requirements for migration:
https://learn.microsoft.com/azure/dms/dms-overview
If after validating the above the issue still persists, it would be helpful to capture the activity ID or correlation ID from the error and involve backend support for deeper investigation, as this may require checking service-side logs.