This document shows you how to create and remove role bindings within a
Distributed Cloud project using the GDC console or the
gdcloud CLI.

This document is for audiences within the application operator group who manage
permissions within GDC projects. For more information,
see
[Audiences for GDC air-gapped documentation](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/resources/audiences.md.txt).

## Before you begin

Before creating or removing role bindings, you must request the necessary
permissions.

### Request IAM roles

To create, update, and delete role bindings within a project, contact your
IAM Org Admin or IAM Project Admin to request the **IAM Project Admin**
(`project-iam-admin`) role.

The IAM Org Admin can grant this role for any project within the
organization. The IAM Project Admin can grant this role within the scope of
their specific project.

## Set up role bindings

Work through the following steps to set up role bindings:

### Console

1. Sign in to the GDC console. For example, the following image signs in to the GDC console for an organization named `org-1`: ![](https://docs.cloud.google.com/static/distributed-cloud/hosted/docs/latest/gdcag/platform/pa-user/iam/images/login.png)
2. Click **Select project** in the menu bar. Select one of the existing projects you want to set up the role binding in, then click **Open** . The selected project displays after your org name in the menu bar. The following example shows the selected `iam-test` project: ![](https://docs.cloud.google.com/static/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/iam/images/select-project.png)
3. In the navigation menu, click **Identity \& Access** and **Access** . ![](https://docs.cloud.google.com/static/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/iam/images/access.png)
4. Click **Add member** . ![](https://docs.cloud.google.com/static/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/iam/images/add-member.png)
5. In the **Identity provider** dropdown menu, select an identity provider. ![](https://docs.cloud.google.com/static/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/iam/images/select-identity-provider.png)
6. After **Member type** , choose whether you want to add individual users with **User** , or groups with **Group** . The following example shows the selected `User`: ![](https://docs.cloud.google.com/static/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/iam/images/member-type.png)
7. In the **Username or group alias** field, enter the username, email address, or alias. ![](https://docs.cloud.google.com/static/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/iam/images/username-or-group-alias.png)
8. In the **Roles** drop-down list, select the role that you want to assign to the user or group, such as **Project Viewer** . You can bind the selected user or group with multiple roles at a time by clicking **Add Another Role** . ![](https://docs.cloud.google.com/static/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/iam/images/role.png)
9. Click **Add** . ![](https://docs.cloud.google.com/static/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/iam/images/add-binding.png)

### gdcloud

1. Ensure you have the
   [gdcloud CLI installed](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/resources/gdcloud-overview.md.txt#download-and-install).

2. Sign in using the `gdcloud auth login` command to authenticate with your
   identity provider. For more information, see
   [the gdcloud CLI authentication](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/resources/gdcloud-auth.md.txt#login).

3. Set up role bindings for a project:

   ```bash
   gdcloud projects add-iam-policy-binding PROJECT \
     --member=USER_ACCOUNT \
     --role=ROLE
   ```

   Replace the following variables:
   - `PROJECT`: the name of the project for which you're setting up the role binding.
   - `USER_ACCOUNT`: the user account to which you want to grant the role. This flag accepts either a user email address with the identity provider prefix (`user:idpprefix-user@example.com`) or a service account name with the service account project (`serviceAccount:projectName:serviceAccountName`).
   - `ROLE`: the name of the predefined or custom role you want to assign to the user.

## Remove role bindings

When access is no longer required, remove a member and their associated roles,
permissions, and access.

To remove members, work through the following steps:

### Console

1. Sign in to the GDC console.
2. Click **Select project** in the menu bar. Select one of the existing projects you want to set up the role binding in, then click **Open**. The selected project displays after your org name in the menu bar.
3. In the navigation menu, click **Identity \& Access** and **Access**.
4. In the authorized members list, select a member. You can remove multiple members at a time by selecting multiple members in the list. ![](https://docs.cloud.google.com/static/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/iam/images/members.png)
5. Click **Remove All Access** to remove all the role bindings associated with a member from your current project. ![](https://docs.cloud.google.com/static/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/iam/images/remove-all-access.png)
6. When prompted, click **Remove Member** to confirm. ![](https://docs.cloud.google.com/static/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/iam/images/remove-member.png)

### gdcloud

1. Ensure you have the
   [gdcloud CLI installed](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/resources/gdcloud-overview.md.txt#download-and-install).

2. Sign in using the `gdcloud auth login` command to authenticate with your
   identity provider. For more information, see
   [the gdcloud CLI authentication](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/resources/gdcloud-auth.md.txt#login).

3. Remove role bindings for a project:

   ```bash
   gdcloud projects remove-iam-policy-binding PROJECT \
     --member=USER_ACCOUNT \
     --role=ROLE
   ```

   Replace the following variables:
   - `PROJECT`: the name of the project from which you're removing the role binding.
   - `USER_ACCOUNT`: the user account from which you want to remove the role. This flag accepts either a user email address with the identity provider prefix (`user:idpprefix-user@example.com`) or a service account name with the service account project (`serviceAccount:projectName:serviceAccountName`).
   - `ROLE`: the name of the predefined or custom role you want to remove from the user account.