查看和导出 Privileged Access Manager 设置

作为 Privileged Access Manager 设置查看者,您可以查看组织、文件夹或项目的 Privileged Access Manager 设置。您还可以使用 Google Cloud CLI 以编程方式导出设置。

准备工作

如需获得查看 Privileged Access Manager 设置所需的权限,请让管理员向您授予组织、文件夹或项目的以下 IAM 角色:

如需详细了解如何授予角色,请参阅管理对项目、文件夹和组织的访问权限

这些预定义角色包含查看 Privileged Access Manager 设置所需的权限。如需查看所需的确切权限,请展开所需权限部分:

所需权限

您需要具备以下权限才能查看 Privileged Access Manager 设置:

  • 查看设置:
    • privilegedaccessmanager.settings.get
    • privilegedaccessmanager.settings.fetchEffective

您也可以使用自定义角色或其他预定义角色来获取这些权限。

查看设置

控制台

  1. 前往 Privileged Access Manager 页面。

    前往 Privileged Access Manager

  2. 选择您要查看 Privileged Access Manager 设置的组织、文件夹或项目。

  3. 点击设置标签。

设置页面会显示所选资源的 Privileged Access Manager 设置详细信息。

gcloud

您可以查看资源的以下设置:

  • 直接在资源上设置的单个设置
  • 资源上设置或从其父资源继承的有效设置

    查看资源的各个设置

    gcloud alpha pam settings describe 命令用于查看 Privileged Access Manager 设置。

    在使用下面的命令数据之前,请先进行以下替换:

    • RESOURCE_TYPE:可选。您要检索设置的资源类型。使用值 organizationfolderproject
    • 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:可选。您要检索设置的资源类型。使用值 organizationfolderproject
    • 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_IDfolders/FOLDER_IDprojects/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_IDfolders/FOLDER_IDprojects/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:可选。相应资源所属的资源类型。使用值 organizationfolderproject
  • 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.

后续步骤