Sub topic 17
Auditing changes and troubleshooting access
This chapter assumes you have worked through the earlier chapters. You should know how permission sets, account assignments, and provisioning produce roles in member accounts. You should also be comfortable with the AWS CLI and with reading CloudTrail event JSON.
Identity Center problems fall into two groups. Either a change was made and you need to know who made it, or access doesn't work and you need to know which layer is failing. Both start with the same question: where does the evidence live?
Where the evidence lives
Identity Center keeps its configuration in one place and its effects in many places. Each location answers a different question.
| Question | Where to look |
|---|---|
| Who changed a permission set or assignment? | CloudTrail in the Identity Center home Region (event source `sso.amazonaws.com`) |
| Who changed users or group membership? | CloudTrail, event source `identitystore.amazonaws.com`, or your external IdP's logs |
| Did the change reach the account? | The role in the target account and the provisioning status calls |
| Who signed in and what did they do? | `sso.amazonaws.com` sign-in events, then `AssumeRoleWithSAML` and later API calls in the member account |
| Why was a call denied? | The `errorMessage` of the denied event, plus SCPs, permissions boundaries, and the role's policies |
Identity Center is a Regional service, and its management API calls are logged in the Region where the instance was enabled. If your instance is in us-east-1, a CloudTrail search in eu-west-1 finds nothing. The first fix for "there are no events" is usually to search the home Region.
Role activity in a member account is different. An API call made by someone using an assigned role is logged in the account and Region where the call happened.
Auditing configuration changes
The events you will search for most often are these:
CreatePermissionSet,UpdatePermissionSet, andDeletePermissionSetfor the permission set itself.AttachManagedPolicyToPermissionSet,AttachCustomerManagedPolicyReferenceToPermissionSet,PutInlinePolicyToPermissionSet, andPutPermissionsBoundaryToPermissionSetfor policy changes.CreateAccountAssignmentandDeleteAccountAssignmentfor who has access to what.ProvisionPermissionSetfor the push that changes roles in accounts.
The CloudTrail lookup-events call covers the last 90 days of management events. It accepts only one lookup attribute per call, so filter further on the client side.
HOME_REGION=us-east-1
aws cloudtrail lookup-events \
--region "$HOME_REGION" \
--lookup-attributes AttributeKey=EventName,AttributeValue=CreateAccountAssignment \
--max-results 50 \
--query 'Events[].{time:EventTime,who:Username,id:EventId}' \
--output tableThe table gives you the caller and time. To see which account, group, and permission set were involved, open the full event and read requestParameters. For CreateAccountAssignment, that field holds targetId, permissionSetArn, principalType, and principalId. The principalId is a GUID. Translate it with aws identitystore describe-group --identity-store-id ... --group-id ..., because the group name does not appear in the event.
For history older than 90 days, or for queries across many accounts, use a CloudTrail trail or an organization trail that delivers to S3. Query that with Athena or CloudTrail Lake.
Identity Center also reports on assignment requests as they run. Each create-account-assignment call returns a request ID. Check it with describe-account-assignment-creation-status. Use describe-account-assignment-deletion-status for deletions.
Checking that the roles match the configuration
Configuration in Identity Center can disagree with reality in two ways. The permission set may have changed without being re-provisioned, or the role in an account may have been damaged or deleted.
To find permission sets that are out of date, ask which accounts are not on the latest version:
INSTANCE_ARN=$(aws sso-admin list-instances \
--query 'Instances[0].InstanceArn' --output text)
PS_ARN=arn:aws:sso:::permissionSet/ssoins-EXAMPLE/ps-EXAMPLE
aws sso-admin list-accounts-for-provisioned-permission-set \
--instance-arn "$INSTANCE_ARN" \
--permission-set-arn "$PS_ARN" \
--provisioning-status LATEST_PERMISSION_SET_NOT_PROVISIONEDReplace the example permission set ARN with a real one from aws sso-admin list-permission-sets. If the command returns account IDs, run provision-permission-set with --target-type ALL_PROVISIONED_ACCOUNTS as shown in the earlier chapter. Then check the result with describe-permission-set-provisioning-status.
To inspect one account, work from the account's side. Assume an administrative role in it and list the roles under the Identity Center path:
aws iam list-roles \
--path-prefix /aws-reserved/sso.amazonaws.com/ \
--query 'Roles[].RoleName'Role names have the form AWSReservedSSO_<PermissionSetName>_<hash>. If an assigned permission set has no role, provisioning did not complete in that account. If a role exists with no matching assignment, the assignment was removed and the role is being cleaned up, or something is wrong with deprovisioning. Don't edit these roles by hand. The next provisioning run overwrites the changes, and the edit hides the real problem.
Working through an access problem
Most reports reduce to "I can't get in" or "I'm in but I'm denied." Treat them as separate problems and move from the outside in.
The account does not appear in the portal
Work through these causes in order:
- The user is not in the group that holds the assignment. With an external IdP, check that provisioning (SCIM) has run and that the group exists in Identity Center. A change in the IdP can take time to arrive.
- The assignment targets the wrong account or the wrong principal. List assignments with
aws sso-admin list-account-assignments --account-id <id> --permission-set-arn <arn> --instance-arn "$INSTANCE_ARN". - The assignment request failed. Check its creation status.
- The account is suspended or has left the organization. Assignments only work for active member accounts of the organization.
The role fails to provision
The most common cause is a customer managed policy reference to a policy that is not in the target account. The permission set stores only the policy's name and path. Each account must hold a policy with that exact name and path, or provisioning fails for that account. Create the missing policy there, then re-provision. A missing policy leaves a permission set stuck in LATEST_PERMISSION_SET_NOT_PROVISIONED in exactly the accounts where the policy is absent, so the list command above names them.
The user signs in but gets AccessDenied
Find the denied call in CloudTrail in the account and Region where it was made. Read the errorMessage. Modern messages say which kind of policy denied the request, for example "with an explicit deny in a service control policy" or "because no identity-based policy allows" the action. That wording identifies the layer:
- Service control policy: the account's OU chain denies or does not allow the action. The permission set cannot override this.
- Permissions boundary: the permission set attaches a boundary, and the action is outside it. Policies in the permission set grant only what the boundary also allows.
- Role policy: no attached managed or inline policy allows the action. Compare the policy to the call's service and resource.
- ABAC condition: the resource tag and the principal tag do not match. Check that the IdP actually sends the attribute and that the tag key is spelled identically on both sides.
Access works, then stops
Sessions expire after the permission set's session duration. A CLI profile that returns The SSO session associated with this profile has expired needs aws sso login --profile <name> again. Changing a permission set does not end sessions that already exist. Neither does removing a user from a group. Plan your offboarding steps with that delay in mind.
A short audit routine
Run these checks on a schedule, for example monthly:
- List permission sets that are not provisioned to all accounts they should be in.
- Compare
CreateAccountAssignmentevents against your change records. An assignment with no matching record deserves a question. - Look for assignments to individual users instead of groups, which break the group-based design from earlier chapters.
- Search
DeleteAccountAssignmentandProvisionPermissionSetfailures in the last 30 days.
Exercise
A user in the Auditors group can see the account 111122223333 in the access portal, but every s3:ListBucket call returns AccessDenied. The ReadOnlyAuditor permission set attaches ReadOnlyAccess. The CloudTrail errorMessage says "with an explicit deny in a service control policy". Where do you fix it, and why will re-provisioning not help?
Show answer
The explicit deny comes from a service control policy in the organization, so the fix is in the SCP (or by moving the account to an OU whose SCPs permit the action). Re-provisioning only rewrites the role in the account, and the role is already correct. An SCP deny always wins over any allow in the permission set.