Newly created PostgreSQL Flexible server is not available

Oleg Katiuk 0 Reputation points
2023-09-07T22:01:59+00:00

Newly created PostgreSQL Flexible server is not available:

Have several environments:

-DEV, PostgreSQL Flexible server version - 14.8, Connectivity method - Public Acess

-QA, PostgreSQL Flexible server version - 14.8, Connectivity method - Public Acess

"Allow public access from any Azure service within Azure to this server" option is enabled on both environments.

Connection string is located as secret in Azure Key Vault, separately for DEV and QA.

Issue is that App service (API solution on .net core) cant reach PostreSQL Flexible server on QA environment.

Information from API Log Stream ->

2023-09-07T08:06:57.244808610Z Unhandled exception. System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (00000005, 0xFFFDFFFF): Name or service not known
2023-09-07T08:06:57.244881509Z at System.Net.Dns.GetHostEntryOrAddressesCore(String hostName, Boolean justAddresses, AddressFamily addressFamily, ValueStopwatch stopwatch)
2023-09-07T08:06:57.244890709Z at System.Net.Dns.GetHostAddresses(String hostNameOrAddress, AddressFamily family)
2023-09-07T08:06:57.244896209Z at Npgsql.Internal.NpgsqlConnector.Connect(NpgsqlTimeout timeout)
2023-09-07T08:06:57.244901409Z at Npgsql.Internal.NpgsqlConnector.RawOpen(SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken, Boolean isFirstAttempt)
2023-09-07T08:06:57.244906809Z at Npgsql.Internal.NpgsqlConnector.<Open>g__OpenCore|203_1(NpgsqlConnector conn, SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken, Boolean isFirstAttempt)
2023-09-07T08:06:57.244912809Z at Npgsql.Internal.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
2023-09-07T08:06:57.244917909Z at Npgsql.UnpooledDataSource.Get(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
2023-09-07T08:06:57.244923109Z at Npgsql.NpgsqlConnection.<Open>g__OpenAsync|45_0(Boolean async, CancellationToken cancellationToken)
2023-09-07T08:06:57.244928409Z at Npgsql.NpgsqlConnection.Open()
2023-09-07T08:06:57.244933209Z at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenDbConnection(Boolean errorsExpected)
2023-09-07T08:06:57.244938209Z at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternal(Boolean errorsExpected)
2023-09-07T08:06:57.244943109Z at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected)
2023-09-07T08:06:57.244948009Z at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlDatabaseCreator.Exists(Boolean async, CancellationToken cancellationToken)
2023-09-07T08:06:57.244953009Z at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlDatabaseCreator.Exists(Boolean async, CancellationToken cancellationToken)
2023-09-07T08:06:57.244958009Z at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlDatabaseCreator.Exists()
2023-09-07T08:06:57.244962909Z at Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.Exists()
2023-09-07T08:06:57.244967809Z at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
2023-09-07T08:06:57.244974208Z at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate(DatabaseFacade databaseFacade)

If any other information is required just let me know.
Pretty interesting issue I faced.
What could be the reason and possible solution?

Thanks

Azure Database for PostgreSQL
{count} votes

2 answers

Sort by: Most helpful
  1. Oleg Katiuk 0 Reputation points
    2023-09-12T15:25:06.0633333+00:00

    Hi @Oury Ba-MSFT any updates?

    May be there is standard approach how to check connection to PostgreSQL database from APP Service?


  2. RahulRandive 10,486 Reputation points Volunteer Moderator
    2023-09-18T19:52:28.0966667+00:00

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.