設定 Privileged Access Manager 設定

身為 Privileged Access Manager 設定管理員,您可以為核准工作流程和通知偏好設定,設定一些額外設定。

您在機構或資料夾層級設定的項目,會自動套用至子項資源,除非您在子項資源層級明確覆寫設定。

您可以啟用服務帳戶做為合格的核准者。管理員建立或修改授權時,可透過這項設定新增服務帳戶和工作負載身分集區中的身分做為核准者。

您可以選擇停用特定事件和特定身分的使用者通知,或停用所有通知,自訂各種 Privileged Access Manager 事件的資源層級通知偏好設定。

事前準備

如要取得設定 Privileged Access Manager 設定所需的權限,請要求管理員授予下列 IAM 角色:

  • 為專案、資料夾或機構設定: 機構的 PAM 設定管理員 (roles/privilegedaccessmanager.settingsAdmin)
  • 查看專案、資料夾或機構的設定: 專案、資料夾或機構的「PAM 設定檢視者」 (roles/privilegedaccessmanager.settingsViewer)

這些預先定義的角色具備設定 Privileged Access Manager 設定所需的權限。如要查看確切的必要權限,請展開「必要權限」部分:

所需權限

如要設定 Privileged Access Manager,您必須具備下列權限:

  • 設定: privilegedaccessmanager.settings.update
  • 查看設定:
    • privilegedaccessmanager.settings.get
    • privilegedaccessmanager.settings.fetchEffective

啟用服務帳戶做為核准者

控制台

  1. 前往「Privileged Access Manager」頁面。

    前往 Privileged Access Manager

  2. 選取機構、資料夾或專案。

  3. 按一下「設定」分頁標籤。 在「設定來源」部分,系統預設會選取「沿用上層設定」

  4. 如要覆寫子項資源從父項資源繼承的設定,請在「服務帳戶做為核准者」專區中,選取「覆寫繼承」

  5. 如要啟用服務帳戶做為核准者設定,請開啟「啟用服務帳戶做為核准者」切換鈕,然後按一下「儲存」

gcloud

The gcloud alpha pam settings update command configures additional Privileged Access Manager.

使用下列任何指令資料之前,請先替換以下項目:

  • RESOURCE_TYPE:選用。要更新設定的資源類型。請使用 organizationfolderproject 值。
  • RESOURCE_ID:與 RESOURCE_TYPE搭配使用。要管理權限的 Google Cloud專案、資料夾或機構 ID。專案 ID 為英數字串,例如 my-project。 資料夾和機構 ID 為數字,例如 123456789012
  • SA_AS_APPROVERserviceAccountApproverSettings 欄位中的布林值,表示服務帳戶是否可核准授權。預設值為 false
    • 如果您指定 serviceAccountApproverSettings 欄位的值,系統會將該設定套用至資源。
    • 如果您指定 serviceAccountApproverSettings 欄位,但將其留空,系統就會將預設設定套用至資源。
    • 如果完全未指定 serviceAccountApproverSettings 欄位,資源就會沿用父項資源的設定。

    如果停用這項設定,系統就不會核准需要服務帳戶核准的授權。如果授權只有服務帳戶做為核准者,這些授權就不會生效。

  • request.json:包含修改後設定的檔案。如要建立這個檔案,請取得現有設定,將回應儲存至名為 request.json 的檔案,然後修改該檔案,做為更新要求的主體。您必須在主體中加入 ETAG,才能更新最新版本的設定。

將下列內容儲存到名為 filename.yaml 的檔案:

emailNotificationSettings:
  customNotificationBehavior:
    adminNotifications:
      grantActivated: NOTIFICATION_MODE_1
      grantActivationFailed: DISABLED
      grantEnded: ENABLED
      grantExternallyModified: ENABLED
    approverNotifications:
      pendingApproval: NOTIFICATION_MODE_2
    requesterNotifications:
      entitlementAssigned: ENABLED
      grantActivated: ENABLED
      grantExpired: NOTIFICATION_MODE_3
      grantRevoked: ENABLED
etag:'"ZjlkNWZlMWUtNDlhYS00YjJjAYlzNWYtZWFkNGVjOWU3NWMkBwYRsottW5Md"'
name: RESOURCE_TYPE/RESOURCE_ID/locations/global/settings
serviceAccountApproverSettings:
  enabled: SA_AS_APPROVER

