Sub topic 9
Provisioning: the roles that appear in each account
This chapter assumes you know IAM roles, trust policies, and the policy JSON structure. It also assumes you can run AWS CLI commands and that you have already created a permission set and an account assignment. Here you will see what IAM Identity Center creates in a member account when an assignment is made, when it updates those roles, and how to check the result.
What provisioning does
A permission set lives in the Identity Center instance. It is not an IAM object in any member account. An account assignment ties a principal (a user or group), a permission set, and one account together. Identity Center turns that assignment into IAM resources in the target account through provisioning.
When you create an assignment, Identity Center does the following in the target account:
- It creates an IAM role for the permission set, if one does not exist yet. One role exists per permission set per account, no matter how many users or groups are assigned.
- It attaches the permission set's AWS managed policies, customer managed policy references, and permissions boundary to that role. It also writes the inline policy onto the role.
- It creates, if needed, an IAM SAML identity provider in the account. The role trusts this provider.
Users never get an IAM user in the member account. They sign in through the access portal and assume the role. The result is temporary credentials.
The role you will see in IAM
Provisioned roles have a reserved name and path:
- Name:
AWSReservedSSO_<PermissionSetName>_<random suffix>, for exampleAWSReservedSSO_ReadOnlyAuditor_1a2b3c4d5e6f7a8b. - Path:
/aws-reserved/sso.amazonaws.com/. Roles in a Region-specific setup can include the Region in the path.
The suffix is generated once when the role is first created. It stays stable for that permission set in that account. Deleting the last assignment removes the role. Re-creating the assignment later produces a role with a new suffix.
The trust policy lets the Identity Center SAML provider in the account assume the role with sts:AssumeRoleWithSAML and sts:TagSession. The sts:TagSession action matters because it is how session tags for attribute-based access control reach the session. You do not edit this trust policy.
Because the suffix can change, never hard-code a role ARN with the suffix in resource policies, KMS key policies, or S3 bucket policies. Use a condition on aws:PrincipalArn with a wildcard instead:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {"AWS": "*"},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::example-audit-logs/*",
"Condition": {
"ArnLike": {
"aws:PrincipalArn": "arn:aws:iam::111122223333:role/aws-reserved/sso.amazonaws.com/AWSReservedSSO_ReadOnlyAuditor_*"
}
}
}
]
}In a real policy, also restrict the principal to your organization, for example with aws:PrincipalOrgID. A wildcard principal with only a name pattern is too permissive on its own.
When provisioning runs
Provisioning is triggered by some changes and not by others. This is the most common source of confusion.
| Change | Provisioned automatically? | What you must do |
|---|---|---|
| Create an account assignment | Yes | Nothing. Wait for the request to finish. |
| Delete an account assignment | Yes | Nothing. The role is removed if no assignment remains. |
| Edit a permission set that is already assigned | No for some paths | Re-provision to push the change. |
| Change group membership in the identity store | Not applicable | Nothing. Membership is evaluated at sign-in. |
The console shows a status on a permission set when its definition is out of date relative to what is deployed in accounts. The CLI does not warn you. After you change policies, session duration, relay state, or the permissions boundary on a permission set that already has assignments, run provision-permission-set:
INSTANCE_ARN=$(aws sso-admin list-instances --query 'Instances[0].InstanceArn' --output text)
aws sso-admin provision-permission-set \
--instance-arn "$INSTANCE_ARN" \
--permission-set-arn "$PS_ARN" \
--target-type ALL_PROVISIONED_ACCOUNTSUse --target-type AWS_ACCOUNT --target-id <account-id> to push to one account. This is useful for testing a change in a sandbox before you roll it everywhere.
Group membership is not part of provisioning. The role already exists. What changes is who can reach it, and that is decided when the user signs in.
Asynchronous requests
The assignment and provisioning calls return immediately with a request ID and a status of IN_PROGRESS. The work finishes later. If a script creates an assignment and immediately tries to use the role, it can fail. Poll the status instead:
REQUEST_ID=$(aws sso-admin create-account-assignment \
--instance-arn "$INSTANCE_ARN" \
--target-id 111122223333 \
--target-type AWS_ACCOUNT \
--permission-set-arn "$PS_ARN" \
--principal-type GROUP \
--principal-id "$GROUP_ID" \
--query 'AccountAssignmentCreationStatus.RequestId' --output text)
while true; do
STATUS=$(aws sso-admin describe-account-assignment-creation-status \
--instance-arn "$INSTANCE_ARN" \
--account-assignment-creation-request-id "$REQUEST_ID" \
--query 'AccountAssignmentCreationStatus.Status' --output text)
echo "Status: $STATUS"
if [ "$STATUS" != "IN_PROGRESS" ]; then break; fi
sleep 3
doneThe final status is SUCCEEDED or FAILED. On failure, describe-account-assignment-creation-status includes a FailureReason. For provision-permission-set, use describe-permission-set-provisioning-status with the request ID.
Checking what is deployed
Two checks tell you whether an account matches the permission set.
First, find out which permission sets are out of date. These calls list accounts where the deployed role differs from the definition:
aws sso-admin list-permission-sets-provisioned-to-account \
--instance-arn "$INSTANCE_ARN" \
--account-id 111122223333 \
--provisioning-status LATEST_PERMISSION_SET_NOT_PROVISIONED
aws sso-admin list-accounts-for-provisioned-permission-set \
--instance-arn "$INSTANCE_ARN" \
--permission-set-arn "$PS_ARN" \
--provisioning-status LATEST_PERMISSION_SET_NOT_PROVISIONEDAn empty result means the account is current.
Second, look at the role itself from inside the member account, using credentials for that account:
aws iam list-roles \
--path-prefix /aws-reserved/sso.amazonaws.com/ \
--query 'Roles[].RoleName'
ROLE=AWSReservedSSO_ReadOnlyAuditor_1a2b3c4d5e6f7a8b
aws iam list-attached-role-policies --role-name "$ROLE"
aws iam list-role-policies --role-name "$ROLE"
aws iam get-role --role-name "$ROLE" \
--query 'Role.[MaxSessionDuration,PermissionsBoundary]'Compare the output with the permission set. The attached policies match the managed policies and customer managed policy references. The inline policy appears under list-role-policies with the name SSO_Inline or a similar reserved name. MaxSessionDuration reflects the permission set's session duration.
Common failures
| Symptom | Likely cause | Fix |
|---|---|---|
| Assignment `FAILED` with a missing policy message | A customer managed policy reference names a policy that does not exist in that account | Create the policy with the same name and path in the account, then re-provision |
| Role missing policy changes you made in the permission set | You did not re-provision after editing | Run `provision-permission-set` |
| Users see the account in the portal but get an access error in a service | The permission set does not allow that action, or a service control policy or boundary blocks it | Check the effective policies on the role and the organization's SCPs |
| Role vanished | The last assignment was removed, or someone deleted the role | Re-create the assignment or re-provision |
| Assignment to a suspended account fails | The account is not active | Assign only to `ACTIVE` accounts |
A customer managed policy reference is only a name. Identity Center does not copy the policy into the account. If the policy differs between accounts, the same permission set gives different access in each. The next chapter covers keeping those policies consistent.
Session length and role limits
The role's MaxSessionDuration is set from the permission set's session duration. A longer duration means credentials stay valid longer, even after you remove someone from a group. Existing sessions are not revoked when you remove an assignment or change group membership. They end when the credentials expire. Keep this in mind when you choose a duration for sensitive permission sets.
Each role also counts against IAM quotas in the member account. A role has a limit on the size of its attached and inline policies, and an account has a limit on the number of managed policies per role. A permission set that exceeds these limits fails at provisioning, not at creation. If a provisioning request fails with a size or quota reason, split the permissions across two permission sets or reduce the inline policy.
Exercise
You added AmazonS3ReadOnlyAccess to a permission set that is already assigned to 40 accounts. Users in the accounts report that the new access is missing, and aws sso-admin list-accounts-for-provisioned-permission-set --provisioning-status LATEST_PERMISSION_SET_NOT_PROVISIONED returns 40 account IDs. What happened, what command fixes it, and how would you reduce the risk of a bad change?
Show answer
Editing an assigned permission set does not push the change to the roles already deployed, so the 40 roles still have the old policy set. Run aws sso-admin provision-permission-set --instance-arn "$INSTANCE_ARN" --permission-set-arn "$PS_ARN" --target-type ALL_PROVISIONED_ACCOUNTS, then poll describe-permission-set-provisioning-status until it reports SUCCEEDED. To reduce risk, first provision to one sandbox account with --target-type AWS_ACCOUNT --target-id <account-id>, verify the role's attached policies with aws iam list-attached-role-policies, and only then provision to all accounts.
Exercise
Why should an S3 bucket policy not use the full ARN arn:aws:iam::111122223333:role/aws-reserved/sso.amazonaws.com/AWSReservedSSO_ReadOnlyAuditor_1a2b3c4d5e6f7a8b, and what should it use instead?
Show answer
The random suffix is generated when the role is first created. If the last assignment is removed and later re-created, the role is rebuilt with a new suffix, so the bucket policy stops matching. Use an ArnLike condition on aws:PrincipalArn with a wildcard for the suffix (AWSReservedSSO_ReadOnlyAuditor_*), and also restrict by aws:PrincipalOrgID or the account.