Sub topic 3
Permission sets and account assignments
This chapter explains how IAM Identity Center turns "this person works in these accounts" into IAM roles that the AWS CLI can use. It assumes you have read the previous chapter on how Identity Center issues access. You should also know what an IAM role and a managed policy are, and be comfortable running AWS CLI v2 commands. The later chapters on the sso-session block depend on the ideas here, because every profile you write names a permission set.
The two objects you manage
Identity Center access rests on two objects:
- A permission set is a reusable template. It lists the IAM policies that a signed-in person gets, plus a session duration.
- An account assignment connects three things: a principal (a user or a group), a permission set, and one AWS account.
A permission set grants nothing by itself. Access exists only where an assignment places the permission set in an account. Keeping the two separate lets you define "ReadOnlyAccess" once and apply it to fifty accounts.
What a permission set contains
A permission set can hold any combination of these:
| Component | What it is | Notes |
|---|---|---|
| AWS managed policies | Policies that AWS maintains, such as `ReadOnlyAccess` or `job-function/ViewOnlyAccess` | Up to 10 managed policies in total per permission set |
| Customer managed policies | Policies you created in IAM, referenced by name and path | The policy must already exist in every target account, or provisioning fails there |
| Inline policy | A JSON policy stored inside the permission set | Size-limited, and the limit is shared with the role's inline policy quota |
| Permissions boundary | One managed policy that caps what the other policies can grant | Optional |
| Session duration | How long a session for this permission set lasts, from 1 to 12 hours | The default is 1 hour |
| Relay state | A console URL to open after sign-in | Affects the web portal, not the CLI |
Policy sizes and counts are quotas that AWS may change, so check the current Identity Center quota page before you plan around them.
Session duration belongs to the permission set
The session duration is set per permission set, so a ReadOnlyAccess set can allow 8 hours while an AdministratorAccess set allows only 1. The role credentials the CLI receives for that permission set last up to that duration. The later chapter on lifetimes covers how this differs from the sign-in token lifetime. For now, remember that the permission set decides how long role credentials live, and the profile does not.
What an assignment does in the account
When you assign a permission set to an account, Identity Center provisions an IAM role in that account. You can see these roles in the IAM console, and they follow a fixed naming pattern:
AWSReservedSSO_<PermissionSetName>_<16 hex characters>The role lives under the path /aws-reserved/sso.amazonaws.com/. Some Regions add a Region segment to that path. Its trust policy lets the Identity Center service assume it on behalf of the signed-in user. The attached policies are the ones from the permission set.
Three consequences follow:
- One role per permission set per account. Assigning the same permission set to ten users in one account creates one role, not ten.
- Do not edit these roles. Identity Center owns them and overwrites manual changes. Change the permission set instead.
- Deleting the assignment deletes the role. Active sessions end when the role disappears or its policies change.
The sso_role_name in your profile is the permission set name, not the full AWSReservedSSO_... role name. The CLI sends the account ID and that name to the Identity Center portal service, which returns credentials for the matching role.
Changes need re-provisioning
Edits to a permission set do not always reach accounts instantly. If you attach a new policy to a permission set that is already assigned, Identity Center shows the accounts as out of date until it re-provisions them. In the console this is a "Reprovision" action. From the API it is provision-permission-set. Until that finishes, the role in the account keeps its old policies.
Assigning to groups instead of users
An assignment can target a user or a group. Prefer groups, for three reasons:
- Onboarding and offboarding become a group membership change instead of dozens of assignments.
- The assignment list stays short and readable.
- An auditor can see "who is in
platform-admins" in one place.
One person can hold several assignments at once, and each one appears as an account and role pair in the sign-in portal. This is how one sign-in covers both dev and prod in the shared sso-session example from the Topic Spine. The user needs one assignment per account and permission set pair, and each profile selects one pair.
Looking at the setup from the admin side
These commands need administrator access to Identity Center, either in the management account or in a delegated administrator account. Run them against the Region where Identity Center is enabled. The IDs below are placeholders.
# Find the Identity Center instance ARN and the identity store ID
aws sso-admin list-instances
INSTANCE_ARN=arn:aws:sso:::instance/ssoins-1111aaaa2222bbbb
# List permission sets, then inspect one
aws sso-admin list-permission-sets --instance-arn "$INSTANCE_ARN"
aws sso-admin describe-permission-set \
--instance-arn "$INSTANCE_ARN" \
--permission-set-arn arn:aws:sso:::permissionSet/ssoins-1111aaaa2222bbbb/ps-3333cccc4444dddd
# Which accounts has this permission set been provisioned to?
aws sso-admin list-accounts-for-provisioned-permission-set \
--instance-arn "$INSTANCE_ARN" \
--permission-set-arn arn:aws:sso:::permissionSet/ssoins-1111aaaa2222bbbb/ps-3333cccc4444dddddescribe-permission-set returns the name, description and SessionDuration. The duration is an ISO 8601 value, so eight hours appears as PT8H.
To create an assignment from the CLI, pass the principal's ID from the identity store:
aws sso-admin create-account-assignment \
--instance-arn "$INSTANCE_ARN" \
--target-id 111122223333 \
--target-type AWS_ACCOUNT \
--permission-set-arn arn:aws:sso:::permissionSet/ssoins-1111aaaa2222bbbb/ps-3333cccc4444dddd \
--principal-type GROUP \
--principal-id 90670a1b2c-1111-2222-3333-444455556666The call is asynchronous. It returns a request status with IN_PROGRESS, and you can poll it with describe-account-assignment-creation-status. Most people create assignments in the console or with infrastructure as code, but the API form shows exactly which three values define an assignment.
Confirming the result from the user side
After a user signs in with aws sso login --profile dev, aws sts get-caller-identity shows the role that the assignment produced:
{
"UserId": "AROAEXAMPLEID1234567:alice",
"Account": "111122223333",
"Arn": "arn:aws:sts::111122223333:assumed-role/AWSReservedSSO_ReadOnlyAccess_1a2b3c4d5e6f7a8b/alice"
}Read the ARN from right to left. alice is the session name, taken from the user name. The role name contains the permission set name ReadOnlyAccess. The account ID matches sso_account_id in the profile. If any of these differ from what you expect, the profile points at the wrong pair.
Common mistakes
- Profile names a permission set that is not assigned to the user in that account. Sign-in works because the user is valid, but fetching role credentials fails. Check the assignment for that exact account and permission set.
- Using the full
AWSReservedSSO_...role name assso_role_name. Use the short permission set name. - Assigning to the wrong account ID. An assignment to the staging account does not help a
prodprofile. The account ID insso_account_idmust be one where an assignment exists. - Customer managed policy missing in a target account. Provisioning fails for that account only. The permission set looks fine elsewhere.
- Expecting a permission set change to apply immediately. Re-provision and check the status.
What to carry into the next chapter
A profile in ~/.aws/config is a pointer to an assignment. It supplies the account ID and the permission set name, and the signed-in user's existing assignments decide whether the pointer resolves. In the next chapter you will write those profiles inside an sso-session block.
Exercise
A teammate's profile has sso_account_id = 444455556666 and sso_role_name = PowerUserAccess. aws sso login succeeds, but commands with that profile fail. Name two things you would check in Identity Center, and explain why a successful login does not rule them out.
Show answer
Check that the teammate (directly or through a group) has an account assignment for the PowerUserAccess permission set in account 444455556666, and that the permission set name matches exactly, since sso_role_name takes the permission set name and not the AWSReservedSSO_ role name. Login only proves that the user can authenticate to Identity Center. Role credentials are issued per account and permission set pair, so a missing or mismatched assignment fails afterward when the CLI requests credentials for that pair.
Exercise
You add an extra managed policy to a permission set that is already assigned to 20 accounts. A user in one of those accounts still cannot perform the new action 30 minutes later. What is the likely cause, and how do you fix it?
Show answer
The permission set change has not been provisioned to the accounts, so the role in each account still has the old policies. Re-provision the permission set, in the console or with aws sso-admin provision-permission-set. Then confirm the status shows success. The user may also need to refresh their role credentials, because a session created earlier may still be in use.