執行下列指令:

Linux、macOS 或 Cloud Shell

gcloud alpha pam settings update \
    --location=global \
    --RESOURCE_TYPE=RESOURCE_ID \
    --settings-file FILENAME.yaml

Windows (PowerShell)

gcloud alpha pam settings update `
    --location=global `
    --RESOURCE_TYPE=RESOURCE_ID `
    --settings-file FILENAME.yaml

Windows (cmd.exe)

gcloud alpha pam settings update ^
    --location=global ^
    --RESOURCE_TYPE=RESOURCE_ID ^
    --settings-file FILENAME.yaml

您應該會收到類似以下的回應:

Parsed [location] resource: RESOURCE_TYPE/RESOURCE_ID/locations/global
Request issued for: [global]
Updated location [global].
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: "ZjlkNWZlMWUtNDlhYS00YjJjAYlzNWYtZWFkNGVjOWU3NWMkBwYRsottW5Md1"
name: RESOURCE_TYPE/RESOURCE_ID/locations/global/settings
serviceAccountApproverSettings:
  enabled: true
updateTime: '2025-05-18T10:10:40.101010101Z'

REST

Privileged Access Manager API 的 updateSettings 方法會設定額外的 Privileged Access Manager。

使用任何要求資料之前,請先替換以下項目:

  • SCOPE:您要更新設定的機構、資料夾或專案,格式為 organizations/ORGANIZATION_IDfolders/FOLDER_IDprojects/PROJECT_ID。專案 ID 為英數字串,例如 my-project。資料夾和機構 ID 都是數字,例如 123456789012
  • UPDATED_FIELDS:以半形逗號分隔的欄位清單,列出需要更新的設定。例如:emailNotificationSettings,serviceAccountApproverSettings

    如要更新所有可修改的欄位,請將更新遮罩設為 *

  • SA_AS_APPROVERserviceAccountApproverSettings 欄位中的布林值,表示服務帳戶是否可核准授權。預設值為 false
    • 如果您指定 serviceAccountApproverSettings 欄位的值,系統會將該設定套用至資源。
    • 如果您指定 serviceAccountApproverSettings 欄位,但將其留空,系統就會將預設設定套用至資源。
    • 如果完全未指定 serviceAccountApproverSettings 欄位,資源就會沿用父項資源的設定。

    如果停用這項設定,系統就不會核准需要服務帳戶核准的授權。如果授權只有服務帳戶做為核准者,這些授權將無效。

  • request.json:包含修改後設定的檔案。如要建立這個檔案,請取得現有設定,將回應儲存至名為 request.json 的檔案,然後修改該檔案,做為更新要求的主體。您必須在主體中加入 ETAG,才能更新最新版本的設定。

HTTP 方法和網址:

PATCH https://privilegedaccessmanager.googleapis.com/v1beta/SCOPE/locations/global/settings?updateMask=UPDATED_FIELDS

JSON 要求主體:

{
  "emailNotificationSettings": {
    "customNotificationBehavior": {
      "adminNotifications": {
        "grantActivated": "NOTIFICATION_MODE_1",
        "grantActivationFailed": "DISABLED",
        "grantEnded": "ENABLED",
        "grantExternallyModified": "ENABLED"
      },
      "approverNotifications": {
        "pendingApproval": "NOTIFICATION_MODE_2"
      },
      "requesterNotifications": {
        "entitlementAssigned": "ENABLED",
        "grantActivated": "ENABLED",
        "grantExpired": "NOTIFICATION_MODE_3",
        "grantRevoked": "ENABLED"
      }
    }
  },
  "etag": "\"ZjlkNWZlMWUtNDlhYS00YjJjAYlzNWYtZWFkNGVjOWU3NWMkBwYRsottW5Md\"",
  "name": "SCOPE/locations/global/settings",
  "serviceAccountApproverSettings": {
    "enabled": SA_AS_APPROVER
  }
}

如要傳送要求,請展開以下其中一個選項:

您應該會收到如下的 JSON 回應:


{
  "name": "SCOPE/locations/global/operations/OPERATION_ID",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.privilegedaccessmanager.v1beta.OperationMetadata",
    "createTime": "2024-03-25T01:55:02.544562950Z",
    "target": "SCOPE/locations/global/settings",
    "verb": "update",
    "requestedCancellation": false,
    "apiVersion": "v1beta"
  },
  "done": false
}


如要查看更新作業的進度,請將 GET 要求傳送至下列端點:

https://privilegedaccessmanager.googleapis.com/v1beta/SCOPE/locations/global/operations/OPERATION_ID

傳送 GET 要求至下列端點,列出所有作業:

https://privilegedaccessmanager.googleapis.com/v1beta/SCOPE/locations/global/operations

自訂通知偏好設定

控制台

  1. 前往「Privileged Access Manager」頁面。

    前往 Privileged Access Manager

  2. 選取機構、資料夾或專案。

  3. 按一下 [設定] 標籤。

  4. 在「通知」部分中,系統預設會選取「從父項繼承」

    下表顯示預設通知偏好設定:

    事件 管理員 要求者 核准者
    已指派授權 - ✓ -
    授予權限需要核准 - - ✓
    已啟用補助金 ✓ ✓ -
    授予項目遭拒 - ✓ -
    補助金已過期 - ✓ -
    授予項目已結束 ✓ ✓ -
    授予項目已撤銷 - ✓ -
    授予項目已從外部修改 ✓ ✓ -
    授予項目啟用失敗 ✓ ✓ -
  5. 如要覆寫上層的設定沿用,請開啟「針對下列事件傳送通知」切換按鈕。

  6. 如要停用必要 PAM 事件和角色的通知,請取消勾選對應的核取方塊,然後按一下「儲存」

  7. 如要停用所有通知,請清除「針對下列事件傳送通知」,然後按一下「儲存」

gcloud

The gcloud alpha pam settings update command configures additional Privileged Access Manager.

使用下列任何指令資料之前,請先替換以下項目:

  • RESOURCE_TYPE:選用。要更新設定的資源類型。請使用 organizationfolderproject 值。
  • RESOURCE_ID:與 RESOURCE_TYPE搭配使用。要管理權限的 Google Cloud專案、資料夾或機構 ID。專案 ID 為英數字串,例如 my-project。 資料夾和機構 ID 為數字,例如 123456789012
  • NOTIFICATION_MODE: 在「emailNotificationSettings」欄位中,使用 ENABLED 傳送活動的通知電子郵件,或使用 DISABLED 停止傳送。
    • 如果您指定 emailNotificationSettings 欄位的值,系統會將該設定套用至資源。
    • 如果您指定 emailNotificationSettings 欄位,但將其留空,系統就會將預設設定套用至資源。
    • 如果完全未指定 emailNotificationSettings 欄位,資源就會沿用父項資源的設定。
  • request.json:包含修改後設定的檔案。如要建立這個檔案,請取得現有設定,將回應儲存至名為 request.json 的檔案,然後修改該檔案,做為更新要求的主體。您必須在主體中加入 ETAG,才能更新最新版本的設定。

將下列內容儲存到名為 filename.yaml 的檔案:

emailNotificationSettings:
  customNotificationBehavior:
    adminNotifications:
      grantActivated: NOTIFICATION_MODE_1
      grantActivationFailed: DISABLED
      grantEnded: ENABLED
      grantExternallyModified: ENABLED
    approverNotifications:
      pendingApproval: NOTIFICATION_MODE_2
    requesterNotifications:
      entitlementAssigned: ENABLED
      grantActivated: ENABLED
      grantExpired: NOTIFICATION_MODE_3
      grantRevoked: ENABLED
etag:'"ZjlkNWZlMWUtNDlhYS00YjJjAYlzNWYtZWFkNGVjOWU3NWMkBwYRsottW5Md"'
name: RESOURCE_TYPE/RESOURCE_ID/locations/global/settings
serviceAccountApproverSettings:
  enabled: SA_AS_APPROVER

執行下列指令:

Linux、macOS 或 Cloud Shell

gcloud alpha pam settings update \
    --location=global \
    --RESOURCE_TYPE=RESOURCE_ID \
    --settings-file FILENAME.yaml

Windows (PowerShell)

gcloud alpha pam settings update `
    --location=global `
    --RESOURCE_TYPE=RESOURCE_ID `
    --settings-file FILENAME.yaml

