Algumas ou todas as informações nesta página podem não se aplicar à nuvem confiável da S3NS. Consulte
Diferenças do Google Cloud para mais detalhes.
Aplicar a política da organização usando o Resource Manager
Antes de começar
-
Verify that billing is enabled for your Trusted Cloud project.
-
Enable the Compute Engine and Resource Manager APIs.
Enable the APIs
-
Make sure that you have the following role or roles on the organization:
Organization Policy > Organization Policy Administrator, Compute Engine > Compute Storage Admin
Check for the roles
-
In the Trusted Cloud console, go to the IAM page.
Go to IAM
-
Select the organization.
-
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.
Grant the roles
-
In the Trusted Cloud console, go to the IAM page.
Acessar o IAM
-
Selecione a organização.
-
Clique em person_addCONCEDER ACESSO.
-
No campo Novos principais, digite seu identificador de usuário.
Normalmente, é o identificador de um usuário em um pool de identidades de força de trabalho. Saiba mais em
Representar usuários do pool de força de trabalho nas políticas do IAM ou entre em contato com seu administrador.
-
Na lista Selecionar papel, escolha um.
-
Para conceder outros papéis, clique em add Adicionar
outro papel e adicione cada papel adicional.
-
Clique em Salvar.
Como criar um projeto novo
Para criar um recurso de projeto, siga as etapas abaixo:
Para criar um projeto novo, execute as seguintes etapas:
-
Acesse a página Gerenciar recursos no Trusted Cloud console.
Acessar "Gerenciar recursos"
As etapas restantes aparecem no console do Trusted Cloud .
-
Na lista suspensa Selecionar organização, na parte de cima da página, escolha o
recurso da organização em que o projeto vai ser criado. Se você é um usuário da avaliação
gratuita, pule esta etapa porque a lista não será exibida.
- Clique em Criar projeto.
-
Na janela Novo projeto que vai ser exibida, insira o nome do projeto e selecione uma
conta de faturamento, conforme aplicável. O nome de um projeto só pode ser composto por letras, números, aspas
simples, hifens, espaços ou pontos de exclamação e precisa ter entre 4 e 30 caracteres.
-
Insira o recurso da organização ou pasta mãe na caixa Local. Esse recurso
vai ser o pai hierárquico do novo projeto. Se houver a opção Sem organização,
selecione-a para criar o novo projeto como o nível superior da própria hierarquia de recursos.
- Quando terminar de inserir os detalhes do novo projeto, clique em Criar.
Depois de criar o Projeto, o papel Proprietário é atribuído a você.
Esse papel inclui todas as permissões necessárias para o guia de início rápido a seguir.
Para obter mais informações sobre permissões, consulte Como conceder, alterar e revogar o acesso a recursos.
Criar um disco do Compute Engine
Para testar a funcionalidade da restrição de locais de recursos, configure discos permanentes regionais do Compute Engine. Ao criar um disco permanente regional, você deve especificar o local onde ele ficará. Para mais informações sobre como criar discos permanentes regionais do Compute Engine, consulte Criar e gerenciar volumes do Persistent Disk regional.
No console Trusted Cloud , acesse a página Discos.
Acessar "Discos"
Selecione o projeto criado anteriormente.
- Se for solicitado que você vincule uma conta de faturamento ao seu projeto, faça isso agora.
Para obter mais informações sobre como ativar o faturamento, consulte a seção Como modificar as configurações de faturamento de um projeto.
Clique em Criar disco.
Especifique um Nome para o disco.
Selecione Replicar este disco na região.
Em Região, selecione europe-north1 (Finland)
.
Em Zonas, selecione europe-north1-a
e europe-north1-b
.
Clique em Criar.
Quando o disco for criado, uma marca de seleção verde aparecerá ao lado do nome.
Como definir a política da organização
Para definir uma política da organização no projeto que você criou:
No console Trusted Cloud , acesse a página Políticas da organização.
Acessar as políticas da organização
Clique em Selecionar.
Selecione o projeto criado.
Clique em Google Cloud Platform - Definir locais do recurso e, em seguida, clique em Editar.
Em É aplicável a, selecione Personalizar.
Em Valores da política, selecione Personalizado.
Em Tipo de política, selecione Permitir.
Na caixa Valor da política, digite in:asia-locations
.
Clique em Salvar. Uma notificação é exibida para confirmar a atualização da política.
asia-locations
é um grupo de valores selecionado pelo Google para incluir todos os locais em uma determinada região geográfica.
Nesse caso, cada região da Ásia é definida como um local permitido para todos os recursos criados depois desse ponto. Observe que o disco permanente regional que você criou acima não é afetado por essa nova política, porque a política não é retroativa.
Como testar a política da organização
Agora que a política da organização está em vigor, não é possível criar recursos em regiões que não foram especificadas como parte da política da organização. Para testar isso, tente criar um disco permanente regional em um local inválido:
No console Trusted Cloud , acesse a página Discos.
Acessar "Discos"
Selecione o projeto criado acima.
Clique em Criar disco.
Especifique um Nome para o disco.
Selecione Replicar este disco na região.
Em Região, selecione europe-north1 (Finland)
.
Em Zonas, selecione europe-north1-a
e europe-north1-b
.
Clique em Criar.
Um ponto de exclamação vermelho é exibido ao lado do nome, e uma notificação de erro é exibida:
Location ZONE:europe-north1-a violates constraint
constraints/gcp.resourceLocations on the resource RESOURCE_ID
Em que RESOURCE_ID é o caminho completo do recurso do projeto e do disco.
O disco não foi criado.
Como criar um disco permanente regional em um local válido
A restrição da política da organização bloqueia a criação de recursos, a menos que você especifique um local válido:
No console Trusted Cloud , acesse a página Discos.
Acessar "Discos"
Selecione o projeto criado anteriormente.
Clique em Criar disco.
Especifique um Nome para o disco.
Selecione Replicar este disco na região.
Em Região, selecione asia-east2 (Hong Kong)
.
Em Zonas, selecione asia-east2-a
e asia-east2-b
.
Clique em Criar.
O recurso foi criado porque todas as zonas em asia-east2
estão dentro do grupo de valores asia-locations
.
Limpar
Para evitar cobranças na sua conta do Trusted Cloud pelos
recursos usados nesta página, siga estas etapas.
Como excluir discos permanentes regionais
Para excluir os discos permanentes regionais criados para este guia de início rápido:
No console Trusted Cloud , acesse a página Discos.
Acessar "Discos"
Na lista exibida, selecione os dois discos que você criou.
À direita do botão Criar disco, clique em Excluir.
Na caixa de diálogo de confirmação que aparecerá, clique em Excluir.
Uma caixa de diálogo de notificação é exibida para confirmar que os discos foram excluídos.
Como excluir o projeto
Para excluir o projeto que você criou para este guia de início rápido:
No console Trusted Cloud , acesse a página Gerenciar recursos.
Acessar "Gerenciar recursos"
Na lista suspensa na parte superior da página, selecione a Organização na qual você criou o Projeto deste guia de início rápido.
Na lista de recursos do projeto exibida, selecione o projeto que você criou e clique em Excluir.
Na caixa de diálogo Encerrar projeto exibida, insira o ID do projeto e clique em Encerrar.
Exceto em caso de indicação contrária, o conteúdo desta página é licenciado de acordo com a Licença de atribuição 4.0 do Creative Commons, e as amostras de código são licenciadas de acordo com a Licença Apache 2.0. Para mais detalhes, consulte as políticas do site do Google Developers. Java é uma marca registrada da Oracle e/ou afiliadas.
Última atualização 2025-08-18 UTC.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Não contém as informações de que eu preciso","missingTheInformationINeed","thumb-down"],["Muito complicado / etapas demais","tooComplicatedTooManySteps","thumb-down"],["Desatualizado","outOfDate","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Problema com as amostras / o código","samplesCodeIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-18 UTC."],[],[],null,["# Quickstart: Enforce organization policy by using Resource Manager\n\nEnforce organization policy by using Resource Manager\n=====================================================\n\nThis guide describes how to set an [organization policy](/resource-manager/docs/organization-policy/overview) that\nincludes the [resource locations](/resource-manager/docs/organization-policy/defining-locations) constraint, and\nhow to test that constraint after it is applied in the\n[Google Cloud console](https://console.cloud.google.com/).\n\nBefore you begin\n----------------\n\n1.\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n2.\n\n\n Enable the Compute Engine and Resource Manager APIs.\n\n\n [Enable the APIs](https://console.cloud.google.com/flows/enableapi?apiid=compute.googleapis.com,cloudresourcemanager.googleapis.com&redirect=https://console.cloud.google.com)\n3.\n\n Make sure that you have the following role or roles on the organization:\n\n Organization Policy \\\u003e Organization Policy Administrator, Compute Engine \\\u003e Compute Storage Admin\n\n #### Check for the roles\n\n 1.\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)\n 2. Select the organization.\n 3.\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\n 4. 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\n 1.\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)\n 2. Select the organization.\n 3. Click person_add **Grant access**.\n 4.\n In the **New principals** field, enter your user identifier.\n\n This is typically the email address for a Google Account.\n\n 5. In the **Select a role** list, select a role.\n 6. To grant additional roles, click add **Add\n another role** and add each additional role.\n 7. Click **Save**.\n\nCreate new Project\n------------------\n\nTo create a Project resource, follow the steps below:\n\nTo create a new project, do the following:\n\n1. Go to the **Manage resources** page in the Google Cloud console.\n\n [Go to Manage Resources](https://console.cloud.google.com/cloud-resource-manager?walkthrough_id=resource-manager--create-project&start_index=1#step_index=1)\n\n The remaining steps appear in the Google Cloud console.\n2. On the **Select organization** drop-down list at the top of the page, select the organization resource in which you want to create a project. If you are a free trial user, skip this step, as this list does not appear.\n3. Click **Create Project**.\n4. In the **New Project** window that appears, enter a project name and select a billing account as applicable. A project name can contain only letters, numbers, single quotes, hyphens, spaces, or exclamation points, and must be between 4 and 30 characters.\n5. Enter the parent organization or folder resource in the **Location** box. That resource will be the hierarchical parent of the new project. If **No organization** is an option, you can select it to create your new project as the top level of its own resource hierarchy.\n6. When you're finished entering new project details, click **Create**.\n\nAfter you create the Project, the **Owner** role is assigned to you.\nThis role includes all of the permissions you need for the following quickstart.\nFor more information about permissions, see\n[Granting, changing, and revoking access to resources](/iam/docs/granting-changing-revoking-access).\n\nCreate a Compute Engine disk\n----------------------------\n\nTo test the functionality of the resource locations constraint, set up\nCompute Engine regional persistent disks. When you create a regional\npersistent disk, you must specify the location where it will reside. For more\ninformation about creating Compute Engine regional persistent disks, see\n[Create and manage regional Persistent Disk volumes](/compute/docs/disks/regional-persistent-disk).\n\n1. In the Google Cloud console, go to the **Disks** page.\n\n [Go to Disks](https://console.cloud.google.com/compute/disks)\n2. Select the Project you created previously.\n\n 1. If you are prompted to link a billing account to your Project, do so now. For more information about enabling billing, see [Modify a Project's Billing Settings](/billing/docs/how-to/modify-project#enable_billing_for_a_project).\n3. Click **Create Disk**.\n\n4. Specify a **Name** for your disk.\n\n5. Select **Replicate this disk within region**.\n\n6. Under **Region** , select `europe-north1 (Finland)`.\n\n7. Under **Zones** , select `europe-north1-a` and `europe-north1-b`.\n\n8. Click **Create**.\n\nWhen the disk is successfully created, a green check mark appears next to the\nname.\n\nSet the organization policy\n---------------------------\n\nTo set an organization policy on the Project you created:\n\n1. In the Google Cloud console, go to the **Organization policies** page.\n\n [Go to Organization policies](https://console.cloud.google.com/iam-admin/orgpolicies)\n2. Click **Select**.\n\n3. Select the Project you created.\n\n4. Click **Google Cloud Platform - Define Resource Locations** , and then\n click **Edit**.\n\n5. Under **Applies to** , select **Customize**.\n\n6. Under **Policy values** , select **Custom**.\n\n7. Under **Policy type** , select **Allow**.\n\n8. In the **Policy value** box, enter `in:asia-locations`.\n\n9. Click **Save**. A notification appears to confirm the policy update.\n\n`asia-locations` is a [value group](/resource-manager/docs/organization-policy/defining-locations#value_groups) that is\ncurated by Google to include every location in a particular geographic region.\nIn this case, every region in Asia is defined as an allowed location for any\nresources created after this point. Note that the regional persistent disk you\ncreated above is not affected by this new policy, because the policy is not\nretroactive.\n\nTesting the organization policy\n-------------------------------\n\nNow that the organization policy is in effect, you cannot create resources in\nregions that were not specified as part of the organization policy. To test\nthis, try to create a regional persistent disk in an invalid location:\n\n1. In the Google Cloud console, go to the **Disks** page.\n\n [Go to Disks](https://console.cloud.google.com/compute/disks)\n2. Select the Project you created above.\n\n3. Click **Create Disk**.\n\n4. Specify a **Name** for your disk.\n\n5. Select **Replicate this disk within region**.\n\n6. Under **Region** , select `europe-north1 (Finland)`.\n\n7. Under **Zones** , select `europe-north1-a` and `europe-north1-b`.\n\n8. Click **Create**.\n\nA red exclamation point appears next to the name, and an error notification\ndisplays: \n\n```\nLocation ZONE:europe-north1-a violates constraint\nconstraints/gcp.resourceLocations on the resource RESOURCE_ID\n```\n\nWhere \u003cvar translate=\"no\"\u003eRESOURCE_ID\u003c/var\u003e is the full resource path of your Project and disk.\nThe disk is not created.\n\nCreate regional persistent disk in valid location\n-------------------------------------------------\n\nThe organization policy constraint blocks the creation of resources unless you\nspecify a valid location:\n\n1. In the Google Cloud console, go to the **Disks** page.\n\n [Go to Disks](https://console.cloud.google.com/compute/disks)\n2. Select the Project you created previously.\n\n3. Click **Create Disk**.\n\n4. Specify a **Name** for your disk.\n\n5. Select **Replicate this disk within region**.\n\n6. Under **Region** , select `asia-east2 (Hong Kong)`.\n\n7. Under **Zones** , select `asia-east2-a` and `asia-east2-b`.\n\n8. Click **Create**.\n\nThe resource is created successfully because all zones under `asia-east2` are\nwithin the `asia-locations` value group.\n\nClean up\n--------\n\n\nTo avoid incurring charges to your Google Cloud account for\nthe resources used on this page, follow these steps.\n\n### Delete regional persistent disks\n\nDelete the regional persistent disks you created for this quickstart:\n\n1. In the Google Cloud console, go to the **Disks** page.\n\n [Go to Disks](https://console.cloud.google.com/compute/disks)\n2. In the list that appears, select both of the disks that you created.\n\n3. To the right of the **Create Disk** button, click **Delete**.\n\n4. In the confirmation dialog that appears, click **Delete**.\n\nA notification dialog appears to confirm the disks were deleted.\n\n### Delete the Project\n\nDelete the Project you created for this quickstart:\n\n1. In the Google Cloud console, go to the **Manage resources** page.\n\n [Go to Manage resources](https://console.cloud.google.com/cloud-resource-manager)\n2. In the drop-down at the top of the page, select the Organization in which\n you created the quickstart Project.\n\n3. In the list of Project resources that appears, select the Project that you\n created, then click **Delete**.\n\n4. On the **Shut down project** dialog that appears, enter the Project ID,\n and then click **Shut down**.\n\nWhat's next\n-----------\n\n- Learn more about [creating and managing organization policies](/resource-manager/docs/organization-policy/creating-managing-policies).\n- Review the [services that support the resource locations constraint](/resource-manager/docs/organization-policy/defining-locations-supported-services)."]]