IAM policy example: trust a SAML identity provider, with a least privilege rewrite
Facts read 16 Nov 2026. Page reviewed 16 Nov 2026.
Lets users signed in through a SAML 2.0 identity provider assume a role by calling AssumeRoleWithSAML, and requires the SAML audience to be the AWS sign-in URL. The original has no audience condition. The rewrite adds the condition. Resource names and account 111122223333 are placeholders used in AWS documentation.
Open the workbench ยท All examples
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Saml",
"Effect": "Allow",
"Principal": {
"Federated": "arn:aws:iam::111122223333:saml-provider/ExampleProvider"
},
"Action": "sts:AssumeRoleWithSAML"
}
]
}
What it allows
- Allows a user whose SAML assertion comes from ExampleProvider to assume the role.
What it allows
Allow Federated arn:aws:iam::111122223333:saml-provider/ExampleProvider to sts:AssumeRoleWithSAML.
Action or pattern Actions Access levels sts:AssumeRoleWithSAML1 Write 1
Checks
No flags from the six checks.
Without an audience condition, an assertion issued for another relying party could be accepted.
Least privilege rewrite
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "SamlAudience",
"Effect": "Allow",
"Principal": {
"Federated": "arn:aws:iam::111122223333:saml-provider/ExampleProvider"
},
"Action": "sts:AssumeRoleWithSAML",
"Condition": {
"StringEquals": {
"SAML:aud": "https://signin.aws.amazon.com/saml"
}
}
}
]
}
The rewrite adds the SAML:aud condition so only assertions meant for the AWS sign-in endpoint are accepted.
What it allows
Allow Federated arn:aws:iam::111122223333:saml-provider/ExampleProvider to sts:AssumeRoleWithSAML when SAML:aud StringEquals https://signin.aws.amazon.com/saml.
Action or pattern Actions Access levels sts:AssumeRoleWithSAML1 Write 1
Checks
No flags from the six checks.
Related pages
Sources
- IAM User Guide: create a role for SAML 2.0 federation, read 16 Nov 2026
- AWS Service Authorization Reference, programmatic access (fetched 16 Nov 2026), read 16 Nov 2026
Last reviewed 16 Nov 2026.