> [!NOTE]
> Premium and Enterprise (Deprecated) [service tiers](https://docs.cloud.google.com/security-command-center/docs/service-tiers.md.txt)

> [!CAUTION]
> The Security Command Center Enterprise service tier will shut down on May 21, 2027. If your organization uses the Enterprise service tier, then the organization will automatically move to the Premium service tier on or after May 21, 2027. Contact your account representative or a [Google Cloud sales specialist](https://cloud.google.com/contact) if you have questions.

When you add ingress rules to your VPC Service Controls perimeters, you can monitor
logging streams with Event Threat Detection in Security Command Center across restricted projects.
For more information, see the
[Event Threat Detection overview](https://docs.cloud.google.com/security-command-center/docs/concepts-event-threat-detection-overview.md.txt).

## Before you begin


Make sure that you have the following role or roles on the organization:

Cloud Asset Service Agent
(`roles/cloudasset.serviceAgent`).

#### Check for the roles

1.
   In the Google Cloud console, go to the **IAM** page.

   [Go to IAM](https://console.cloud.google.com/projectselector/iam-admin/iam?supportedpurview=organizationId)
2. Select the organization.
3.
   In the **Principal** column, find all rows that identify you or a group that
   you're included in. To learn which groups you're included in, contact your
   administrator.

4. For all rows that specify or include you, check the **Role** column to see whether the list of roles includes the required roles.

#### Grant the roles

1.
   In the Google Cloud console, go to the **IAM** page.

   [Go to IAM](https://console.cloud.google.com/projectselector/iam-admin/iam?supportedpurview=organizationId)
2. Select the organization.
3. Click **Grant access**.
4.
   In the **New principals** field, enter your user identifier.

   This is typically the email address for a Google Account.

5. Click **Select a role**, then search for the role.
6. To grant additional roles, click **Add
   another role** and add each additional role.
7. Click **Save**.

## Create the ingress rules

To allow Event Threat Detection to monitor logging streams in Security Command Center within
VPC Service Controls perimeters, add the required ingress rules in those
perimeters. Perform these steps for each perimeter that you want Event Threat Detection
to monitor.

For more information, see
[Updating ingress and egress policies for a service perimeter](https://docs.cloud.google.com/vpc-service-controls/docs/configuring-ingress-egress-policies.md.txt#console)
in the VPC Service Controls documentation.


### Console

#### Navigate to the service perimeter

1. In the Google Cloud console, go to the **VPC Service Controls** page.

   [Go to VPC Service Controls](https://console.cloud.google.com/projectselector2/security/service-perimeter?supportedpurview=organizationId)
2. Select your organization.
3. In the drop-down list, select the access policy that contains the service perimeter
   that you want to grant access to.

   The service perimeters associated with the access policy appear in the list.
4. Click the name of the service perimeter that you want to update.


   To find the service perimeter you need to modify, you can check your logs for entries
   that show `RESOURCES_NOT_IN_SAME_SERVICE_PERIMETER` violations. In those
   entries, check the `servicePerimeterName` field:

   ```
   accessPolicies/ACCESS_POLICY_ID/servicePerimeters/SERVICE_PERIMETER_NAME
   ```
5. Click **Edit**.

#### Add an ingress rule

1. Click **Ingress policy**.
2. Click **Add an ingress rule**.
3. In the **From** section, set the following details:

   1. For **Identities \> Identity** , select **Select identities \& groups**.
   2. Click **Add identities**.
   3.
      Enter the email address that identifies the [Cloud Security Command Center
      Service Agent](https://docs.cloud.google.com/security-command-center/docs/access-control-org#service-agent). This address has the
      following format:

      ```
      service-org-ORGANIZATION_ID@security-center-api.iam.gserviceaccount.com
      ```

      Replace `ORGANIZATION_ID` with your organization ID.
   4. Select the service agent or press <kbd>ENTER</kbd>, and then click **Add
      identities**.
4. In the **To** section, set the following details:

   1. For **Resources \> Projects** , select **All projects**.
   2. For **Operations or IAM roles** , select **Select operations**.
   3. Click **Add operations**, and then add the following operations:

      - Add the **cloudasset.googleapis.com** service.
        1. Click **All methods**.
        2. Click **Add all methods**.
5. Click **Save**.

### gcloud

> [!WARNING]
> **Warning:** The `--set-ingress-policies` and `--set-egress-policies` flags replace all existing ingress or egress policies in the perimeter. If you have existing policies, you must retrieve them first, add the new policy to the appropriate ingress or egress YAML file, and then run the update command.

1.
   If a quota project isn't already set, then set it. Choose a project that has the
   Access Context Manager API enabled.

   ```bash
   gcloud config set billing/quota_project QUOTA_PROJECT_ID
   ```


   Replace `QUOTA_PROJECT_ID` with the ID of the project that you
   want to use for billing and quota.
2. Create a file named `ingress-rule.yaml` with the following contents:

   ```yaml
   - ingressFrom:
       identities:
       - serviceAccount:service-org-ORGANIZATION_ID@security-center-api.iam.gserviceaccount.com
       sources:
       - accessLevel: '*'
     ingressTo:
       operations:
       - serviceName: cloudasset.googleapis.com
         methodSelectors:
         - method: '*'
       resources:
       - '*'
   ```

   Replace `ORGANIZATION_ID` with your organization ID.
3. Add the ingress rule to the perimeter:

   ```bash
   gcloud access-context-manager perimeters update PERIMETER_NAME \
       --set-ingress-policies=ingress-rule.yaml
   ```

   Replace the following:
   -
     `PERIMETER_NAME`: the name of the perimeter. For example,
     `accessPolicies/1234567890/servicePerimeters/example_perimeter`.


     To find the service perimeter you need to modify, you can check your logs for
     entries that show `RESOURCES_NOT_IN_SAME_SERVICE_PERIMETER` violations.
     In those entries, check the `servicePerimeterName` field:

     ```
     accessPolicies/ACCESS_POLICY_ID/servicePerimeters/SERVICE_PERIMETER_NAME
     ```

For more information, see [Ingress and egress rules](https://docs.cloud.google.com/vpc-service-controls/docs/ingress-egress-rules.md.txt).

## What's next

- Learn how to use [Event Threat Detection](https://docs.cloud.google.com/security-command-center/docs/concepts-event-threat-detection-overview.md.txt).