Permitir que a VM Threat Detection acesse os perímetros do VPC Service Controls
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Neste documento, descrevemos como adicionar regras de entrada e saída para permitir que a
Detecção de ameaças a máquinas virtuais verifique VMs nos perímetros do VPC Service Controls. Faça isso
se a organização usa o VPC Service Controls para restringir serviços em projetos que
você quer que a Detecção de ameaças em VMs verifique. Para mais informações sobre a
detecção de ameaças da VM, consulte
Visão geral da detecção de ameaças da VM.
Antes de começar
Make sure that you have the following role or roles on the organization:
Access Context Manager Editor
(roles/accesscontextmanager.policyEditor).
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.
For all rows that specify or include you, check the Role column to see whether
the list of roles includes the required roles.
No campo Novos principais, digite seu identificador de usuário.
Normalmente, é o endereço de e-mail de uma Conta do Google.
Na lista Selecionar papel, escolha um.
Para conceder outros papéis, clique em addAdicionar
outro papel e adicione cada papel adicional.
Clique em Salvar.
Criar as regras de saída e entrada
Para permitir que a VM Threat Detection verifique as VMs nos perímetros do VPC Service Controls, adicione as regras de saída e entrada necessárias nesses perímetros. Siga estas etapas
para cada perímetro que você quer que a VM Threat Detection verifique.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-19 UTC."],[],[],null,["# Allow VM Threat Detection to access VPC Service Controls perimeters\n\n| Premium and Enterprise [service tiers](/security-command-center/docs/service-tiers)\n\nThis document describes how to add ingress and egress rules to allow\nVirtual Machine Threat Detection to scan VMs in your VPC Service Controls perimeters. Perform this task\nif your organization uses VPC Service Controls to restrict services in projects that\nyou want VM Threat Detection to scan. For more information about\nVM Threat Detection, see\n[VM Threat Detection overview](/security-command-center/docs/concepts-vm-threat-detection-overview).\n\nBefore you begin\n----------------\n\n\nMake sure that you have the following role or roles on the organization:\n\nAccess Context Manager Editor\n(`roles/accesscontextmanager.policyEditor`).\n\n#### Check for the roles\n\n1.\n In the Google Cloud console, go to the **IAM** page.\n\n [Go to IAM](https://console.cloud.google.com/projectselector/iam-admin/iam?supportedpurview=organizationId)\n2. Select the organization.\n3.\n In the **Principal** column, find all rows that identify you or a group that\n you're included in. To learn which groups you're included in, contact your\n administrator.\n\n4. For all rows that specify or include you, check the **Role** column to see whether the list of roles includes the required roles.\n\n#### Grant the roles\n\n1.\n In the Google Cloud console, go to the **IAM** page.\n\n [Go to IAM](https://console.cloud.google.com/projectselector/iam-admin/iam?supportedpurview=organizationId)\n2. Select the organization.\n3. Click person_add **Grant access**.\n4.\n In the **New principals** field, enter your user identifier.\n\n This is typically the email address for a Google Account.\n\n5. In the **Select a role** list, select a role.\n6. To grant additional roles, click add **Add\n another role** and add each additional role.\n7. Click **Save**.\n\nCreate the egress and ingress rules\n-----------------------------------\n\nTo allow VM Threat Detection to scan the VMs in VPC Service Controls perimeters, add\nthe required egress and ingress rules in those perimeters. Perform these steps\nfor each perimeter that you want VM Threat Detection to scan.\n\nFor more information, see\n[Updating ingress and egress policies for a service perimeter](/vpc-service-controls/docs/configuring-ingress-egress-policies#console)\nin the VPC Service Controls documentation.\n\n\n### Console\n\n1. In the Google Cloud console go to the **VPC Service Controls** page.\n\n\n [Go to VPC Service Controls](https://console.cloud.google.com/security/service-perimeter)\n2. Select your organization or project.\n3. If you selected an organization, click **Select an access policy** and then select the access policy associated with the perimeter that you want to update.\n4. Click the name of the perimeter that you want to update.\n\n\n To find the service perimeter you need to modify, you can check your logs for entries\n that show `RESOURCES_NOT_IN_SAME_SERVICE_PERIMETER` violations. In those\n entries, check the `servicePerimeterName` field: \n\n ```\n accessPolicies/ACCESS_POLICY_ID/servicePerimeters/SERVICE_PERIMETER_NAME\n ```\n5. Click edit **Edit perimeter**.\n6. Click **Egress policy**.\n7. Click **Add an egress rule**.\n8. In the **FROM** section, set the following details:\n\n 1. For **Identity** , select **Select identities \\& groups**.\n 2. Click **Add identities**\n 3.\n Enter the email address of the\n\n [Security Center service agent](/security-command-center/docs/access-control-org#service-agent).\n\n\n The service agent's address has the\n following format:\n\n ```\n service-org-ORGANIZATION_ID@security-center-api.iam.gserviceaccount.com\n ```\n\n Replace \u003cvar translate=\"no\"\u003eORGANIZATION_ID\u003c/var\u003e with your organization ID.\n 4. Select the service agent or press \u003ckbd\u003eENTER\u003c/kbd\u003e, and then click **Add identities**.\n9. In the **TO** section, set the following details:\n\n 1. For **Project** , select **All projects**.\n 2. For **Operations or IAM roles** , select **Select operations**.\n 3. Click **Add operations**, and then add the following operations:\n\n - Add the **compute.googleapis.com** service.\n 1. Click **Select methods**.\n 2. Select the\n\n **DisksService.Insert** method.\n\n 3. Click **Add selected methods**.\n10. Click **Ingress policy**.\n11. Click **Add an ingress rule**.\n12. In the **FROM** section, set the following details:\n\n 1. For **Identity** , select **Select identities \\& groups**.\n 2. Click **Add identities**\n 3.\n Enter the email address of the\n\n [Security Center service agent](/security-command-center/docs/access-control-org#service-agent).\n\n\n The service agent's address has the\n following format:\n\n ```\n service-org-ORGANIZATION_ID@security-center-api.iam.gserviceaccount.com\n ```\n\n Replace \u003cvar translate=\"no\"\u003eORGANIZATION_ID\u003c/var\u003e with your organization ID.\n 4. Select the service agent or press \u003ckbd\u003eENTER\u003c/kbd\u003e, and then click **Add identities**.\n 5. For **Sources** , select **All sources**\n13. In the **TO** section, set the following details:\n\n 1. For **Project** , select **All projects**.\n 2. For **Operations or IAM roles** , select **Select operations**.\n 3. Click **Add operations**, and then add the following operations:\n\n - Add the **compute.googleapis.com** service.\n 1. Click **Select methods**.\n 2. Select the\n\n following methods:\n\n - **DisksService.Insert**\n - **InstancesService.AggregatedList**\n - **InstancesService.List**\n 3. Click **Add selected methods**.\n14. Click **Save**.\n\n### gcloud\n\n1.\n If a quota project isn't already set, then set it. Choose a project that has the\n Access Context Manager API enabled.\n\n ```bash\n gcloud config set billing/quota_project QUOTA_PROJECT_ID\n ```\n\n\n Replace \u003cvar translate=\"no\"\u003eQUOTA_PROJECT_ID\u003c/var\u003e with the ID of the project that you\n want to use for billing and quota.\n2. Create a file named `egress-rule.yaml` with the following contents:\n\n ```yaml\n - egressFrom:\n identities:\n - serviceAccount:service-org-\u003cvar translate=\"no\"\u003eORGANIZATION_ID\u003c/var\u003e@security-center-api.iam.gserviceaccount.com\n egressTo:\n operations:\n - serviceName: compute.googleapis.com\n methodSelectors:\n - method: DisksService.Insert\n resources:\n - '*'\n ```\n\n Replace \u003cvar translate=\"no\"\u003eORGANIZATION_ID\u003c/var\u003e with your organization ID.\n3. Create a file named `ingress-rule.yaml` with the following contents:\n\n ```yaml\n - ingressFrom:\n identities:\n - serviceAccount:service-org-\u003cvar translate=\"no\"\u003eORGANIZATION_ID\u003c/var\u003e@security-center-api.iam.gserviceaccount.com\n sources:\n - accessLevel: '*'\n ingressTo:\n operations:\n - serviceName: compute.googleapis.com\n methodSelectors:\n - method: DisksService.Insert\n - method: InstancesService.AggregatedList\n - method: InstancesService.List\n resources:\n - '*'\n ```\n\n Replace \u003cvar translate=\"no\"\u003eORGANIZATION_ID\u003c/var\u003e with your organization ID.\n4. Add the egress rule to the perimeter:\n\n ```bash\n gcloud access-context-manager perimeters update PERIMETER_NAME \\\n --set-egress-policies=egress-rule.yaml\n ```\n\n Replace the following:\n -\n \u003cvar translate=\"no\"\u003ePERIMETER_NAME\u003c/var\u003e: the name of the perimeter. For example,\n `accessPolicies/1234567890/servicePerimeters/example_perimeter`.\n\n\n To find the service perimeter you need to modify, you can check your logs for\n entries that show `RESOURCES_NOT_IN_SAME_SERVICE_PERIMETER` violations.\n In those entries, check the `servicePerimeterName` field: \n\n ```\n accessPolicies/ACCESS_POLICY_ID/servicePerimeters/SERVICE_PERIMETER_NAME\n ```\n5. Add the ingress rule to the perimeter:\n\n ```bash\n gcloud access-context-manager perimeters update PERIMETER_NAME \\\n --set-ingress-policies=ingress-rule.yaml\n ```\n\n Replace the following:\n -\n \u003cvar translate=\"no\"\u003ePERIMETER_NAME\u003c/var\u003e: the name of the perimeter. For example,\n `accessPolicies/1234567890/servicePerimeters/example_perimeter`.\n\n\n To find the service perimeter you need to modify, you can check your logs for\n entries that show `RESOURCES_NOT_IN_SAME_SERVICE_PERIMETER` violations.\n In those entries, check the `servicePerimeterName` field: \n\n ```\n accessPolicies/ACCESS_POLICY_ID/servicePerimeters/SERVICE_PERIMETER_NAME\n ```\n\n\nSee\n[Ingress and egress rules](/vpc-service-controls/docs/ingress-egress-rules) for\nmore information.\n\nWhat's next\n-----------\n\n- Learn how to [use VM Threat Detection](/security-command-center/docs/how-to-use-vm-threat-detection)."]]