Prerequisites
Before deploying audit roles, ensure:AWS Organization exists
Your accounts must be organized under an AWS Organization with a designated management account.
Member accounts are active
Only
ACTIVE accounts are queried. Suspended accounts are automatically skipped.Deployment Strategy
You have two options for deploying audit roles:Option 1: CloudFormation StackSets (Recommended)
Deploy the audit role to all member accounts simultaneously from the management account.CloudFormation template for audit role
CloudFormation template for audit role
Deploy using StackSets
Deploy using StackSets
Option 2: Manual Deployment
For smaller Organizations or testing, deploy the role manually in each account using the AWS Console or CLI.Role Naming Conventions
Consistent role names simplify audit execution. Choose a standard:| Role Name | Use Case |
|---|---|
IAMAuditRole | Dedicated audit role (recommended for production) |
SecurityAuditRole | Generic security operations |
AWSControlTowerExecution | Control Tower environments (pre-existing) |
AWS CLI Profile Configuration
The audit tool uses AWS CLI named profiles to authenticate against the management account.Configure Management Account Profile
Add credentials to~/.aws/credentials:
Use IAM Identity Center (SSO) profiles for enhanced security:
Testing Role Assumption
Verify the audit role is correctly deployed and accessible:Test Single Account
Test IAM Permissions
After assuming the role, verify IAM read access:Troubleshooting Common Issues
AccessDenied when assuming role
AccessDenied when assuming role
Symptom:
An error occurred (AccessDenied) when calling the AssumeRole operationCauses:- Trust relationship missing or incorrect in member account
- Management account ID doesn’t match the trusted principal
sts:AssumeRolepermission missing in management account
- Verify trust policy in member account includes your management account ID
- Check management account has
sts:AssumeRolefor the correct role ARN - Confirm role name matches exactly (case-sensitive)
Role does not exist in some accounts
Role does not exist in some accounts
Symptom:
NoSuchEntity: The role with name IAMAuditRole cannot be foundCauses:- Role not deployed to all member accounts
- StackSet deployment still in progress
- Check StackSet deployment status:
- Redeploy to failed accounts
- The audit tool will skip accounts where the role is missing — this is expected behavior for partial deployments
ListUsers returns empty results
ListUsers returns empty results
Symptom: Audit runs successfully but finds zero users in accounts known to have IAM usersCauses:
- Missing
iam:ListUserspermission in audit role - IAM principal running audit lacks permission to assume role
- Verify the audit role policy matches the permissions documentation
- Test IAM API calls manually using temporary credentials from
assume-role
CloudTrail events not appearing
CloudTrail events not appearing
Symptom: CSV report generated but
cloudtrail_events file is emptyCauses:cloudtrail:LookupEventspermission missing- No IAM events in the queried time range
- CloudTrail not enabled in member accounts
- Confirm CloudTrail is enabled in at least
us-east-1(IAM events are global but stored regionally) - Check the date range in
iam_audit.py(default: Feb 18, 2026 to current) - Verify
cloudtrail:LookupEventsis in the audit role policy
Deployment Checklist
Before running your first audit:- CloudFormation StackSet deployed to all target accounts
- Trust relationships configured with management account ID
- IAM permissions policy attached to audit role
- AWS CLI profile configured for management account
- Test role assumption successful in at least one member account
- Test IAM read permissions with temporary credentials
Next Steps
Run Your First Audit
Execute the audit tool across your Organization
Control Tower Integration
Skip role deployment by using Control Tower’s pre-existing execution role
