このページの一部またはすべての情報は、S3NS の Trusted Cloud に適用されない場合があります。
Resource Manager を使用して組織のポリシーを適用する
始める前に
-
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.
[IAM] に移動
-
組織を選択します。
- [person_add アクセスを許可] をクリックします。
-
[新しいプリンシパル] フィールドに、ユーザー ID を入力します。
これは通常、Workforce Identity プール内のユーザーの ID です。詳細については、IAM ポリシーで Workforce プールユーザーを表すをご覧いただくか、管理者にお問い合わせください。
- [ロールを選択] リストでロールを選択します。
-
追加のロールを付与するには、add [別のロールを追加] をクリックして各ロールを追加します。
-
[保存] をクリックします。
新規プロジェクトの作成
プロジェクト リソースを作成する方法は次のとおりです。
新しいプロジェクトを作成するには、次の手順を行います。
-
Google Cloud コンソールの [リソースの管理] ページに移動します。
[リソースの管理] に移動
残りの手順は、Google Cloud コンソールに表示されます。
-
ページの上部にある [組織の選択] プルダウン リストで、プロジェクトを作成する組織リソースを選択します。無料トライアルをご使用の場合はこのリストが表示されないため、この手順はスキップしてください。
- [プロジェクトを作成] をクリックします。
-
表示される [新しいプロジェクト] ウィンドウで、プロジェクト名を入力し、該当する請求先アカウントを選択します。プロジェクト名には文字、数字、単一引用符、ハイフン、スペース、感嘆符のみを使用でき、4~30 文字にする必要があります。
-
[場所] ボックスに親組織またはフォルダ リソースを入力します。このリソースが新しいプロジェクトの階層上の親になります。[組織なし] を選択した場合は、そのプロジェクトを選択して、独自のリソース階層の最上位として新しいプロジェクトを作成できます。
- 新しいプロジェクトの詳細を入力し終えたら、[作成] をクリックします。
プロジェクトを作成すると、オーナーの役割が割り当てられます。
この役割には、次のクイックスタートに必要なすべての権限が含まれています。権限の詳細については、リソースへのアクセスの付与、変更、取り消しをご覧ください。
Compute Engine ディスクの作成
リソース ロケーションの制約の機能をテストするには、Compute Engine のリージョン永続ディスクを設定します。リージョン永続ディスクを作成する場合は、永続ディスクを配置するロケーションを指定する必要があります。Compute Engine リージョン Persistent Disk の作成の詳細については、リージョン Persistent Disk ボリュームを作成して管理するをご覧ください。
Google Cloud Console で、[ディスク] ページに移動します。
[ディスク] に移動
以前に作成したプロジェクトを選択します。
- 請求先アカウントをプロジェクトにリンクするよう求められたら、すぐにリンクします。課金の有効化の詳細については、プロジェクトの課金の設定変更をご覧ください。
[ディスクを作成] をクリックします。
[名前] でディスクの名前を指定します。
[リージョン内でこのディスクを複製] を選択します。
[リージョン] の下で europe-north1 (Finland)
を選択します。
[ゾーン] の下で europe-north1-a
と europe-north1-b
を選択します。
[作成] をクリックします。
ディスクが正常に作成されると、名前の横に緑色のチェックマークが表示されます。
組織のポリシーの設定
作成したプロジェクトに組織のポリシーを設定するには:
Google Cloud コンソールで、[組織のポリシー] ページに移動します。
[組織のポリシー] に移動
[選択] をクリックします。
作成したプロジェクトを選択します。
[Google Cloud Platform] - [Define Resource Locations] をクリックし、[編集] をクリックします。
[対象] で、[カスタマイズ] を選択します。
[ポリシーの値] で [カスタム] を選択します。
[ポリシーの種類] で [許可] を選択します。
[ポリシーの値] ボックスに in:asia-locations
を入力します。
[保存] をクリックします。ポリシーの更新を確認する通知が表示されます。
asia-locations
は、特定の地理的リージョンのすべてのロケーションが含まれるように、Google によってキュレートされた値グループの 1 つです。この例では、アジアのすべてのリージョンが、その後に作成されるすべてのリソースに関して許可されたロケーションとして定義されます。上記のポリシーは遡って適用されないため、上記で作成したリージョン永続ディスクはこのポリシーによる影響を受けません。
組織のポリシーのテスト
組織のポリシーが有効であるため、組織のポリシーの一部として指定されていないリージョンにはリソースを作成できません。これをテストするために、無効なロケーションにリージョン永続ディスクを作成してみます。
Google Cloud Console で、[ディスク] ページに移動します。
[ディスク] に移動
上記で作成したプロジェクトを選択します。
[ディスクを作成] をクリックします。
[名前] でディスクの名前を指定します。
[リージョン内でこのディスクを複製] を選択します。
[リージョン] の下で europe-north1 (Finland)
を選択します。
[ゾーン] の下で europe-north1-a
と europe-north1-b
を選択します。
[作成] をクリックします。
名前の横に赤い感嘆符が表示され、エラーの通知が表示されます。
Location ZONE:europe-north1-a violates constraint
constraints/gcp.resourceLocations on the resource RESOURCE_ID
ここで、RESOURCE_ID はプロジェクトとディスクの完全なリソースパスです。ディスクは作成されません。
有効なロケーションでのリージョン永続ディスクの作成
有効なロケーションを指定しない限り、組織のポリシーの制約によりリソースの作成がブロックされます。
Google Cloud Console で、[ディスク] ページに移動します。
[ディスク] に移動
以前に作成したプロジェクトを選択します。
[ディスクを作成] をクリックします。
[名前] でディスクの名前を指定します。
[リージョン内でこのディスクを複製] を選択します。
[リージョン] の下で asia-east2 (Hong Kong)
を選択します。
[ゾーン] の下で asia-east2-a
と asia-east2-b
を選択します。
[作成] をクリックします。
asia-east2
の下にあるすべてのゾーンが asia-locations
値グループ内にあるため、リソースは正常に作成されます。
クリーンアップ
このページで使用したリソースについて、Google Cloud アカウントに課金されないようにするには、次の手順を行います。
リージョン永続ディスクの削除
このクイックスタート用に作成したリージョン永続ディスクを削除します。
Google Cloud Console で、[ディスク] ページに移動します。
[ディスク] に移動
表示されるリストで、作成したディスクを両方とも選択します。
[ディスクの作成] ボタンの右側にある [削除] をクリックします。
表示される確認ダイアログで、[削除] をクリックします。
ディスクが削除されたことを通知するダイアログが表示されます。
プロジェクトの削除
このクイックスタート用に作成したプロジェクトを削除します。
Google Cloud コンソールで、[リソースの管理] ページに移動します。
[リソースの管理] に移動
ページの上部にあるプルダウンで、クイックスタート プロジェクトを作成した組織を選択します。
表示されるプロジェクト リソースのリストで、作成したプロジェクトを選択し、[削除] をクリックします。
プロジェクトのシャットダウン] ダイアログが表示されたら、プロジェクト ID を入力して、[シャットダウン] をクリックします。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-17 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-08-17 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)."]]