使用 IAM 控管存取權

您可以透過身分與存取權管理 (IAM) 角色控管錯誤報表資料的存取權,確保團隊成員擁有檢視、分類及管理應用程式錯誤所需的權限,同時強制執行最低權限原則。

IAM 角色和權限會決定您可透過Google Cloud 控制台和 Error Reporting API 存取哪些 Error Reporting 資源。您可以在 Google Cloud 專案、資料夾或機構層級授予這些角色,為主體提供資源階層中的適當存取權。

預先定義的角色

IAM 提供預先定義的角色,可授予特定 Google Cloud 資源 Google Cloud 的精細存取權。Google 會建立及維護這些角色,並視需要自動更新角色權限,例如 Error Reporting 新增功能時。如需角色和權限的相關資訊,請參閱「IAM 角色和權限索引」。

下表列出 Error Reporting 角色、角色名稱、說明、所含權限,以及可設定角色的最低層級資源類型。您可以針對這個資源類型授予特定角色,或在大多數情況下,針對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 活動和必要權限的摘要:

    活動 所需權限
    具備 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 資源,但沒有必要的權限,請與資源的擁有者聯絡。

    自訂角色

    如要建立具有 Error Reporting 權限的自訂角色,請從「API 權限」中選擇權限,然後按照說明建立自訂角色

    角色變更延遲

    Error Reporting 會快取 IAM 權限五分鐘,因此角色變更最多可能需要五分鐘才會生效。