Windows (cmd.exe)

gcloud alpha pam settings update ^
    --location=global ^
    --RESOURCE_TYPE=RESOURCE_ID ^
    --settings-file FILENAME.yaml

您應該會收到類似以下的回應:

Parsed [location] resource: RESOURCE_TYPE/RESOURCE_ID/locations/global
Request issued for: [global]
Updated location [global].
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: "ZjlkNWZlMWUtNDlhYS00YjJjAYlzNWYtZWFkNGVjOWU3NWMkBwYRsottW5Md1"
name: RESOURCE_TYPE/RESOURCE_ID/locations/global/settings
serviceAccountApproverSettings:
  enabled: true
updateTime: '2025-05-18T10:10:40.101010101Z'

REST

Privileged Access Manager API 的 updateSettings 方法會設定額外的 Privileged Access Manager。

使用任何要求資料之前,請先替換以下項目:

  • SCOPE:您要更新設定的機構、資料夾或專案,格式為 organizations/ORGANIZATION_IDfolders/FOLDER_IDprojects/PROJECT_ID。專案 ID 為英數字串,例如 my-project。資料夾和機構 ID 都是數字,例如 123456789012
  • UPDATED_FIELDS:以半形逗號分隔的欄位清單,列出需要更新的設定。例如:emailNotificationSettings,serviceAccountApproverSettings

    如要更新所有可修改的欄位,請將更新遮罩設為 *

  • NOTIFICATION_MODE: 在「emailNotificationSettings」欄位中,使用 ENABLED 傳送活動通知電子郵件,或使用 DISABLED 停止傳送。
    • 如果您指定 emailNotificationSettings 欄位的值,系統會將該設定套用至資源。
    • 如果您指定 emailNotificationSettings 欄位,但將其留空,系統就會將預設設定套用至資源。
    • 如果完全未指定 emailNotificationSettings 欄位,資源就會沿用父項資源的設定。
  • request.json:包含修改後設定的檔案。如要建立這個檔案,請取得現有設定,將回應儲存至名為 request.json 的檔案,然後修改該檔案,做為更新要求的主體。您必須在主體中加入 ETAG,才能更新最新版本的設定。

