您可以透過統一存取政策 (UAP),授予及拒絕主體對Google Cloud 資源的存取權。本文說明如何查看 UAP 和繫結。
事前準備
設定驗證方法。
請根據您打算如何使用本頁範例,選取對應的分頁標籤:
控制台
使用 Google Cloud 控制台存取 Google Cloud 服務和 API 時,不需要設定驗證機制。
gcloud
在 Google Cloud 控制台啟用 Cloud Shell。
Google Cloud 控制台底部會開啟 Cloud Shell 工作階段,並顯示指令列提示。Cloud Shell 是已安裝 Google Cloud CLI 的殼層環境,並已設定適用於您目前專案的值。工作階段可能要幾秒鐘的時間才能初始化。
REST
如要在本機開發環境中使用本頁的 REST API 範例,請使用您提供給 gcloud CLI 的憑證。
安裝 Google Cloud CLI。
若您採用的是外部識別資訊提供者 (IdP),請先使用聯合身分登入 gcloud CLI。
詳情請參閱 Google Cloud 驗證說明文件中的「使用 REST 進行驗證」一節。
選用:閱讀 UAP 總覽。
查看統一存取政策所需的角色
如要取得查看 UAP 所需的權限,請要求管理員在擁有您要查看的 UAP 的專案、資料夾或組織中,授予您存取權政策檢視者 (roles/iam.accessPolicyViewer) IAM 角色。如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和組織的存取權」。
這個預先定義的角色具備查看 UAP 所需的權限。如要查看確切的必要權限,請展開「Required permissions」(必要權限) 部分:
所需權限
必須具備下列權限,才能查看 UAP:
-
iam.accesspolicies.get -
iam.accessPolicies.list
查看統一存取政策繫結所需的角色
如要取得查看繫結所需的權限,請要求管理員在繫結的上層資源中,授予您下列 IAM 角色:
-
查看專案中的繫結:專案 IAM 管理員 (
roles/resourcemanager.projectIamAdmin) -
查看資料夾中的繫結:資料夾 IAM 管理員 (
roles/resourcemanager.folderIamAdmin) -
查看組織中的繫結:組織管理員 (
roles/resourcemanager.organizationAdmin)
如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和組織的存取權」。
這些預先定義的角色具備查看繫結所需的權限。如要查看確切的必要權限,請展開「Required permissions」(必要權限) 部分:
所需權限
必須具備下列權限,才能查看繫結:
-
查看單一繫結:
iam.policybindings.get -
列出專案、資料夾或組織的上層繫結:
iam.policybindings.list
查看統一存取政策所有繫結所需的角色
如要取得查看 UAP 所有繫結所需的權限,請要求管理員針對擁有 UAP 的資源,授予您存取權政策檢視者 (roles/iam.accessPolicyViewer) IAM 角色。如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和組織的存取權」。
這個預先定義的角色具備 iam.accesspolicies.searchPolicyBindings 權限,可查看 UAP 的所有繫結。
可查看資源所有繫結的角色
如要取得所需權限,查看包含特定目標資源的所有繫結,請要求管理員授予可列出該資源繫結的角色。這個角色必須包含 SERVICE.RESOURCE.searchPolicyBindings 權限,其中 RESOURCE 是目標資源類型,SERVICE 是擁有資源的服務。
如要找出具備必要權限的角色,請在角色和權限參考資料中搜尋該權限,然後按一下權限名稱,查看具備該權限的角色。
您必須具備目標資源或其上層資源的這個角色。
如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和組織的存取權」。
列出專案、資料夾或組織中的統一存取政策
您可以使用 Google Cloud 控制台、gcloud CLI 或 IAM REST API,列出特定專案、資料夾或組織下的所有 UAP。
控制台
-
在 Google Cloud 控制台中,前往「統一存取政策」 頁面。
前往「Unified Access Policies」(統一存取政策) 頁面 - 選取要查看的 UAP 所屬的專案、資料夾或組織。
Google Cloud 控制台會顯示由所選資源上層或繫結至所選資源的 UAP。
gcloud
gcloud iam access-policies list 指令會列出特定資源的所有子項 UAP。
使用下列任何指令資料前,請先替換以下項目:
-
UAP_PARENT_RESOURCE_TYPE:Resource Manager 資源 (專案、資料夾或組織) 的類型,該資源擁有您要列出的 UAP。請使用project、folder或organization值。 -
UAP_PARENT_RESOURCE_ID:專案、資料夾或組織的 ID,擁有您要列出的 UAP。專案 ID 是英數字串,例如my-project。資料夾和組織 ID 則為數字,例如123456789012。 FORMAT:回覆格式。使用json或yaml。
執行下列指令:
Linux、macOS 或 Cloud Shell
gcloud iam access-policies list --UAP_PARENT_RESOURCE_TYPE=UAP_PARENT_RESOURCE_ID \ --location=global --format=FORMAT
Windows (PowerShell)
gcloud iam access-policies list --UAP_PARENT_RESOURCE_TYPE=UAP_PARENT_RESOURCE_ID ` --location=global --format=FORMAT
Windows (cmd.exe)
gcloud iam access-policies list --UAP_PARENT_RESOURCE_TYPE=UAP_PARENT_RESOURCE_ID ^ --location=global --format=FORMAT
回應包含要求中資源的子項 UAP。
{
"accessPolicies": [
{
"createTime": "2026-08-31T21:43:39.822441Z",
"details": {
"rules": [
{
"conditions": {
"iam.googleapis.com": {
"expression": "resource.matchTag('environment', 'prod')"
}
},
"description": "Grant non-delete compute permissions to compute admins in prod",
"effect": "ALLOW",
"excludedPrincipals": [
"principal://goog/subject/access-restricted@example.com"
],
"operation": {
"excludedPermissions": [
"*/*.delete"
],
"permissions": [
"role:roles/compute.admin"
]
},
"principals": [
"principalSet://goog/group/compute-admins@example.com"
]
}
]
},
"displayName": "Example policy 1",
"etag": "W/\"YZtdQgtulCVzvTwlBTFjPQ==\"",
"name": "projects/0123456789012/locations/global/accessPolicies/example-policy",
"uid": "puid_0123456789012345678",
"updateTime": "2026-08-31T21:43:39.822441Z"
},
{
"createTime": "2026-05-29T23:25:01.606730Z",
"details": {
"rules": [
{
"description": "Deny group from publishing to message buses",
"effect": "DENY",
"operation": {
"permissions": [
"eventarc.googleapis.com/messageBuses.publish"
]
},
"principals": [
"principalSet://goog/group/example-group@example.com"
]
}
]
},
"displayName": "Example policy 2",
"etag": "d6BJBTsk2+oDCygmr5ANxA==",
"name": "organizations/123456789012/locations/global/accessPolicies/example-policy-2",
"uid": "puid_13064942519001808897",
"updateTime": "2026-05-29T23:25:01.606730Z"
}
]
}
REST
accessPolicies.list 方法會列出特定資源的所有子項 UAP。
使用任何要求資料之前,請先修改下列項目的值:
-
UAP_PARENT_RESOURCE_TYPE:Resource Manager 資源 (專案、資料夾或組織) 的類型,該資源擁有您要列出的 UAP。請使用projects、folders或organizations值。 -
UAP_PARENT_RESOURCE_ID:專案、資料夾或組織的 ID,擁有您要列出的 UAP。專案 ID 是英數字串,例如my-project。資料夾和組織 ID 則為數字,例如123456789012。
HTTP 方法和網址:
GET https://iam.googleapis.com/v3/UAP_PARENT_RESOURCE_TYPE/UAP_PARENT_RESOURCE_ID/locations/global/accessPolicies
請展開以下其中一個選項,以傳送要求:
回應包含要求中資源的子項 UAP。
{
"accessPolicies": [
{
"name": "projects/0123456789012/locations/global/accessPolicies/example-policy",
"uid": "puid_0123456789012345678",
"etag": "W/\"YZtdQgtulCVzvTwlBTFjPQ==\"",
"displayName": "Example policy",
"createTime": "2026-08-31T21:43:39.822441Z",
"updateTime": "2026-08-31T21:43:39.822441Z",
"details": {
"rules": [
{
"principals": [
"principalSet://goog/group/compute-admins@example.com"
],
"excludedPrincipals": [
"principal://goog/subject/access-restricted@example.com"
],
"operation": {
"permissions": [
"role:roles/compute.admin"
],
"excludedPermissions": [
"*/*.delete"
]
},
"conditions": {
"iam.googleapis.com": {
"expression": "resource.matchTag('environment', 'prod')"
}
},
"description": "Grant non-delete compute permissions to compute admins in prod",
"effect": "ALLOW"
}
]
}
},
{
"name": "organizations/123456789012/locations/global/accessPolicies/example-policy-2",
"uid": "puid_13064942519001808897",
"etag": "d6BJBTsk2+oDCygmr5ANxA==",
"displayName": "Example policy 2",
"createTime": "2026-05-29T23:25:01.606730Z",
"updateTime": "2026-05-29T23:25:01.606730Z",
"details": {
"rules": [
{
"description": "Deny group from publishing to message buses",
"principals": [
"principalSet://goog/group/example-group@example.com"
],
"operation": {
"permissions": [
"eventarc.googleapis.com/messageBuses.publish"
]
},
"effect": "DENY"
}
]
}
}
]
}
取得單一統一存取政策
您可以使用Google Cloud 控制台、gcloud CLI 或 IAM REST API,取得單一 UAP 的詳細資料。
控制台
-
在 Google Cloud 控制台中,前往「統一存取政策」 頁面。
前往「Unified Access Policies」(統一存取政策) 頁面 - 選取要查看詳細資料的 UAP 所屬專案、資料夾或組織。
- 按一下要查看詳細資料的 UAP 政策 ID。
Google Cloud 控制台會顯示 UAP 的詳細資料,包括 ID、建立時間、上次更新時間和規則清單。
gcloud
gcloud iam access-policies describe 指令會取得單一 UAP。
使用下列任何指令資料前,請先替換以下項目:
-
UAP_ID:要取得的 UAP ID,例如example-policy。 -
UAP_PARENT_RESOURCE_TYPE:Resource Manager 資源 (專案、資料夾或組織) 的類型,該資源擁有您要取得的 UAP。請使用project、folder或organization值 -
UAP_PARENT_RESOURCE_ID:專案、資料夾或組織的 ID,該專案、資料夾或組織擁有您要取得的 UAP。專案 ID 是英數字串,例如my-project。資料夾和組織 ID 則為數字,例如123456789012。 FORMAT:回覆格式。使用json或yaml。
執行下列指令:
Linux、macOS 或 Cloud Shell
gcloud iam access-policies describe UAP_ID \ --UAP_PARENT_RESOURCE_TYPE=UAP_PARENT_RESOURCE_ID \ --location=global --format=FORMAT
Windows (PowerShell)
gcloud iam access-policies describe UAP_ID ` --UAP_PARENT_RESOURCE_TYPE=UAP_PARENT_RESOURCE_ID ` --location=global --format=FORMAT
Windows (cmd.exe)
gcloud iam access-policies describe UAP_ID ^ --UAP_PARENT_RESOURCE_TYPE=UAP_PARENT_RESOURCE_ID ^ --location=global --format=FORMAT
回應包含請求中指定的 UAP。
{
"createTime": "2026-08-31T21:43:39.822441Z",
"details": {
"rules": [
{
"conditions": {
"iam.googleapis.com": {
"expression": "resource.matchTag('environment', 'prod')"
}
},
"description": "Grant non-delete compute permissions to compute admins in prod",
"effect": "ALLOW",
"excludedPrincipals": [
"principal://goog/subject/access-restricted@example.com"
],
"operation": {
"excludedPermissions": [
"*/*.delete"
],
"permissions": [
"role:roles/compute.admin"
]
},
"principals": [
"principalSet://goog/group/compute-admins@example.com"
]
}
]
},
"displayName": "Example policy",
"etag": "W/\"YZtdQgtulCVzvTwlBTFjPQ==\"",
"name": "projects/0123456789012/locations/global/accessPolicies/example-policy",
"uid": "puid_0123456789012345678",
"updateTime": "2026-08-31T21:43:39.822441Z"
}
REST
accessPolicies.get 方法會取得單一 UAP。
使用任何要求資料之前,請先修改下列項目的值:
-
UAP_PARENT_RESOURCE_TYPE:Resource Manager 資源 (專案、資料夾或組織) 的類型,該資源擁有您要取得的 UAP。請使用projects、folders或organizations值 -
UAP_PARENT_RESOURCE_ID:專案、資料夾或組織的 ID,該專案、資料夾或組織擁有您要取得的 UAP。專案 ID 是英數字串,例如my-project。資料夾和組織 ID 則為數字,例如123456789012。 -
UAP_ID:要取得的 UAP ID,例如example-policy。
HTTP 方法和網址:
GET https://iam.googleapis.com/v3/UAP_PARENT_RESOURCE_TYPE/UAP_PARENT_RESOURCE_ID/locations/global/accessPolicies/UAP_ID
請展開以下其中一個選項,以傳送要求:
回應包含請求中指定的 UAP。
{
"name": "projects/0123456789012/locations/global/accessPolicies/example-policy",
"uid": "puid_0123456789012345678",
"etag": "W/\"YZtdQgtulCVzvTwlBTFjPQ==\"",
"displayName": "Example policy",
"createTime": "2026-08-31T21:43:39.822441Z",
"updateTime": "2026-08-31T21:43:39.822441Z",
"details": {
"rules": [
{
"principals": [
"principalSet://goog/group/compute-admins@example.com"
],
"excludedPrincipals": [
"principal://goog/subject/access-restricted@example.com"
],
"operation": {
"permissions": [
"role:roles/compute.admin"
],
"excludedPermissions": [
"*/*.delete"
]
},
"conditions": {
"iam.googleapis.com": {
"expression": "resource.matchTag('environment', 'prod')"
}
},
"description": "Grant non-delete compute permissions to compute admins in prod",
"effect": "ALLOW"
}
]
}
}
列出統一存取政策的繫結
您可以透過多種方式列出 UAP 的繫結:
- 列出 UAP 的繫結:查看包含特定 UAP 的所有繫結。
- 列出資源的繫結:查看包含特定目標資源的所有繫結。
- 列出專案、資料夾或組織中的所有繫結:查看特定專案、資料夾或組織中的所有繫結。
列出統一存取政策的繫結
如要查看包含特定 UAP 的所有繫結,請搜尋該 UAP 的繫結。
您可以使用Google Cloud 控制台、gcloud CLI 或 IAM REST API,查看 UAP 的所有繫結。
控制台
-
在 Google Cloud 控制台中,前往「統一存取政策」 頁面。
前往「Unified Access Policies」(統一存取政策) 頁面 - 選取要查看 UAP 繫結的專案、資料夾或組織。
- 按一下要查看繫結的 UAP 政策 ID。
- 選取「繫結」分頁標籤。
Google Cloud 控制台會顯示 UAP 的繫結清單,以及各項繫結的顯示名稱和目標資源。
gcloud
gcloud iam access-policies search-policy-bindings 指令會列出指定 UAP 的所有繫結。
使用下列任何指令資料前,請先替換以下項目:
-
UAP_ID:要列出繫結的 UAP ID,例如example-policy。 -
UAP_PARENT_RESOURCE_TYPE:Resource Manager 資源 (專案、資料夾或組織) 的類型,該資源擁有您要列出繫結的 UAP。請使用project、folder或organization值。 -
UAP_PARENT_RESOURCE_ID:專案、資料夾或組織的 ID,該專案、資料夾或組織擁有您要列出繫結的 UAP。專案 ID 是英數字串,例如my-project。資料夾和組織 ID 則為數字,例如123456789012。 FORMAT:回覆格式。使用json或yaml。
執行下列指令:
Linux、macOS 或 Cloud Shell
gcloud iam access-policies search-policy-bindings UAP_ID \ --UAP_PARENT_RESOURCE_TYPE=UAP_PARENT_RESOURCE_ID \ --location=global --format=FORMAT
Windows (PowerShell)
gcloud iam access-policies search-policy-bindings UAP_ID ` --UAP_PARENT_RESOURCE_TYPE=UAP_PARENT_RESOURCE_ID ` --location=global --format=FORMAT
Windows (cmd.exe)
gcloud iam access-policies search-policy-bindings UAP_ID ^ --UAP_PARENT_RESOURCE_TYPE=UAP_PARENT_RESOURCE_ID ^ --location=global --format=FORMAT
回應包含指定 UAP 的繫結。
{
"policyBindings": [
{
"createTime": "2026-05-06T18:08:24.729843Z",
"displayName": "Example binding 1",
"etag": "W/\"xkdnPfTxoxyVqOwhQSJbMg==\"",
"name": "organizations/123456789012/locations/global/policyBindings/example-binding1",
"policy": "organizations/123456789012/locations/global/accessPolicies/example-policy",
"policyKind": "ACCESS",
"policyUid": "puid_9519202237377675265",
"target": {
"resource": "//cloudresourcemanager.googleapis.com/organizations/123456789012"
},
"uid": "buid_9904260005517852673",
"updateTime": "2026-05-06T18:08:24.729843Z"
},
{
"createTime": "2026-05-07T07:05:06.203861Z",
"displayName": "Example binding 2",
"etag": "W/\"cRMdDXbT82aLuZlvoL9Gqg==\"",
"name": "organizations/123456789012/locations/global/policyBindings/example-binding2",
"policy": "organizations/123456789012/locations/global/accessPolicies/example-policy",
"policyKind": "ACCESS",
"policyUid": "puid_9519202237377675265",
"target": {
"resource": "//cloudresourcemanager.googleapis.com/projects/example-project"
},
"uid": "buid_4331055466646863873",
"updateTime": "2026-05-07T07:05:06.203861Z"
}
]
}
REST
accessPolicies.searchPolicyBindings 方法會列出指定 UAP 的所有繫結。
使用任何要求資料之前,請先修改下列項目的值:
-
UAP_PARENT_RESOURCE_TYPE:Resource Manager 資源 (專案、資料夾或組織) 的類型,該資源擁有您要列出繫結的 UAP。請使用projects、folders或organizations值。 -
UAP_PARENT_RESOURCE_ID:專案、資料夾或組織的 ID,該專案、資料夾或組織擁有您要列出繫結的 UAP。專案 ID 是英數字串,例如my-project。資料夾和組織 ID 則為數字,例如123456789012。 -
UAP_ID:要列出繫結的 UAP ID,例如example-policy。
HTTP 方法和網址:
GET https://iam.googleapis.com/v3/UAP_PARENT_RESOURCE_TYPE/UAP_PARENT_RESOURCE_ID/locations/global/accessPolicies/UAP_ID:searchPolicyBindings
請展開以下其中一個選項,以傳送要求:
回應包含指定 UAP 的繫結。
{
"policyBindings": [
{
"name": "organizations/123456789012/locations/global/policyBindings/example-binding1",
"uid": "buid_9904260005517852673",
"etag": "W/\"xkdnPfTxoxyVqOwhQSJbMg==\"",
"displayName": "Example binding 1",
"target": {
"resource": "//cloudresourcemanager.googleapis.com/organizations/123456789012"
},
"policyKind": "ACCESS",
"policy": "organizations/123456789012/locations/global/accessPolicies/example-policy",
"policyUid": "puid_9519202237377675265",
"createTime": "2026-05-06T18:08:24.729843Z",
"updateTime": "2026-05-06T18:08:24.729843Z"
},
{
"name": "organizations/123456789012/locations/global/policyBindings/example-binding2",
"uid": "buid_4331055466646863873",
"etag": "W/\"cRMdDXbT82aLuZlvoL9Gqg==\"",
"displayName": "Example binding 2",
"target": {
"resource": "//cloudresourcemanager.googleapis.com/projects/example-project"
},
"policyKind": "ACCESS",
"policy": "organizations/123456789012/locations/global/accessPolicies/example-policy",
"policyUid": "puid_9519202237377675265",
"createTime": "2026-05-07T07:05:06.203861Z",
"updateTime": "2026-05-07T07:05:06.203861Z"
}
]
}
列出資源的所有繫結
如要查看包含特定目標資源的所有繫結,請搜尋該資源的繫結。
每個繫結都包含繫結至資源的 UAP ID。如要查看政策詳細資料,請使用政策 ID 取得政策詳細資料。
您可以使用Google Cloud 控制台、gcloud CLI 或 IAM REST API,查看資源的所有繫結。
控制台
-
在 Google Cloud 控制台中,前往「統一存取政策」 頁面。
前往「Unified Access Policies」(統一存取政策) 頁面 - 選取要查看繫結的專案、資料夾或組織。
- 在「Filter」(篩選器) 欄位中,輸入篩選條件「Enforcement: Enforced」(強制執行:已強制執行)。
表格會顯示繫結至資源的所有 UAP。
gcloud
gcloud iam policy-bindings search-target-policy-bindings 指令會取得包含該資源的所有 UAP 繫結。
使用下列任何指令資料前,請先替換以下項目:
-
BINDING_PARENT_RESOURCE_TYPE:Resource Manager 資源類型 (專案、資料夾或組織),用於父項繫結目標資源。請使用project、folder或organization值。如要瞭解哪些資源是哪些繫結的父項,請參閱「支援的資源」。
-
BINDING_PARENT_RESOURCE_ID:目標資源繫結的父項專案、資料夾或組織 ID。專案 ID 是英數字串,例如my-project。資料夾和組織 ID 則為數字,例如123456789012。 -
TARGET_RESOURCE:要 列出繫結的資源。如需有效資源清單,請參閱「支援的資源」。 FORMAT:回覆格式。使用json或yaml。
執行下列指令:
Linux、macOS 或 Cloud Shell
gcloud iam policy-bindings search-target-policy-bindings \ --BINDING_PARENT_RESOURCE_TYPE=BINDING_PARENT_RESOURCE_ID \ --target=TARGET_RESOURCE \ --format=FORMAT
Windows (PowerShell)
gcloud iam policy-bindings search-target-policy-bindings ` --BINDING_PARENT_RESOURCE_TYPE=BINDING_PARENT_RESOURCE_ID ` --target=TARGET_RESOURCE ` --format=FORMAT
Windows (cmd.exe)
gcloud iam policy-bindings search-target-policy-bindings ^ --BINDING_PARENT_RESOURCE_TYPE=BINDING_PARENT_RESOURCE_ID ^ --target=TARGET_RESOURCE ^ --format=FORMAT
回應會包含所有 UAP 繫結,包括目標資源。
{
"policyBindings": [
{
"createTime": "2026-05-06T18:08:24.729843Z",
"displayName": "Example binding 1",
"etag": "W/\"xkdnPfTxoxyVqOwhQSJbMg==\"",
"name": "organizations/123456789012/locations/global/policyBindings/example-binding1",
"policy": "organizations/123456789012/locations/global/accessPolicies/example-uap-policy-1",
"policyKind": "ACCESS",
"policyUid": "puid_9519202237377675265",
"target": {
"resource": "//cloudresourcemanager.googleapis.com/organizations/123456789012"
},
"uid": "buid_9904260005517852673",
"updateTime": "2026-05-06T18:11:16.798841Z"
},
{
"createTime": "2026-05-06T18:08:24.729843Z",
"displayName": "Example binding 2",
"etag": "W/\"xkdnPfTxoxyVqOwhQSJbMg==\"",
"name": "organizations/123456789012/locations/global/policyBindings/example-binding2",
"policy": "organizations/123456789012/locations/global/accessPolicies/example-uap-policy-2",
"policyKind": "ACCESS",
"policyUid": "puid_10358560617928851457",
"target": {
"resource": "//cloudresourcemanager.googleapis.com/organizations/123456789012"
},
"uid": "buid_4331055466646863873",
"updateTime": "2026-05-06T18:11:16.798841Z"
}
]
}
REST
SearchTargetPolicyBindings.search 方法會取得包含該資源的所有 UAP 繫結。
使用任何要求資料之前,請先修改下列項目的值:
-
BINDING_PARENT_RESOURCE_TYPE:Resource Manager 資源類型 (專案、資料夾或組織),用於父項繫結目標資源。請使用projects、folders或organizations值。如要瞭解哪些資源是哪些繫結的父項,請參閱「支援的資源」。
-
BINDING_PARENT_RESOURCE_ID:目標資源繫結的父項專案、資料夾或組織 ID。專案 ID 是英數字串,例如my-project。資料夾和組織 ID 則為數字,例如123456789012。 -
TARGET_RESOURCE:要 列出繫結的資源。如需有效資源清單,請參閱「支援的資源」。
HTTP 方法和網址:
GET https://iam.googleapis.com/v3/BINDING_PARENT_RESOURCE_TYPE/BINDING_PARENT_RESOURCE_ID/locations/global/policyBindings:searchTargetPolicyBindings?target=TARGET_RESOURCE
請展開以下其中一個選項,以傳送要求:
回應會包含所有 UAP 繫結,包括目標資源。
{
"policyBindings": [
{
"name": "organizations/123456789012/locations/global/policyBindings/example-binding1",
"uid": "buid_9904260005517852673",
"etag": "W/\"xkdnPfTxoxyVqOwhQSJbMg==\"",
"displayName": "Example binding 1",
"target": {
"resource": "//cloudresourcemanager.googleapis.com/organizations/123456789012"
},
"policy": "organizations/123456789012/locations/global/accessPolicies/example-uap-policy-1",
"createTime": "2026-05-06T18:08:24.729843Z",
"updateTime": "2026-05-06T18:11:16.798841Z",
"policyKind": "ACCESS",
"policyUid": "puid_9519202237377675265"
},
{
"name": "organizations/123456789012/locations/global/policyBindings/example-binding2",
"uid": "buid_4331055466646863873",
"etag": "W/\"xkdnPfTxoxyVqOwhQSJbMg==\"",
"displayName": "Example binding 2",
"target": {
"resource": "//cloudresourcemanager.googleapis.com/organizations/123456789012"
},
"policy": "organizations/123456789012/locations/global/accessPolicies/example-uap-policy-2",
"createTime": "2026-05-06T18:08:24.729843Z",
"updateTime": "2026-05-06T18:11:16.798841Z",
"policyKind": "ACCESS",
"policyUid": "puid_10358560617928851457"
}
]
}
列出專案、資料夾或組織中的所有繫結
如果您使用 gcloud CLI 或 IAM REST API 查看繫結,也可以列出特定專案、資料夾或組織的所有子項繫結。
列出專案、資料夾或組織的繫結,與搜尋該資源的繫結類似。不過,與搜尋繫結不同的是,列出資源的繫結也會包含該資源的所有直接子項繫結。
舉例來說,假設您有一個繫結,會將政策附加至 Network Services API Agent Gateway。這個繫結的父項資源是 Agent Gateway 的父項專案。換句話說,繫結是專案的直接子項。因此,如果您列出該專案的繫結,回應就會包含 Agent Gateway 的繫結。不過,如果您列出專案上層組織的繫結,回應就不會包含該繫結。這是因為雖然繫結是組織的子系,但並非組織的直接子項。
繫結的父項資源取決於繫結中的目標資源。詳情請參閱「支援的資源」。
每個繫結都包含繫結至資源的 UAP ID。如要查看政策詳細資料,請使用政策 ID 取得政策詳細資料。
您可以使用 gcloud CLI 或 IAM REST API,查看專案、資料夾或組織的所有子繫結。
gcloud
gcloud iam policy-bindings list 指令會列出特定資源的所有子項 UAP 繫結。
使用下列任何指令資料前,請先替換以下項目:
-
BINDING_PARENT_RESOURCE_TYPE:繫結所屬 Resource Manager 資源 (專案、資料夾或組織) 的類型。請使用project、folder或organization值。繫結的父項資源取決於繫結中的目標資源。詳情請參閱「支援的資源」一文。
-
BINDING_PARENT_RESOURCE_ID:政策繫結所屬的專案、資料夾或組織 ID。專案 ID 是英數字串,例如my-project。資料夾和組織 ID 則為數字,例如123456789012。 FORMAT:回覆格式。使用json或yaml。
執行下列指令:
Linux、macOS 或 Cloud Shell
gcloud iam policy-bindings list --BINDING_PARENT_RESOURCE_TYPE=BINDING_PARENT_RESOURCE_ID \ --location=global \ --filter=policyKind:ACCESS \ --format=FORMAT
Windows (PowerShell)
gcloud iam policy-bindings list --BINDING_PARENT_RESOURCE_TYPE=BINDING_PARENT_RESOURCE_ID ` --location=global ` --filter=policyKind:ACCESS ` --format=FORMAT
Windows (cmd.exe)
gcloud iam policy-bindings list --BINDING_PARENT_RESOURCE_TYPE=BINDING_PARENT_RESOURCE_ID ^ --location=global ^ --filter=policyKind:ACCESS ^ --format=FORMAT
回覆包含 UAP 繫結,這些繫結是指令中資源的子項。
{
"policyBindings": [
{
"createTime": "2026-05-06T18:08:24.729843Z",
"displayName": "Example binding 1",
"etag": "W/\"xkdnPfTxoxyVqOwhQSJbMg==\"",
"name": "organizations/123456789012/locations/global/policyBindings/example-binding-1",
"policy": "organizations/123456789012/locations/global/accessPolicies/example-uap-1",
"policyKind": "ACCESS",
"policyUid": "puid_9519202237377675265",
"target": {
"resource": "//cloudresourcemanager.googleapis.com/organizations/123456789012"
},
"uid": "buid_9904260005517852673",
"updateTime": "2026-05-06T18:08:24.729843Z"
},
{
"createTime": "2026-05-07T07:05:06.203861Z",
"displayName": "Example binding 2",
"etag": "W/\"cRMdDXbT82aLuZlvoL9Gqg==\"",
"name": "organizations/123456789012/locations/global/policyBindings/example-binding-2",
"policy": "organizations/123456789012/locations/global/accessPolicies/example-uap-2",
"policyKind": "ACCESS",
"policyUid": "puid_1566408245394800641",
"target": {
"resource": "//cloudresourcemanager.googleapis.com/organizations/123456789012"
},
"uid": "buid_4331055466646863873",
"updateTime": "2026-05-07T07:05:06.203861Z"
}
]
}
REST
policyBindings.list 方法會列出特定資源的所有子項 UAP 繫結。
使用任何要求資料之前,請先修改下列項目的值:
-
BINDING_PARENT_RESOURCE_TYPE:繫結所屬 Resource Manager 資源 (專案、資料夾或組織) 的類型。請使用projects、folders或organizations值。繫結的父項資源取決於繫結中的目標資源。詳情請參閱「支援的資源」一文。
-
BINDING_PARENT_RESOURCE_ID:政策繫結所屬的專案、資料夾或組織 ID。專案 ID 是英數字串,例如my-project。資料夾和組織 ID 則為數字,例如123456789012。
HTTP 方法和網址:
GET https://iam.googleapis.com/v3/BINDING_PARENT_RESOURCE_TYPE/BINDING_PARENT_RESOURCE_ID/locations/global/policyBindings?filter=policyKind:ACCESS
請展開以下其中一個選項,以傳送要求:
回應包含 UAP 繫結,這些繫結是要求中資源的子項。
{
"policyBindings": [
{
"name": "organizations/123456789012/locations/global/policyBindings/example-binding-1",
"uid": "buid_9904260005517852673",
"etag": "W/\"xkdnPfTxoxyVqOwhQSJbMg==\"",
"displayName": "Example binding 1",
"target": {
"resource": "//cloudresourcemanager.googleapis.com/organizations/123456789012"
},
"policyKind": "ACCESS",
"policy": "organizations/123456789012/locations/global/accessPolicies/example-uap-1",
"policyUid": "puid_9519202237377675265",
"createTime": "2026-05-06T18:08:24.729843Z",
"updateTime": "2026-05-06T18:08:24.729843Z"
},
{
"name": "organizations/123456789012/locations/global/policyBindings/example-binding-2",
"uid": "buid_4331055466646863873",
"etag": "W/\"cRMdDXbT82aLuZlvoL9Gqg==\"",
"displayName": "Example binding 2",
"target": {
"resource": "//cloudresourcemanager.googleapis.com/organizations/123456789012"
},
"policyKind": "ACCESS",
"policy": "organizations/123456789012/locations/global/accessPolicies/example-uap-2",
"policyUid": "puid_1566408245394800641",
"createTime": "2026-05-07T07:05:06.203861Z",
"updateTime": "2026-05-07T07:05:06.203861Z"
}
]
}
取得統一存取政策的繫結
您可以使用 Google Cloud 控制台、gcloud CLI 或 IAM REST API 取得繫結詳細資料。
控制台
-
在 Google Cloud 控制台中,前往「統一存取政策」 頁面。
前往「Unified Access Policies」(統一存取政策) 頁面 - 選取要查看 UAP 繫結的專案、資料夾或組織。
- 按一下要查看繫結的 UAP 政策 ID。
- 選取「繫結」分頁標籤。
- 使用繫結 ID 或繫結名稱尋找繫結。
表格會顯示繫結詳細資料,包括繫結 ID、繫結名稱和繫結中的目標資源。
gcloud
gcloud iam policy-bindings describe 指令會取得繫結。
使用下列任何指令資料前,請先替換以下項目:
-
BINDING_ID:要取得的繫結 ID,例如example-binding。 -
BINDING_PARENT_RESOURCE_TYPE:繫結所屬 Resource Manager 資源 (專案、資料夾或組織) 的類型。請使用project、folder或organization值。繫結的父項資源取決於繫結中的目標資源。詳情請參閱「支援的資源」一文。
-
BINDING_PARENT_RESOURCE_ID:政策繫結所屬的專案、資料夾或組織 ID。專案 ID 是英數字串,例如my-project。資料夾和組織 ID 則為數字,例如123456789012。 FORMAT:回覆格式。使用json或yaml。
執行下列指令:
Linux、macOS 或 Cloud Shell
gcloud iam policy-bindings describe BINDING_ID \ --BINDING_PARENT_RESOURCE_TYPE=BINDING_PARENT_RESOURCE_ID \ --location=global --format=FORMAT
Windows (PowerShell)
gcloud iam policy-bindings describe BINDING_ID ` --BINDING_PARENT_RESOURCE_TYPE=BINDING_PARENT_RESOURCE_ID ` --location=global --format=FORMAT
Windows (cmd.exe)
gcloud iam policy-bindings describe BINDING_ID ^ --BINDING_PARENT_RESOURCE_TYPE=BINDING_PARENT_RESOURCE_ID ^ --location=global --format=FORMAT
回應中包含繫結。
{
"createTime": "2026-05-06T18:08:24.729843Z",
"displayName": "Example binding",
"etag": "W/\"xkdnPfTxoxyVqOwhQSJbMg==\"",
"name": "organizations/123456789012/locations/global/policyBindings/example-binding",
"policy": "organizations/123456789012/locations/global/accessPolicies/example-uap",
"policyKind": "ACCESS",
"policyUid": "puid_9519202237377675265",
"target": {
"resource": "//cloudresourcemanager.googleapis.com/organizations/123456789012"
},
"uid": "buid_9904260005517852673",
"updateTime": "2026-05-06T18:08:24.729843Z"
}
REST
policyBindings.get 方法會取得繫結。
使用任何要求資料之前,請先修改下列項目的值:
-
BINDING_PARENT_RESOURCE_TYPE:繫結所屬 Resource Manager 資源 (專案、資料夾或組織) 的類型。請使用projects、folders或organizations值。繫結的父項資源取決於繫結中的目標資源。詳情請參閱「支援的資源」一文。
-
BINDING_PARENT_RESOURCE_ID:政策繫結所屬的專案、資料夾或組織 ID。專案 ID 是英數字串,例如my-project。資料夾和組織 ID 則為數字,例如123456789012。 -
BINDING_ID:要取得的繫結 ID,例如example-binding。
HTTP 方法和網址:
GET https://iam.googleapis.com/v3/BINDING_PARENT_RESOURCE_TYPE/BINDING_PARENT_RESOURCE_ID/locations/global/policyBindings/BINDING_ID
請展開以下其中一個選項,以傳送要求:
回應中包含繫結。
{
"name": "organizations/123456789012/locations/global/policyBindings/example-binding",
"uid": "buid_9904260005517852673",
"etag": "W/\"xkdnPfTxoxyVqOwhQSJbMg==\"",
"displayName": "Example binding",
"target": {
"resource": "//cloudresourcemanager.googleapis.com/organizations/123456789012"
},
"policyKind": "ACCESS",
"policy": "organizations/123456789012/locations/global/accessPolicies/example-uap",
"policyUid": "puid_9519202237377675265",
"createTime": "2026-05-06T18:08:24.729843Z",
"updateTime": "2026-05-06T18:08:24.729843Z"
}