查看及匯出 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.

後續步驟