作为 Privileged Access Manager 设置查看者,您可以查看组织、文件夹或项目的 Privileged Access Manager 设置。您还可以使用 Google Cloud CLI 以编程方式导出设置。
准备工作
如需获得查看 Privileged Access Manager 设置所需的权限,请让管理员向您授予组织、文件夹或项目的以下 IAM 角色:
-
查看设置:
PAM Settings Viewer (
roles/privilegedaccessmanager.settingsViewer
)
如需详细了解如何授予角色,请参阅管理对项目、文件夹和组织的访问权限。
这些预定义角色包含查看 Privileged Access Manager 设置所需的权限。如需查看所需的确切权限,请展开所需权限部分:
所需权限
您需要具备以下权限才能查看 Privileged Access Manager 设置:
-
查看设置:
-
privilegedaccessmanager.settings.get
-
privilegedaccessmanager.settings.fetchEffective
-
查看设置
控制台
前往 Privileged Access Manager 页面。
选择您要查看 Privileged Access Manager 设置的组织、文件夹或项目。
点击设置标签。
设置页面会显示所选资源的 Privileged Access Manager 设置详细信息。
gcloud
您可以查看资源的以下设置:
- 直接在资源上设置的单个设置。
资源上设置或从其父资源继承的有效设置。
查看资源的各个设置
gcloud alpha pam settings describe
命令用于查看 Privileged Access Manager 设置。在使用下面的命令数据之前,请先进行以下替换:
RESOURCE_TYPE
:可选。您要检索设置的资源类型。使用值organization
、folder
或project
。RESOURCE_ID
:与RESOURCE_TYPE
一起使用。您要为其管理使用权的 Google Cloud项目、文件夹或组织的 ID。项目 ID 是字母数字字符串,例如my-project
。 文件夹和组织 ID 是数字,例如123456789012
。
执行以下命令:
Linux、macOS 或 Cloud Shell
gcloud alpha pam settings describe \ --location=global \ -- RESOURCE_TYPE=RESOURCE_ID \
Windows (PowerShell)
gcloud alpha pam settings describe ` --location=global ` -- RESOURCE_TYPE=RESOURCE_ID `
Windows (cmd.exe)
gcloud alpha pam settings describe ^ --location=global ^ -- RESOURCE_TYPE=RESOURCE_ID ^
您应该会收到类似如下所示的响应:
createTime: '2025-05-18T10:10:10.101010101Z' emailNotificationSettings: customNotificationBehavior: adminNotifications: grantActivated: ENABLED grantActivationFailed: DISABLED grantEnded: ENABLED grantExternallyModified: ENABLED approverNotifications: pendingApproval: ENABLED requesterNotifications: entitlementAssigned: ENABLED grantActivated: ENABLED grantExpired: ENABLED grantRevoked: ENABLED etag: "ZjlkNWZlMWUtNDlhYS00YjJjAYlzNWYtZWFkNGVjOWU3NWMkBwYRsottW5Md" name: RESOURCE_TYPE/RESOURCE_ID/locations/global/settings serviceAccountApproverSettings: enabled: true updateTime: '2025-05-18T10:10:10.101010101Z'
查看资源的有效设置
gcloud alpha pam settings describe-effective
命令用于查看 Privileged Access Manager 设置。在使用下面的命令数据之前,请先进行以下替换:
RESOURCE_TYPE
:可选。您要检索设置的资源类型。使用值organization
、folder
或project
。RESOURCE_ID
:与RESOURCE_TYPE
一起使用。您要为其管理使用权的 Google Cloud项目、文件夹或组织的 ID。项目 ID 是字母数字字符串,例如my-project
。 文件夹和组织 ID 是数字,例如123456789012
。
执行以下命令:
Linux、macOS 或 Cloud Shell
gcloud alpha pam settings describe-effective \ --location=global \ --RESOURCE_TYPE=RESOURCE_ID \
Windows (PowerShell)
gcloud alpha pam settings describe-effective ` --location=global ` --RESOURCE_TYPE=RESOURCE_ID `
Windows (cmd.exe)
gcloud alpha pam settings describe-effective ^ --location=global ^ --RESOURCE_TYPE=RESOURCE_ID ^
您应该会收到类似如下所示的响应:
emailNotificationSettings: customNotificationBehavior: adminNotifications: notifyGrantActivated: true notifyGrantActivationFailed: true notifyGrantEnded: true notifyGrantExternallyModified: true approverNotifications: notifyPendingApproval: true requesterNotifications: notifyEntitlementAssigned: true notifyEntitlementUpdated: true notifyGrantActivated: true notifyGrantActivationFailed: true notifyGrantEnded: true notifyGrantExpired: true notifyGrantExternallyModified: true notifyGrantRevoked: true parent: RESOURCE_TYPE/RESOURCE_ID/locations/global serviceAccountApproverSettings: {}
REST
您可以查看资源的以下设置:
- 直接在资源上设置的单个设置。
资源上设置或从其父资源继承的有效设置。
查看资源的各个设置
Privileged Access Manager API 的
getSettings
方法用于查看 Privileged Access Manager 设置。在使用任何请求数据之前,请先进行以下替换:
SCOPE
:要检索其设置的组织、文件夹或项目,格式为organizations/ORGANIZATION_ID
、folders/FOLDER_ID
或projects/PROJECT_ID
。项目 ID 是字母数字字符串,例如my-project
。文件夹和组织 ID 是数字,例如123456789012
。
HTTP 方法和网址:
GET https://privilegedaccessmanager.googleapis.com/v1beta/SCOPE/locations/global/settings
如需发送您的请求,请展开以下选项之一:
您应该收到类似以下内容的 JSON 响应:
{ "createTime": "2025-05-18T10:10:10.101010101Z", "emailNotificationSettings": { "customNotificationBehavior": { "adminNotifications": { "grantActivated": "ENABLED", "grantActivationFailed": "DISABLED", "grantEnded": "ENABLED", "grantExternallyModified": "ENABLED" }, "approverNotifications": { "pendingApproval": "ENABLED" }, "requesterNotifications": { "entitlementAssigned": "ENABLED", "grantActivated": "ENABLED", "grantExpired": "ENABLED", "grantRevoked": "ENABLED" } } }, "etag": "\"ZjlkNWZlMWUtNDlhYS00YjJjAYlzNWYtZWFkNGVjOWU3NWMkBwYRsottW5Md\"", "name": "SCOPE/locations/global/settings", "serviceAccountApproverSettings": { "enabled": true }, "updateTime": "2025-05-18T10:10:10.101010101Z" }
查看资源的有效设置
Privileged Access Manager API 的
fetchEffectiveSettings
方法用于查看 Privileged Access Manager 设置。在使用任何请求数据之前,请先进行以下替换:
SCOPE
:要检索其设置的组织、文件夹或项目,格式为organizations/ORGANIZATION_ID
、folders/FOLDER_ID
或projects/PROJECT_ID
。项目 ID 是字母数字字符串,例如my-project
。文件夹和组织 ID 是数字,例如123456789012
。
HTTP 方法和网址:
GET https://privilegedaccessmanager.googleapis.com/v1beta/SCOPE/locations/global:effectiveSettings
如需发送您的请求,请展开以下选项之一:
您应该收到类似以下内容的 JSON 响应:
{ "emailNotificationSettings": { "customNotificationBehavior": { "adminNotifications": { "notifyGrantActivated": "true", "notifyGrantActivationFailed": "true", "notifyGrantEnded": "true", "notifyGrantExternallyModified": "true" }, "approverNotifications": { "notifyPendingApproval": "true" }, "requesterNotifications": { "notifyEntitlementAssigned": "true", "notifyEntitlementUpdated": "true", "notifyGrantActivated": "true", "notifyGrantActivationFailed": "true", "notifyGrantEnded": "true", "notifyGrantExpired": "true", "notifyGrantExternallyModified": "true", "notifyGrantRevoked": "true" } } }, "parent": "SCOPE/locations/global", "serviceAccountApproverSettings": {} }
使用 gcloud CLI 以编程方式导出设置
gcloud alpha pam settings export
命令可检索并导出特定资源的设置。
在使用下面的命令数据之前,请先进行以下替换:
FILENAME
:要将设置内容导出到的文件名。RESOURCE_TYPE
:可选。相应资源所属的资源类型。使用值organization
、folder
或project
。RESOURCE_ID
:与RESOURCE_TYPE
一起使用。您要为其管理使用权的 Google Cloud项目、文件夹或组织的 ID。项目 ID 是字母数字字符串,例如my-project
。文件夹和组织 ID 是数字,例如123456789012
。
执行以下命令:
Linux、macOS 或 Cloud Shell
gcloud alpha pam settings export \ --destination=FILENAME.yaml \ --location=global \ -- RESOURCE_TYPE=RESOURCE_ID
Windows (PowerShell)
gcloud alpha pam settings export ` --destination=FILENAME.yaml ` --location=global ` -- RESOURCE_TYPE=RESOURCE_ID
Windows (cmd.exe)
gcloud alpha pam settings export ^ --destination=FILENAME.yaml ^ --location=global ^ -- RESOURCE_TYPE=RESOURCE_ID
您应该会收到类似如下所示的响应:
Exported [RESOURCE_TYPE/RESOURCE_ID/locations/global/settings] to FILENAME.yaml.