

# Control access to AWS IAM Credential Broker

**Note**  
This is prerelease documentation for a service in preview release. It is subject to change.

Access to Credential Broker is controlled with IAM identity-based policies. A caller authenticates with its own AWS IAM credentials, and its policy must allow the Credential Broker actions for the flow it runs. The example policies in this topic scope actions to a specific pool or provider by ARN.

A pool and a provider have the following ARN forms.

```text
arn:aws:credentialbroker:<region>:<account>:credentialproviderpool/<poolId>
arn:aws:credentialbroker:<region>:<account>:credentialproviderpool/<poolId>/credentialprovider/<providerId>
```

**Note**  
For the complete list of Credential Broker actions, resources, and condition keys, see the Credential Broker page in the Service Authorization Reference.

## Permissions for obtaining tokens
<a name="credential-broker-permissions-runtime"></a>

The actions a caller needs depend on the grant type:
+ All OAuth flows need `credentialbroker:GetOAuthToken` on the provider ARN. For an API key provider, use `credentialbroker:GetApiKey` instead.
+ The authorization code grant, and the token exchange grant from an authorization code source, also need `credentialbroker:StartOAuthSession`, `credentialbroker:CompleteOAuthSessionBinding`, and `credentialbroker:GetCredentialProvider`.

The following policy allows a caller to run the client credentials grant (M2M) against one provider.

```json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "CredentialBrokerClientCredentials",
            "Effect": "Allow",
            "Action": "credentialbroker:GetOAuthToken",
            "Resource": "arn:aws:credentialbroker:us-east-1:111122223333:credentialproviderpool/pool-abc123/credentialprovider/provider-def456"
        }
    ]
}
```

The following policy allows a caller to retrieve a key from an API key provider.

```json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "CredentialBrokerGetApiKey",
            "Effect": "Allow",
            "Action": "credentialbroker:GetApiKey",
            "Resource": "arn:aws:credentialbroker:us-east-1:111122223333:credentialproviderpool/pool-abc123/credentialprovider/provider-ghi789"
        }
    ]
}
```

The following policy allows a caller to run the authorization code grant or the token exchange grant against one provider.

```json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "CredentialBrokerAuthorizationCodeFlow",
            "Effect": "Allow",
            "Action": [
                "credentialbroker:GetOAuthToken",
                "credentialbroker:StartOAuthSession",
                "credentialbroker:CompleteOAuthSessionBinding",
                "credentialbroker:GetCredentialProvider"
            ],
            "Resource": "arn:aws:credentialbroker:us-east-1:111122223333:credentialproviderpool/pool-abc123/credentialprovider/provider-def456"
        }
    ]
}
```

When the end-user identity comes from IAM Identity Center, you also grant the `getoauthtoken` scope on the pool's Identity Center application with `sso:PutApplicationAccessScope`.

## Permissions for setting up resources
<a name="credential-broker-permissions-admin"></a>

An administrator who creates and manages pools and providers needs the control-plane actions. The following policy allows an administrator to manage Credential Broker pools and providers.

```json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "ManageCredentialBrokerPoolsAndProviders",
            "Effect": "Allow",
            "Action": [
                "credentialbroker:CreateCredentialProviderPool",
                "credentialbroker:GetCredentialProviderPool",
                "credentialbroker:UpdateCredentialProviderPool",
                "credentialbroker:DeleteCredentialProviderPool",
                "credentialbroker:ListCredentialProviderPools",
                "credentialbroker:CreateCredentialProvider",
                "credentialbroker:GetCredentialProvider",
                "credentialbroker:UpdateCredentialProvider",
                "credentialbroker:DeleteCredentialProvider",
                "credentialbroker:ListCredentialProviders",
                "credentialbroker:TagResource",
                "credentialbroker:UntagResource",
                "credentialbroker:ListTagsForResource"
            ],
            "Resource": "*"
        }
    ]
}
```

Instead of authoring your own setup policy, you can attach the AWS managed policy `IAMCredentialBrokerControlFullAccess`. This policy grants full access to the Credential Broker control-plane operations and to the dependent-service actions that the service needs.

This operation might also need additional permissions depending on what you configure. The following table lists the actions that the service calls on your behalf, the operation that triggers each one, and the configuration that makes it necessary.


**Actions that Credential Broker calls on your behalf**  

| **If you** | **Operation** | **Actions the service calls** | 
| --- | --- | --- | 
| Associate a pool with IAM Identity Center | CreateCredentialProviderPool | sso:CreateApplication, sso:PutApplicationAuthenticationMethod, sso:PutApplicationGrant, sso:PutApplicationAssignmentConfiguration | 
| Associate a pool with IAM Identity Center | UpdateCredentialProviderPool | The preceding four actions, plus sso:DeleteApplication | 
| Disassociate IAM Identity Center, or delete the pool | DeleteCredentialProviderPool | sso:DeleteApplication | 
| Use a customer managed key on a pool | CreateCredentialProviderPool | kms:CreateGrant, kms:DescribeKey | 
| Use a customer managed key on a pool | UpdateCredentialProviderPool | The preceding two actions, plus kms:Decrypt, kms:Encrypt, kms:GenerateDataKeyWithoutPlaintext, kms:ReEncryptFrom, kms:ReEncryptTo | 
| Use a customer managed key on a provider | CreateCredentialProvider and UpdateCredentialProvider | All seven preceding kms: actions: kms:CreateGrant, kms:DescribeKey, kms:Decrypt, kms:Encrypt, kms:GenerateDataKeyWithoutPlaintext, kms:ReEncryptFrom, kms:ReEncryptTo | 
| Reference a secret | CreateCredentialProvider | secretsmanager:CreateSecret, secretsmanager:DescribeSecret, secretsmanager:GetSecretValue | 
| Reference a secret | UpdateCredentialProvider | The preceding three actions, plus secretsmanager:DeleteSecret, secretsmanager:PutSecretValue | 
| Delete a provider that has a service-owned secret | DeleteCredentialProvider | secretsmanager:DeleteSecret | 

The runtime retrieval operations require no additional permissions.

**Note**  
For a secret or a customer managed key that you own, the resource policy on that secret or key must allow the service to use it. The secret or key must be in the same Region as the pool.

## Tag-based access control
<a name="credential-broker-permissions-tags"></a>

You can tag pools and providers, and you can use tags in IAM policy conditions to control access to tagged resources.

The following identity policy is attached to the caller's role. It allows the caller to retrieve a token only from credential providers that are tagged `Team=reports`. The `aws:ResourceTag/Team` condition key matches the tag on the provider that `GetOAuthToken` acts on.

```json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "GetTokenFromProvidersTaggedForTeam",
            "Effect": "Allow",
            "Action": "credentialbroker:GetOAuthToken",
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "aws:ResourceTag/Team": "reports"
                }
            }
        }
    ]
}
```

You can also require tags on create and tagging operations with the `aws:RequestTag/${TagKey}` and `aws:TagKeys` condition keys.