You can manage access to your
[App Hub applications](https://docs.cloud.google.com/app-hub/docs/key-concepts.md.txt#application) by
assigning [Identity and Access Management (IAM)](https://docs.cloud.google.com/iam/docs/overview.md.txt) roles to principals,
such as users, groups, or service accounts. In a
[management project](https://docs.cloud.google.com/app-hub/docs/key-concepts.md.txt#mgmt-project), you can
grant permissions across all applications in that project's
[application management boundary](https://docs.cloud.google.com/app-hub/docs/key-concepts.md.txt#app-mgmt-boundary) or to
individual applications.

For recommended roles, see
[Grant application-centric roles to your users](https://docs.cloud.google.com/resource-manager/docs/manage-applications.md.txt#assign-roles).

## Grant access to all applications

To grant access to all applications within your application management boundary, assign
an IAM role to a principal on the management project:

### Console

1. In the Google Cloud console, use the project picker to select your
   management project.

2. Navigate to the **IAM** page.

   [Go to IAM](https://console.cloud.google.com/iam-admin/iam?supportedpurview=project)
3. Click **Grant access**.

4. Enter an identifier for the principal who will get access to all
   applications within the boundary. For example,
   `user@example.com`.

5. From the **Select a role** drop-down menu, search for the role you want to
   assign and click it.

6. Click **Save**.

7. Verify that the principal and the corresponding role are listed in the
   IAM page.

### gcloud

1. [Find the project ID](https://docs.cloud.google.com/resource-manager/docs/creating-managing-projects.md.txt#identifying_projects)
   of the management project.

2. Add a [policy binding](https://docs.cloud.google.com/iam/docs/granting-changing-revoking-access.md.txt):

   ```bash
   gcloud projects add-iam-policy-binding PROJECT_ID \
      --member=USER_EMAIL \
      --role=ROLE
   ```

   Replace the following:
   - `PROJECT_ID`: the ID of the management project.
   - `USER_EMAIL`: the email address of the user who will get access to all applications within the boundary, such as `user@example.com`.
   - `ROLE`: the role that you want to provide to the user, such as `roles/apphub.editor`.

## Grant access to individual applications

To grant access to individual applications within your
[application management boundary](https://docs.cloud.google.com/app-hub/docs/key-concepts.md.txt#app-mgmt-boundary), assign an
IAM role to a principal on the application:

1. [Find the project ID](https://docs.cloud.google.com/resource-manager/docs/creating-managing-projects.md.txt#identifying_projects)
   of the management project.

2. Set a [IAM policy](https://docs.cloud.google.com/iam/docs/reference/rest/v1/Policy.md.txt):

   ```bash
   gcloud apphub applications set-iam-policy APPLICATION_NAME \
      --project=PROJECT_ID \
      --location=LOCATION \
      POLICY_FILE
   ```

   Replace the following:
   - `APPLICATION_NAME`: the name of your application. The name must include only lowercase alphanumeric characters without spaces, such as `my-application`.
   - `PROJECT_ID`: the ID of the management project.
   - `LOCATION`: the location of the application. Use `global` for global applications, a multi-region (`us` or `eu`) for multi-regional applications, or a specific region, such as `us-east1`, for regional applications.
   - `POLICY_FILE`: the name of the policy file that grants the role to the user, such as `my-policy.yaml`.

The following example of a policy file grants the `roles/apphub.editor` role to
the user `user@example.com`:

```yaml
# policyfile.yaml
bindings:
- role: roles/apphub.editor
  members:
  - user:user@example.com
```