使用 IAM 进行访问权限控制

本页面介绍如何使用 Identity and Access Management 来控制对 AutoML Tables 资源(包括数据源和结果目标)的访问权限。

Identity and Access Management 概览

使用 AutoML Tables 时,您可以使用 Identity and Access Management (IAM) 来管理对您的资源的访问权限。IAM 允许您为特定 Google Cloud 资源指定更细化的访问权限,同时防止对其他资源的不必要访问。本页面介绍 AutoML Tables 的 IAM 权限和角色。如需详细了解 IAM,请参阅 IAM 文档

IAM 允许您采用最小权限安全原则,因此您只需授予对您的资源的必要访问权限即可。

通过 IAM,您可以向用户授予一个或多个角色,从而赋予该用户特定权限,以此控制谁(用户)哪些资源具有什么(角色)类型的访问权限。例如,您可以向用户授予 AutoML Viewer 角色 (roles.automl.viewer),以允许用户查看项目中的资源。如果该用户需要创建或更新资源,则您可以改为授予 AutoML Editor 角色 (roles.automl.editor)。

角色

AutoML Tables 使用 AutoML API,该 API 提供了一组预定义角色,可帮助您控制对 AutoML 资源的访问权限。

如果预定义角色未提供您所需的权限,您还可以创建自定义角色。

此外,舊的基本角色(Editor、Viewer 和 Owner)也可供您使用,但这些角色提供的控制不如 AutoML 角色那样精细。请尽量避免使用基本角色;它们提供对 Google Cloud 中资源的访问权限,而不仅仅提供对 AutoML 的访问权限。详细了解基本角色

预定义角色

本部分汇总了 AutoML 提供的预定义角色。

Role Permissions

(roles/automl.admin)

Full access to all AutoML resources

Lowest-level resources where you can grant this role:

  • Dataset
  • Model

automl.*

  • automl.annotationSpecs.create
  • automl.annotationSpecs.delete
  • automl.annotationSpecs.get
  • automl.annotationSpecs.list
  • automl.annotationSpecs.update
  • automl.annotations.approve
  • automl.annotations.create
  • automl.annotations.list
  • automl.annotations.manipulate
  • automl.annotations.reject
  • automl.columnSpecs.get
  • automl.columnSpecs.list
  • automl.columnSpecs.update
  • automl.datasets.create
  • automl.datasets.delete
  • automl.datasets.export
  • automl.datasets.get
  • automl.datasets.getIamPolicy
  • automl.datasets.import
  • automl.datasets.list
  • automl.datasets.setIamPolicy
  • automl.datasets.update
  • automl.examples.delete
  • automl.examples.get
  • automl.examples.list
  • automl.examples.update
  • automl.files.delete
  • automl.files.list
  • automl.humanAnnotationTasks.create
  • automl.humanAnnotationTasks.delete
  • automl.humanAnnotationTasks.get
  • automl.humanAnnotationTasks.list
  • automl.locations.get
  • automl.locations.getIamPolicy
  • automl.locations.list
  • automl.locations.setIamPolicy
  • automl.modelEvaluations.create
  • automl.modelEvaluations.get
  • automl.modelEvaluations.list
  • automl.models.create
  • automl.models.delete
  • automl.models.deploy
  • automl.models.export
  • automl.models.get
  • automl.models.getIamPolicy
  • automl.models.list
  • automl.models.predict
  • automl.models.setIamPolicy
  • automl.models.undeploy
  • automl.operations.cancel
  • automl.operations.delete
  • automl.operations.get
  • automl.operations.list
  • automl.tableSpecs.get
  • automl.tableSpecs.list
  • automl.tableSpecs.update

resourcemanager.projects.get

resourcemanager.projects.list

serviceusage.services.get

serviceusage.services.list

(roles/automl.editor)

Editor of all AutoML resources

Lowest-level resources where you can grant this role:

  • Dataset
  • Model

automl.annotationSpecs.*

  • automl.annotationSpecs.create
  • automl.annotationSpecs.delete
  • automl.annotationSpecs.get
  • automl.annotationSpecs.list
  • automl.annotationSpecs.update

automl.annotations.*

  • automl.annotations.approve
  • automl.annotations.create
  • automl.annotations.list
  • automl.annotations.manipulate
  • automl.annotations.reject

automl.columnSpecs.*

  • automl.columnSpecs.get
  • automl.columnSpecs.list
  • automl.columnSpecs.update

automl.datasets.create

automl.datasets.delete

automl.datasets.export

automl.datasets.get

automl.datasets.import

automl.datasets.list

automl.datasets.update

automl.examples.*

  • automl.examples.delete
  • automl.examples.get
  • automl.examples.list
  • automl.examples.update

