Sub topic 4
Users and groups as assignment targets
This chapter covers who can receive an account assignment in IAM Identity Center. It assumes you know basic IAM (roles, policies), have seen the account assignment concept (permission set + principal + account), and can run AWS CLI commands. Here you will learn what users and groups are in the identity store, how membership turns into access, and why groups should be your default target.
Principals in the identity store
An assignment names a principal, and a principal is either a user or a group. Both live in the identity store attached to your Identity Center instance. Each has an immutable ID, a GUID like 9067c6d1e2-3a4b-.... Assignments reference that ID, not the name.
- A user has a unique user name, a display name, and optional attributes such as email, name parts, and custom attributes.
- A group has a unique display name and a list of members. Members are users.
Because assignments store IDs, renaming a group does not break access. Deleting a group and creating a new one with the same name does. The new group has a new ID, so it inherits none of the old group's assignments.
Where users and groups come from
Who creates and edits users and groups depends on the identity source you chose.
| Identity source | Where you manage users and groups | What Identity Center holds |
|---|---|---|
| Identity Center directory | In Identity Center (console, CLI, API) | The authoritative users, groups, and memberships |
| External IdP with SCIM | In the IdP | A synchronized copy, read-only in Identity Center |
| Active Directory | In AD | A copy of the users and groups you chose to sync |
With an external IdP or AD, treat Identity Center as a mirror. Group changes you make in the IdP reach Identity Center after the next sync, so there is a delay. Check your IdP's sync behavior before promising a revocation time. Some IdPs flatten nested groups before sync, and some do not sync them at all. Test with a nested group before you build your design on it.
How access is computed
A user's access to an account is the union of every assignment that applies to them. That includes assignments made to the user directly and assignments made to any group they belong to. Nothing is subtracted. Identity Center has no deny assignment, so you cannot remove an inherited permission set by assigning something else to the user.
In this picture Ben ends up with ReadOnlyAuditor in account 1111 and Admin in account 2222. If Ben also had a direct ReadOnlyAuditor assignment in 1111, nothing would change. Both paths point to the same role in the account.
That last point is worth knowing. The role created in an account is named after the permission set (AWSReservedSSO_<PermissionSetName>_<hash>), not after the principal. Ten groups and fifty users assigned the same permission set in one account all assume the same IAM role. Individuals are told apart by the role session name, which is their user name. CloudTrail shows that session name, so you can still attribute actions to a person.
If a user holds several permission sets in one account, the portal shows one entry per role and the user picks one at sign-in.
Creating users, groups, and memberships
These commands work only when the identity source is the Identity Center directory. The identitystore service has its own commands, separate from sso-admin.
INSTANCE_ARN=$(aws sso-admin list-instances --query 'Instances[0].InstanceArn' --output text)
IDENTITY_STORE_ID=$(aws sso-admin list-instances --query 'Instances[0].IdentityStoreId' --output text)
GROUP_ID=$(aws identitystore create-group \
--identity-store-id "$IDENTITY_STORE_ID" \
--display-name Auditors \
--description "Read-only auditors" \
--query 'GroupId' --output text)
USER_ID=$(aws identitystore create-user \
--identity-store-id "$IDENTITY_STORE_ID" \
--user-name ana \
--display-name "Ana Silva" \
--name GivenName=Ana,FamilyName=Silva \
--emails [email protected],Type=work,Primary=true \
--query 'UserId' --output text)
aws identitystore create-group-membership \
--identity-store-id "$IDENTITY_STORE_ID" \
--group-id "$GROUP_ID" \
--member-id UserId="$USER_ID"To look up existing principals by name, use get-group-id and get-user-id with an alternate identifier. This is the lookup used in the earlier assignment example.
USER_ID=$(aws identitystore get-user-id \
--identity-store-id "$IDENTITY_STORE_ID" \
--alternate-identifier '{"UniqueAttribute":{"AttributePath":"UserName","AttributeValue":"ana"}}' \
--query 'UserId' --output text)Assigning to a user or a group
The only difference between the two is --principal-type and the ID you pass.
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"create-account-assignment is asynchronous. It returns a request ID and a status of IN_PROGRESS. Poll the result with describe-account-assignment-creation-status and check for SUCCEEDED or FAILED before you tell anyone they have access. A FAILED status includes a reason. Common causes are a permission set or principal ID that does not exist, and missing permissions for the caller.
To review what a principal can reach, ask from the principal's side:
aws sso-admin list-account-assignments-for-principal \
--instance-arn "$INSTANCE_ARN" \
--principal-id "$GROUP_ID" \
--principal-type GROUPFor a user, this lists only direct assignments. Group-derived access appears under the groups. To find a user's groups, run aws identitystore list-group-memberships-for-member --identity-store-id "$IDENTITY_STORE_ID" --member-id UserId="$USER_ID".
Why groups are the right default target
| Concern | Direct user assignment | Group assignment |
|---|---|---|
| Onboarding | One assignment per account per person | Add the person to a group |
| Offboarding | Find and delete every assignment | Remove the person from the group, or disable the user |
| Audit question "who can reach account X?" | List assignments, then resolve every user | List assignments, then resolve a few groups |
| Assignment count | Grows with people × accounts | Grows with groups × accounts |
| Fit with an IdP | Poor, because assignments are not in the IdP | Good, because membership is managed in the IdP |
Direct user assignments are acceptable in a few cases:
- A break-glass user who must work even if group sync fails.
- A temporary, one-person exception you will delete soon.
- A very small organization with a handful of accounts.
Even then, record why. Direct assignments are easy to forget and hard to find during reviews.
Edge cases to know
- Revocation is not instant for active sessions. Removing a user from a group stops new sign-ins to that role. Credentials already issued stay valid until their session duration ends. Short session durations limit the exposure.
- Disabled users. Disabling a user in the directory blocks new sign-ins, but it does not delete assignments or memberships.
- Empty groups. An assignment to a group with no members is harmless. It provisions the role in the account anyway.
- Group sync scope. With AD or a SCIM IdP, only groups that are synced exist in Identity Center. If a group does not appear in the assignment picker, check the sync scope first.
Exercises
Exercise
Ben is in the Auditors group, which has ReadOnlyAuditor in account 1111. You also assign ReadOnlyAuditor to Ben directly in account 1111. How many IAM roles does Ben's access involve in that account, and what happens if you later remove him from Auditors?
Show answer
One role, named AWSReservedSSOReadOnlyAuditor<hash>, because the role is created per permission set and account, not per principal. After removal from Auditors Ben keeps access through the direct assignment. Sessions already issued stay valid until they expire.
Exercise
You created a group with the same display name as a deleted group, and members report that their access is gone. Why, and what do you do?
Show answer
Assignments reference the group's immutable ID, and the new group has a new ID, so it has none of the old assignments. Recreate the assignments for the new group ID, for example with create-account-assignment using --principal-type GROUP, and check that each reaches SUCCEEDED.