作为 Privileged Access Manager 设置管理员,您可以为审批工作流和通知偏好设置配置一些其他设置。
除非您在子资源级别明确替换设置,否则在组织或文件夹级别配置的设置会自动应用于其子资源。
您可以启用服务账号作为符合条件的审批人。借助此设置,管理员在创建或修改使用权时,便可添加服务账号和工作负载身份池中的身份作为审批者。
您可以自定义各种 Privileged Access Manager 事件的资源级通知偏好设置,方法是选择性地停用特定事件和特定角色的通知,或停用所有通知。
准备工作
如需获得配置 Privileged Access Manager 设置所需的权限,请让您的管理员为您授予以下 IAM 角色:
-
为项目、文件夹或组织配置设置:
组织的 PAM Settings Admin (
roles/privilegedaccessmanager.settingsAdmin
) -
查看项目、文件夹或组织的设置:
项目、文件夹或组织的 PAM Settings Viewer (
roles/privilegedaccessmanager.settingsViewer
)
这些预定义角色包含配置 Privileged Access Manager 设置所需的权限。如需查看所需的确切权限,请展开所需权限部分:
所需权限
如需配置 Privileged Access Manager 设置,您需要具备以下权限:
- 配置设置:
privilegedaccessmanager.settings.update
- 查看设置:
-
privilegedaccessmanager.settings.get
-
privilegedaccessmanager.settings.fetchEffective
-
启用服务账号作为审批人
控制台
前往 Privileged Access Manager 页面。
选择组织、文件夹或项目。
点击设置标签。 在设置来源部分中,系统默认选择继承自父级。
如需在子资源上覆盖从父资源继承的设置,请在作为审批者的服务账号部分中选择覆盖继承。
如需启用“将服务账号设为审批人”设置,请开启将服务账号设为审批人切换开关,然后点击保存。
gcloud
gcloud alpha pam settings update
命令用于配置额外的 Privileged Access Manager。
在使用下面的命令数据之前,请先进行以下替换:
RESOURCE_TYPE
:可选。要为其更新设置的资源类型。使用值organization
、folder
或project
。RESOURCE_ID
:与RESOURCE_TYPE
一起使用。您要为其管理使用权的 Google Cloud项目、文件夹或组织的 ID。项目 ID 是字母数字字符串,例如my-project
。 文件夹和组织 ID 是数字,例如123456789012
。SA_AS_APPROVER
:serviceAccountApproverSettings
字段中的一个布尔值,用于指示是否允许服务账号批准授权。默认值为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_ID
、folders/FOLDER_ID
或projects/PROJECT_ID
。项目 ID 是字母数字字符串,例如my-project
。文件夹和组织 ID 是数字,例如123456789012
。UPDATED_FIELDS
:需要更新的设置字段的英文逗号分隔列表。例如emailNotificationSettings,serviceAccountApproverSettings
。如需更新所有可修改的字段,请将更新掩码设置为
*
。SA_AS_APPROVER
:serviceAccountApproverSettings
字段中的一个布尔值,用于指示是否允许服务账号批准授权。默认值为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
自定义通知偏好设置
控制台
前往 Privileged Access Manager 页面。
选择组织、文件夹或项目。
点击设置标签。
在通知部分中,系统默认选择从父级继承。
下表显示了默认通知偏好设置:
事件 管理员 请求者 审批人 使用权已分配 - ✓ - 授权需要获得批准 - - ✓ 已激活授权 ✓ ✓ - 已拒绝授权 - ✓ - 授权已过期 - ✓ - 授权已终止 ✓ ✓ - 已撤销授权 - ✓ - 授权已在外部修改 ✓ ✓ - 授权激活失败 ✓ ✓ - 如需替换从父级继承的设置,请开启针对以下事件发送通知开关。
如需针对所需的 PAM 事件和角色停用通知,请取消选中相应的复选框,然后点击保存。
如需停用所有通知,请清除针对以下事件发送通知,然后点击保存。
gcloud
gcloud alpha pam settings update
命令用于配置额外的 Privileged Access Manager。
在使用下面的命令数据之前,请先进行以下替换:
RESOURCE_TYPE
:可选。要为其更新设置的资源类型。使用值organization
、folder
或project
。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_ID
、folders/FOLDER_ID
或projects/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