使用 IAM 控管存取權

本頁說明如何使用身分與存取權管理 (IAM) 角色和權限,控管 Google Cloud 資源中的錯誤回報資料存取權。

總覽

IAM 權限角色可決定您是否能透過 Error Reporting API 和Google Cloud 主控台存取資料。

如要在 Google Cloud 資源 (例如 Google Cloud 專案、資料夾或機構) 中使用錯誤回報功能,您必須獲得該資源的 IAM 角色。這個角色必須包含適當的權限。

角色是一組權限。您無法直接授予主體權限,而是授予角色。將角色授予主體後,就會授予該角色具備的所有權限。您可以為相同的主體授予多個角色。

預先定義的角色

IAM 提供預先定義的角色,可針對特定 Google Cloud 資源提供精細的存取權。 Google Cloud 會建立及維護這些角色,並視需要自動更新權限,例如當「錯誤回報」新增新功能時。

下表列出錯誤回報角色、角色名稱、說明、包含的權限,以及可設定角色的最低層級資源類型。您可以為此資源類型授予特定角色,在大多數情況下,也可以為Google Cloud 階層中位於該類型之上的任何類型授予角色。

如要取得角色包含的個別權限清單,請參閱「取得角色中繼資料」一節。

Role Permissions

(roles/errorreporting.admin)

Provides full access to Error Reporting data.

Lowest-level resources where you can grant this role:

  • Project

cloudnotifications.activities.list

errorreporting.*

  • errorreporting.applications.list
  • errorreporting.errorEvents.create
  • errorreporting.errorEvents.delete
  • errorreporting.errorEvents.list
  • errorreporting.groupMetadata.get
  • errorreporting.groupMetadata.update
  • errorreporting.groups.list

logging.notificationRules.*

  • logging.notificationRules.create
  • logging.notificationRules.delete
  • logging.notificationRules.get
  • logging.notificationRules.list
  • logging.notificationRules.update

resourcemanager.projects.get

resourcemanager.projects.list

stackdriver.projects.get

(roles/errorreporting.user)

Provides the permissions to read and write Error Reporting data, except for sending new error events.

Lowest-level resources where you can grant this role:

  • Project

cloudnotifications.activities.list

errorreporting.applications.list

errorreporting.errorEvents.delete

errorreporting.errorEvents.list

errorreporting.groupMetadata.*

  • errorreporting.groupMetadata.get
  • errorreporting.groupMetadata.update

errorreporting.groups.list

logging.notificationRules.*

  • logging.notificationRules.create
  • logging.notificationRules.delete
  • logging.notificationRules.get
  • logging.notificationRules.list
  • logging.notificationRules.update

resourcemanager.projects.get

resourcemanager.projects.list

stackdriver.projects.get

(roles/errorreporting.viewer)

Provides read-only access to Error Reporting data.

Lowest-level resources where you can grant this role:

  • Project

cloudnotifications.activities.list

errorreporting.applications.list

errorreporting.errorEvents.list

errorreporting.groupMetadata.get

errorreporting.groups.list

logging.notificationRules.get

logging.notificationRules.list

resourcemanager.projects.get

resourcemanager.projects.list

stackdriver.projects.get

(roles/errorreporting.writer)

Provides the permissions to send error events to Error Reporting.

Lowest-level resources where you can grant this role:

  • Service Account

errorreporting.errorEvents.create

API 權限

Error Reporting API 方法需要特定的 IAM 權限。下表列出 API 方法所需的權限,並加以說明。

方法 所需權限 說明
deleteEvents errorreporting.errorEvents.delete 刪除錯誤事件。
events.list errorreporting.errorEvents.list 列出錯誤事件。
events.report errorreporting.errorEvents.create 建立或更新錯誤事件。
groupStats.list errorreporting.groups.list 清單 ErrorGroupStats
groups.get errorreporting.groupMetadata.get 擷取錯誤群組資訊。
groups.update
  • errorreporting.groupMetadata.update
  • errorreporting.applications.list
  • 更新錯誤群組資訊並將其設為靜音。
    變更錯誤解決狀態。
  • 專案的服務和版本清單。
  • 其他考量

    決定要為主體的用途套用哪些權限和角色時,請參考下列摘要,瞭解錯誤回報活動和必要權限:

    活動 所需權限
    具備 Error Reporting Google Cloud 控制台頁面的唯讀存取權。 errorreporting.applications.list
    errorreporting.groupMetadata.get
    errorreporting.groups.list
    在 Google Cloud 控制台中查看群組詳細資料。 唯讀權限加上:
    errorreporting.errorEvents.list
    在 Google Cloud 控制台中變更中繼資料。變更錯誤解決狀態,包括略過錯誤。 唯讀權限加上:
    errorreporting.groupMetadata.update
    在 Google Cloud 控制台中刪除錯誤。 唯讀權限加上:
    errorreporting.errorEvents.delete
    建立錯誤 (不需要 Google Cloud 控制台權限)。 errorreporting.errorEvents.create
    訂閱通知。 唯讀權限加上:
    cloudnotifications.activities.list

    授予及管理角色

    您可以使用Google Cloud 主控台、IAM API 方法或 Google Cloud CLI 來授予及管理 IAM 角色。如需授予及管理角色的操作說明,請參閱「授予、變更及撤銷存取權」。

    您可以將多個角色授予同一使用者。如要取得角色包含權限的清單,請參閱「取得角色中繼資料」一節。

    如果您嘗試存取 Google Cloud 資源,但缺少必要的權限,請與該資源的擁有者聯絡。

    自訂角色

    如要建立具有「錯誤回報」權限的自訂角色,請從「API 權限」中選擇權限,然後按照建立自訂角色的操作說明操作。

    角色變更延遲

    錯誤回報快取 IAM 權限的時間是 5 分鐘,因此,角色變更約需 5 分鐘才會生效。