

# Audit access with simplified trusted identity propagation

For supported workloads, each action that Amazon EMR takes on the user's behalf is attributable to the individual user. Amazon EMR records the identity in its own AWS CloudTrail management events, such as `AddJobFlowSteps`, `GetClusterSessionCredentials`, and `StartSession`, and downstream services record it in theirs.

With identity propagation, the end user's identifier, such as the subject in the identity context, is in the Spark configuration that the event log records. On clusters that use fine-grained access control, it's in the system driver event log, which only the `hadoop` and `root` users can read. On other clusters, it's in the user driver event log. Scope read access to the Amazon S3 log bucket accordingly.

CloudTrail records the role session that made the call in the `userIdentity` element, and identifies the workforce user in the `onBehalfOf` section. The recorded `onBehalfOf` fields depend on the path:
+ On the IAM Identity Center path, `onBehalfOf` records the Identity Center `userId`, the `identityStoreArn`, the `identityCenterInstanceArn`, the `subject`, the `subjectType`, which is `user`, and the `issuer`, which is the Identity Center instance ARN.
+ On the IAM federation path, `onBehalfOf` records the `subject`, the `subjectType`, which is `user`, the `issuer`, and the `federatedProviderArn`, which is the ARN of the IAM SAML or OIDC provider.

For the full list of fields, see [CloudTrail userIdentity element](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-user-identity.html) in the *AWS CloudTrail User Guide*.

The following example shows the `userIdentity` of a CloudTrail event on the IAM Identity Center path.

```json
"userIdentity": {
  "type": "AssumedRole",
  "principalId": "AROAEXAMPLE:example-user-1",
  "arn": "arn:aws:sts::111122223333:assumed-role/DataAnalystRole/example-user-1",
  "accountId": "111122223333",
  "sessionContext": {
    "sessionIssuer": {
      "type": "Role",
      "principalId": "AROAEXAMPLE",
      "arn": "arn:aws:iam::111122223333:role/DataAnalystRole",
      "accountId": "111122223333",
      "userName": "DataAnalystRole"
    }
  },
  "onBehalfOf": {
    "userId": "544894e8-80c1-707f-60e3-3ba6510dfac1",
    "identityStoreArn": "arn:aws:identitystore::111122223333:identitystore/d-1234567890",
    "identityCenterInstanceArn": "arn:aws:sso:::instance/ssoins-1234567890abcdef",
    "subject": "example-user-1",
    "subjectType": "user",
    "issuer": "arn:aws:sso:::instance/ssoins-1234567890abcdef"
  }
}
```

The following example shows the `userIdentity` of a CloudTrail event on the IAM federation path.

```json
"userIdentity": {
  "type": "AssumedRole",
  "principalId": "AROAEXAMPLE:example-user-1",
  "arn": "arn:aws:sts::111122223333:assumed-role/DataAnalystRole/example-user-1",
  "accountId": "111122223333",
  "sessionContext": {
    "sessionIssuer": {
      "type": "Role",
      "principalId": "AROAEXAMPLE",
      "arn": "arn:aws:iam::111122223333:role/DataAnalystRole",
      "accountId": "111122223333",
      "userName": "DataAnalystRole"
    }
  },
  "onBehalfOf": {
    "subject": "example-user-1",
    "subjectType": "user",
    "issuer": "idp.example.com",
    "federatedProviderArn": "arn:aws:iam::111122223333:oidc-provider/idp.example.com"
  }
}
```

**Note**  
With simplified trusted identity propagation, identity propagation between services appears as standard `AssumeRole` events, rather than the `CreateTokenWithIAM` and `IntrospectTokenWithIAM` token-exchange events that the earlier version uses. If your SIEM rules look for those token-exchange events, update them to look for `AssumeRole` events.

The identity is also available in system tables on Amazon EMR releases 8.2 and higher. For more information, see [Use Amazon EMR system tables](emr-system-tables.md).