How connection pooling works with Entra ID authentication
mainThe driver provides built-in connection pooling enabled by default. When using Entra ID authentication, there are important considerations for multi-user processes:
- Interactive/Device-code Auth: The driver caches one credential instance per authentication type for the lifetime of the process. This means all connections in the same process share the identity of the first user who authenticated. Do not use this for multi-user applications; instead, use a per-user token provider.
- Bring-your-own token (
token_provider/attrs_before): The driver cannot refresh tokens it did not mint. If you provide your own token, you are responsible for managing its lifetime. If a pooled connection is reused after a token expires, the reconnect will fail. ActiveDirectoryDefault: This resolves to the ambient identity (e.g., Managed Identity). It is not designed to distinguish between end users in a multi-user workload and is not expiry-aware for custom tokens.