The issue has been resolved by the PostgreSQL engineering team. A defect in a newly deployed token validation library was identified as the cause of valid Entra ID access tokens being rejected. To mitigate the issue, the team disabled the MISE (Managed Identity Service Engine) feature on affected Azure Database for PostgreSQL Flexible Servers. This immediately restored normal Entra authentication behavior. A permanent fix is being worked on to fully remove or replace the faulty library across production.
In v18 update for PostgreSQL getting "acquire a new token and try again error" for Entra authentication
Hello,
Getting the below error for Entra when I updated to v18 for PostgreSQL. Everything was fine in v17, and the 55-minute token refresh interval was working without any issues. I tried to change to 50-minutes in v18, but it's still the same error.
"The access token has expired. Acquire a new token and try again."
Is Entra still not stable and has bugs for v18, even though it's in GA?
Whole stack strace:
Npgsql.PostgresException (0x80004005): 28000: The access token has expired. Acquire a new token and try again. at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder1.StateMachineBox1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token) at Npgsql.Internal.NpgsqlConnector.Authenticate(String username, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) at Npgsql.Internal.NpgsqlConnector.<Open>g__OpenCore|209_0(NpgsqlConnector conn, String username, SslMode sslMode, GssEncryptionMode gssEncMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) at Npgsql.Internal.NpgsqlConnector.<Open>g__OpenCore|209_0(NpgsqlConnector conn, String username, SslMode sslMode, GssEncryptionMode gssEncMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) at Npgsql.Internal.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) at Npgsql.PoolingDataSource.OpenNewConnector(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) at Npgsql.PoolingDataSource.<Get>g__RentAsync|33_0(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlConnection.<Open>g__OpenAsync|42_0(Boolean async, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenAsync(CancellationToken cancellationToken, Boolean errorsExpected) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken) at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.AsyncEnumerator.MoveNextAsync() Exception data: Severity: FATAL SqlState: 28000 MessageText: The access token has expired. Acquire a new token and try again. File: pgaadauth.c Line: 2165 Routine: validate_access_token_internal
Azure Database for PostgreSQL
-
Manoj Kumar Boyini 6,805 Reputation points Microsoft External Staff Moderator
2026-01-16T11:20:08.76+00:00