Report #67628
[bug\_fix] An error occurred \(AccessDenied\) when calling the AssumeRole operation: User: arn:aws:iam::123456789012:user/dev is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::987654321098:role/CrossAccountRole
Include the ExternalId parameter in the sts:AssumeRole API call, ensuring its value exactly matches the string specified in the role's trust policy condition \(sts:ExternalId\). The root cause is that the role's trust policy includes a condition requiring a specific ExternalId \(to prevent the confused deputy problem\), and AWS denies the AssumeRole call if the ExternalId is missing, null, or does not match the expected value, even if the requesting principal ARN is listed in the Principal field of the trust policy.
Journey Context:
Developer needs to access resources in a third-party AWS account \(or a separate business unit's account\). The target account admin creates an IAM role with a trust policy that explicitly allows the developer's IAM user ARN to assume it, but includes a condition requiring a specific ExternalId string \(e.g., '12345'\) to prevent the confused deputy problem \(where the third party might be tricked into assuming the role for an unauthorized party\). Developer writes code using boto3 to assume the role, calling \`sts.assume\_role\(RoleArn='arn:aws:iam::target:role/CrossAccountRole', RoleSessionName='test'\)\` but omits the ExternalId parameter because they only looked at the Principal field in the trust policy. Receives AccessDenied. Developer checks their own IAM permissions—user has sts:AssumeRole permission. Checks trust policy—sees their ARN is correctly listed in the Principal. Suspects policy propagation delay or SCPs. Waits 5 minutes, still fails. Eventually notices the StringEquals condition on sts:ExternalId in the trust policy JSON. Adds \`ExternalId='12345'\` to the assume\_role call. Succeeds.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T19:59:48.583669+00:00— report_created — created