

# Controlling web application access with permission sets

AWS Assurance permission sets control what each user who signs in to the web application through AWS IAM Identity Center can do. Users who sign in to the web application with IAM credentials through operator access aren’t affected by permission sets. Their IAM policies control their access. A *permission set* is a named list of permissions that you define in an environment. You assign a permission set to an IAM Identity Center user or group. You can apply the assignment to the whole environment or only to specific projects. AWS Assurance uses these assignments for fine-grained access control in the web application.

Permission sets work alongside IAM:
+ Every request to AWS Assurance must be allowed by IAM. For more information, see [Identity and access management for AWS Assurance](security-iam.md).
+ When a user signs in to the web application through IAM Identity Center, AWS Assurance also checks that user’s permission set assignments. Beyond default read access, a request succeeds only when both IAM and a permission set assignment allow it. For more information, see [Available permissions](#permission-sets-permissions).
+ Permission sets don’t apply to requests that you make with IAM credentials, such as calls from the AWS Management Console, the AWS CLI, or an SDK. Use IAM policies to control those requests.

Web application users act through the environment’s Identity Center role. That role’s permissions policy sets the most that any web application user can do in the environment. Permission sets narrow that access for each user and group.

AWS Assurance permission sets are separate from the IAM Identity Center permission sets that grant access to AWS accounts.

**Note**  
To use permission sets, configure IAM Identity Center for the environment. For more information, see [Setting up IAM Identity Center](setting-up.md#setting-up-identity-center).

## Available permissions
<a name="permission-sets-permissions"></a>

Every web application user gets default read access in the environment. Default access is granted automatically and doesn’t require a permission set. It lets users view projects, frameworks, controls, and discovered resources, and use the chat agent.

A permission set grants one or more of the following permissions in addition to default access.


| Permission | Console name | What it allows | 
| --- | --- | --- | 
|  `view_assessments`  | View assessments | View assessment results, evidence, tasks, comments, annotations, control status, and assessment reports. | 
|  `run_assessments`  | Run assessments | Everything in `view_assessments`. Also start, update, and delete assessments; upload, update, and delete evidence; create and update tasks; and create, update, and delete comments and annotations. | 
|  `manage_projects`  | Manage projects | Create, update, and delete projects. Build, publish, and delete custom frameworks, control groups, and controls. Enable and disable frameworks. Mark controls and requirements as not applicable for a project, and restore them. | 

A permission set can include at most one of `view_assessments` and `run_assessments`, because `run_assessments` already includes `view_assessments`. The `manage_projects` permission doesn’t include assessment access, and neither assessment permission includes `manage_projects`.

When you create a permission set in the AWS Management Console, you can start from one of the following templates. A template only fills in the form. The permission set that you create belongs to you, and changing a template later doesn’t change it.
+  **Admin** – `manage_projects` and `run_assessments` 
+  **Operator** – `run_assessments` 
+  **Viewer** – `view_assessments` 

## Assignment scope
<a name="permission-sets-scope"></a>

Each assignment applies a permission set to one user or group at one of the following scopes:
+  **Environment** – The permissions apply to every project in the environment, including projects that you create later. To assign at this scope, don’t select any projects.
+  **Project** – The permissions apply only to the projects that you select. AWS Assurance creates a separate assignment for each project.

A user’s access is the combination of every assignment that applies to them, including the assignments for the groups they belong to. For example, a user who has `view_assessments` across the environment and `run_assessments` in the `payments-prod` project can view assessments in every project but run them only in `payments-prod`.

Changes to permission sets and assignments take effect after a short delay, usually within seconds.

## Permissions for managing permission sets
<a name="permission-sets-iam"></a>

You manage permission sets with IAM credentials, in the AWS Management Console or with the API. Web application users can’t create, change, or assign permission sets.

To manage permission sets, a principal needs the following IAM permissions:
+  `assurance:GetEnvironment`, `assurance:ListEnvironments`, and `assurance:ListProjects`, to find the environment and its projects
+  `assurance:CreatePermissionSet`, `assurance:GetPermissionSet`, `assurance:ListPermissionSets`, `assurance:UpdatePermissionSet`, and `assurance:DeletePermissionSet` 
+  `assurance:AssignPermissionSet`, `assurance:RevokePermissionSet`, and `assurance:ListPermissionSetAssignments` 
+  `sso:DescribeInstance` on the environment’s IAM Identity Center instance. AWS Assurance uses this permission when you call `AssignPermissionSet` to confirm that the user or group exists.

The AWS Management Console also reads users and groups from IAM Identity Center, and it controls which users and groups can sign in to the web application. To manage access in the AWS Management Console, you also need the following permissions:
+  `sso:ListInstances`, `sso:ListApplicationAssignments`, `sso:CreateApplicationAssignment`, and `sso:DeleteApplicationAssignment` 
+  `identitystore:ListUsers`, `identitystore:ListGroups`, `identitystore:DescribeUser`, and `identitystore:DescribeGroup` 

## Managing access in the console
<a name="permission-sets-console"></a>

### To grant access to a user or group
<a name="permission-sets-console-grant"></a>

1. Open the AWS Assurance AWS Management Console and choose your environment.

1. In the **Identity Center access** section, under **Access and permission sets**, choose **Grant access**.

1. Under **Assign users**, choose **User** or **Group** for **Assignment type**, and then select the user or group.

1. Under **Configure permission set**, choose one of the following:
   +  **Use an existing permission set** – Select a permission set.
   +  **Create a new permission set** – (Optional) Choose a template in **Start from a template**. Enter a name and description, and then choose the permissions.

1. Under **Scope**, select the projects that the assignment applies to. To grant access across the whole environment, don’t select any projects.

1. Choose **Create**.

The AWS Management Console also assigns the user or group to the environment’s IAM Identity Center application so that they can sign in to the web application.

### To change a user’s or group’s access
<a name="permission-sets-console-edit"></a>

1. In the **Identity Center access** section, under **Access and permission sets**, select the user or group.

1. Choose **Actions**, and then choose **Edit access**.

1. Select a different permission set, or change the projects under **Scope**.

1. Choose **Save**.

### To change or delete a permission set
<a name="permission-sets-console-manage"></a>

1. In the **Identity Center access** section, under **Access and permission sets**, choose **Manage permission set**.

1. Select a permission set.

1. Change the name, description, or permissions, and then choose **Save**. Or, to delete the permission set, choose **Delete**, and then confirm.

Changes to a permission set apply to every user and group that it’s assigned to. You can’t delete a permission set while it has assignments. Revoke its assignments first.

### To revoke access
<a name="permission-sets-console-revoke"></a>

1. In the **Identity Center access** section, under **Access and permission sets**, select the user or group.

1. Choose **Actions**, and then choose **Revoke access**.

1. To confirm, choose **Delete**.

When you revoke a user’s or group’s last assignment, the AWS Management Console also removes their assignment to the environment’s IAM Identity Center application, so they can no longer sign in to the web application.

## Managing access with the AWS CLI
<a name="permission-sets-cli"></a>

The following examples use an environment ARN of `arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111`. Replace it with the ARN of your environment.

### Create a permission set
<a name="permission-sets-cli-create"></a>

```bash
aws assurance create-permission-set \
    --environment-arn arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 \
    --name "Payments Auditor" \
    --description "Reviews the PCI DSS assessment" \
    --permissions view_assessments
```

The response contains the ID of the new permission set:

```json
{
    "permissionSetId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE88888"
}
```

### Assign a permission set
<a name="permission-sets-cli-assign"></a>

To assign a permission set, specify the IAM Identity Center user ID or group ID in `--principal-id`. To find the ID, use the `aws identitystore list-users` or `aws identitystore list-groups` command.

The following command assigns the permission set to a group for one project. The scope `id` is the project name.

```bash
aws assurance assign-permission-set \
    --environment-arn arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 \
    --principal-type GROUP \
    --principal-id a1b2c3d4-5678-90ab-cdef-EXAMPLE12345 \
    --permission-set-id a1b2c3d4-5678-90ab-cdef-EXAMPLE88888 \
    --scopes type=PROJECT,id=payments-prod
```

The response contains one assignment ID for each project:

```json
{
    "assignmentIds": [
        "a1b2c3d4-5678-90ab-cdef-EXAMPLE99999"
    ]
}
```

To assign the permission set across the whole environment, omit `--scopes`. The only scope type that you can specify is `PROJECT`.

Assigning a permission set doesn’t let the user or group sign in to the web application. If the user or group isn’t assigned to the environment’s IAM Identity Center application yet, assign them. The `aws assurance get-environment` command returns the application ARN in `environment.identityStore.applicationArn` and the Region of your IAM Identity Center instance in `environment.identityStore.region`. Run the following command in that Region.

```bash
aws sso-admin create-application-assignment \
    --application-arn arn:aws:sso::111122223333:application/ssoins-1111111111111111/apl-1111111111111111 \
    --principal-id a1b2c3d4-5678-90ab-cdef-EXAMPLE12345 \
    --principal-type GROUP
```

### List assignments
<a name="permission-sets-cli-list"></a>

```bash
aws assurance list-permission-set-assignments \
    --environment-arn arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111
```

Each assignment in the response shows the user or group, the permission set, and the scope. An environment-wide assignment has a `scopeType` of `ENVIRONMENT` and no `scopeId`.

### Update a permission set
<a name="permission-sets-cli-update"></a>

The `--permissions` value replaces the whole list of permissions. Omitted parameters stay unchanged.

```bash
aws assurance update-permission-set \
    --environment-arn arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 \
    --permission-set-id a1b2c3d4-5678-90ab-cdef-EXAMPLE88888 \
    --permissions run_assessments
```

### Revoke an assignment and delete a permission set
<a name="permission-sets-cli-revoke"></a>

```bash
aws assurance revoke-permission-set \
    --environment-arn arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 \
    --assignment-id a1b2c3d4-5678-90ab-cdef-EXAMPLE99999

aws assurance delete-permission-set \
    --environment-arn arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 \
    --permission-set-id a1b2c3d4-5678-90ab-cdef-EXAMPLE88888
```

 `DeletePermissionSet` fails with a `ConflictException` while the permission set has assignments.

Revoking assignments doesn’t stop a user or group from signing in to the web application, where they keep default read access. To also remove sign-in, delete their assignment to the environment’s IAM Identity Center application. Run the command in the Region of your IAM Identity Center instance.

```bash
aws sso-admin delete-application-assignment \
    --application-arn arn:aws:sso::111122223333:application/ssoins-1111111111111111/apl-1111111111111111 \
    --principal-id a1b2c3d4-5678-90ab-cdef-EXAMPLE12345 \
    --principal-type GROUP
```