automl.files.*

  • automl.files.delete
  • automl.files.list

automl.humanAnnotationTasks.*

  • automl.humanAnnotationTasks.create
  • automl.humanAnnotationTasks.delete
  • automl.humanAnnotationTasks.get
  • automl.humanAnnotationTasks.list

automl.locations.get

automl.locations.list

automl.modelEvaluations.*

  • automl.modelEvaluations.create
  • automl.modelEvaluations.get
  • automl.modelEvaluations.list

automl.models.create

automl.models.delete

automl.models.deploy

automl.models.export

automl.models.get

automl.models.list

automl.models.predict

automl.models.undeploy

automl.operations.*

  • automl.operations.cancel
  • automl.operations.delete
  • automl.operations.get
  • automl.operations.list

automl.tableSpecs.*

  • automl.tableSpecs.get
  • automl.tableSpecs.list
  • automl.tableSpecs.update

resourcemanager.projects.get

resourcemanager.projects.list

serviceusage.services.get

serviceusage.services.list

(roles/automl.predictor)

Predict using models

Lowest-level resources where you can grant this role:

  • Model

automl.models.predict

resourcemanager.projects.get

resourcemanager.projects.list

(roles/automl.viewer)

Viewer of all AutoML resources

Lowest-level resources where you can grant this role:

  • Dataset
  • Model

automl.annotationSpecs.get

automl.annotationSpecs.list

automl.annotations.list

automl.columnSpecs.get

automl.columnSpecs.list

automl.datasets.get

automl.datasets.list

automl.examples.get

automl.examples.list

automl.files.list

automl.humanAnnotationTasks.get

automl.humanAnnotationTasks.list

automl.locations.get

automl.locations.list

automl.modelEvaluations.get

automl.modelEvaluations.list

automl.models.get

automl.models.list

automl.operations.get

automl.operations.list

automl.tableSpecs.get

automl.tableSpecs.list

resourcemanager.projects.get

resourcemanager.projects.list

serviceusage.services.get

serviceusage.services.list

在主项目中授予 AutoML Tables 的权限

有时,您需要向 AutoML Tables 自动创建的服务账号授予其他角色。例如,当您使用由 Bigtable 数据源提供支持的 BigQuery 外部表时,您需要向自动创建的服务帐号授予额外的角色,以使其具有读取和写入 BigQuery 和 Bigtable 数据所需的权限。

如需在主项目中向自动创建的服务账号授予 AutoML Tables 的其他角色,请执行以下操作:

  1. 转到 Google Cloud 控制台中主项目的 IAM 页面。

    转到 IAM 页面

  2. 选中右上角的包括 Google 提供的角色授权复选框。

  3. 点击名为 AutoML Service Agent 的服务账号的铅笔图标。

  4. 向服务账号授予所需角色并保存所做的更改。

在其他项目中授予 AutoML Tables 的权限

当您在其他项目中使用数据源或目标时,您必须在该项目中授予 AutoML Tables 服务账号权限。当您启用 AutoML Tables API 时,系统会自动创建 AutoML Tables 服务账号。

如需在其他项目中添加 AutoML Tables 的权限,请执行以下操作:

  1. 转到 Google Cloud 控制台中您的主项目(您使用 AutoML Tables 的项目)的 IAM 页面。

    转到 IAM 页面

  2. 选中右上角的包括 Google 提供的角色授权复选框。

  3. 查找名为 AutoML Service Agent 的服务账号并复制其电子邮件地址(在主账号下方列出)。

  4. 将项目更改为需要授予权限的项目。

  5. 点击添加,并在新建主账号中输入电子邮件地址。

  6. 添加所有必需的角色,并点击保存

提供对 Google 表格的访问权限

如果您使用由 Google 表格提供支持的外部 BigQuery 数据源,则必须与 AutoML 服务账号共享表格。当您启用 AutoML Tables API 时,系统会自动创建 AutoML Tables 服务账号。

如需授权 AutoML Tables 访问您的表格文件,请执行以下操作:

  1. 转到 Google Cloud 控制台的 IAM 页面。

    转到 IAM 页面

  2. 选中右上角的包括 Google 提供的角色授权复选框。

  3. 查找名为 AutoML Service Agent 的服务账号。

  4. 将主账号名称复制到剪贴板。

    主账号名称是电子邮件地址,类似于以下示例:

    service-358517216@gcp-sa-automl.iam.gserviceaccount.com
    
  5. 打开您的表格文件并与该地址共享。

管理 IAM 角色

您可以使用 Google Cloud 控制台、IAM API 或 gcloud 命令行工具来授予、更改和撤消 IAM 角色。如需了解详细说明,请参阅授予、更改和撤消访问权限

后续步骤

详细了解 Identity and Access Management