The error message "authentication exchange unsuccessful" typically indicates issues with the authentication method being used between your application (Kong) and the Azure PostgreSQL Flexible Server. Here are some considerations and steps you can take to troubleshoot this issue:
- SCRAM Authentication: Ensure that your PostgreSQL server is configured to support SCRAM authentication. If the server is set to use MD5 or another method, it may not work with SCRAM. You can check the
pg_hba.confconfiguration to confirm the authentication methods allowed. - SSL Configuration: Since you mentioned that SSL is enabled with verification temporarily off, ensure that the SSL settings are correctly configured. You might want to try connecting with SSL verification enabled to see if that resolves the issue. The connection string should specify
sslmode=requireorsslmode=verify-fulldepending on your security requirements. - Network Configuration: Since the database is public and accessible from all networks, ensure that there are no firewall rules or network security groups blocking the connection from your Azure Container Apps to the Azure PostgreSQL Flexible Server.
- Database Role and Permissions: Double-check that the
kongrole has the necessary permissions to connect to thekongdatabase. You mentioned that you grantedCREATEon thepublicschema, but also ensure that the role has connection privileges. - Testing Connection: Since you attempted a
psqltest from inside the container, ensure that the command used matches the connection parameters you are using in Kong. If possible, try connecting with a simpler client to rule out issues specific to Kong. - Logs and Diagnostics: Review the PostgreSQL logs for any additional error messages that may provide more context on the authentication failure. You can also enable detailed logging in Azure for more insights.
If the issue persists after these checks, consider reaching out to Azure support for further assistance, as they may have more specific insights regarding the interaction between Azure Container Apps and Azure PostgreSQL Flexible Server.
References: