- Newest
- Most votes
- Most comments
Hi, look at section aws:PrincipalArn of https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html
It seems that your arn string is incorrect: 'sts' not needed.
The example of the doc is given below
IAM role – The request context contains the following value for condition key aws:PrincipalArn.
Do not specify the assumed role session ARN as a value for this condition key.
For more information about the assumed role session principal, see Role session principals.
arn:aws:iam::123456789012:role/role-name
I missed that. This answers my question why it doesn't work. However, I want to use the assumed-role arn to narrow down access to a specific user in the group, so just role arn won't do. Do you know of any other way I could narrow it down to a specific SSO user?
https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html#principal-sessions "Principal": { "AWS": "arn:aws:sts::AWS-account-ID:assumed-role/role-name/role-session-name" }
HI Have you fixed it ? I have the same issue and tried booth solutions shown above but not ways "Principal": { "AWS": "arn:aws:sts::AWS-account-ID:assumed-role/role-name/role-session-name" } arn:aws:iam::123456789012:role/role-name
Regards Sofiane
Just in case, someone else have the same prob even if this is an old post.
In a similar setup, i have the same use case. I have the following condition worked for my use case. "Condition": { "StringLike": { "aws:PrincipalArn": "arn:aws:iam:::role/aws-reserved/sso.amazonaws.com//AWSReservedSSO_*/some_user_here" } }
Relevant content
- asked 3 years ago
- AWS OFFICIALUpdated 3 years ago

I know it is an older thread. But in case anyone also trying to explore this option I would suggest to follow this approach (Restrict access when user is using cross account switch role )
"Condition": { "StringEquals": { "aws:userid": <value> } }
You can get the user id from command aws sts get-caller-identity