- Newest
- Most votes
- Most comments
It seems the issue you're experiencing is related to the integration of RDS IAM Authentication with SSO and an external identity provider (Azure AD in your case). This setup can be complex, and there are a few things to consider:
-
IAM database authentication is designed to work with IAM users and roles, but it may not directly support external identity providers through SSO. The successful connection with an IAM user suggests that the RDS IAM Authentication itself is working correctly.
-
When using SSO with an external IdP, the identity of the user is managed by the external system, which may not translate directly to the IAM identity expected by RDS IAM Authentication.
-
The "PAM authentication failed" error typically indicates that the database is not recognizing the authentication token or the user identity.
To address this issue, you might consider the following approaches:
-
Instead of directly using SSO credentials, you could set up a process where SSO users assume an IAM role that has the necessary permissions for RDS IAM Authentication. This extra step might bridge the gap between SSO and RDS IAM Auth.
-
Ensure that the SSO user's identity (email in your case) exactly matches the database username you've created. Any mismatch here could cause authentication failures.
-
Double-check that the ARN in your IAM policy correctly matches your database instance identifier. The format should be: arn:aws:rds-db:region:account-id:dbuser:db-resource-id/database-username
-
If you're using the AWS CLI or SDKs to generate the authentication token, make sure you're using the correct credentials - those of the assumed IAM role rather than the SSO user directly.
-
Consider using AWS Secrets Manager or AWS Systems Manager Parameter Store to manage database credentials as an alternative if RDS IAM Authentication with SSO proves too challenging to implement.
If these approaches don't resolve the issue, you may need to reach out to AWS Support for further assistance, as the interaction between SSO, external IdPs, and RDS IAM Authentication can be complex and may require deeper investigation.
Sources
RDS IAM Auth + SSO Users | AWS re:Post
Database authentication with Amazon RDS - Amazon Relational Database Service
Cannot connect to RDS Postgres using the IAM Authentication | AWS re:Post
answered 2 years ago
Relevant content
asked 3 years ago