HTTP 方法和網址:

PATCH https://privilegedaccessmanager.googleapis.com/v1beta/SCOPE/locations/global/settings?updateMask=UPDATED_FIELDS

JSON 要求主體:

{
  "emailNotificationSettings": {
    "customNotificationBehavior": {
      "adminNotifications": {
        "grantActivated": "NOTIFICATION_MODE_1",
        "grantActivationFailed": "DISABLED",
        "grantEnded": "ENABLED",
        "grantExternallyModified": "ENABLED"
      },
      "approverNotifications": {
        "pendingApproval": "NOTIFICATION_MODE_2"
      },
      "requesterNotifications": {
        "entitlementAssigned": "ENABLED",
        "grantActivated": "ENABLED",
        "grantExpired": "NOTIFICATION_MODE_3",
        "grantRevoked": "ENABLED"
      }
    }
  },
  "etag": "\"ZjlkNWZlMWUtNDlhYS00YjJjAYlzNWYtZWFkNGVjOWU3NWMkBwYRsottW5Md\"",
  "name": "SCOPE/locations/global/settings",
  "serviceAccountApproverSettings": {
    "enabled": SA_AS_APPROVER
  }
}

如要傳送要求,請展開以下其中一個選項:

您應該會收到如下的 JSON 回應:


{
  "name": "SCOPE/locations/global/operations/OPERATION_ID",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.privilegedaccessmanager.v1beta.OperationMetadata",
    "createTime": "2024-03-25T01:55:02.544562950Z",
    "target": "SCOPE/locations/global/settings",
    "verb": "update",
    "requestedCancellation": false,
    "apiVersion": "v1beta"
  },
  "done": false
}


如要查看更新作業的進度,請將 GET 要求傳送至下列端點:

https://privilegedaccessmanager.googleapis.com/v1beta/SCOPE/locations/global/operations/OPERATION_ID

傳送 GET 要求至下列端點,列出所有作業:

https://privilegedaccessmanager.googleapis.com/v1beta/SCOPE/locations/global/operations

後續步驟