Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
使用 IAM 进行访问权限控制
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Cloud Tasks 使用 Identity and Access Management (IAM) 进行访问权限控制。
如需了解 IAM 及其功能,请参阅
IAM 概览。如需了解如何授予和
撤消访问权限,请参阅
管理对项目、文件夹和组织的访问权限。
您可以在项目级层和队列级层配置访问权限控制条件。
例如,您可以授予用户创建任务并将其添加到队列的权限,但不授予其删除队列的权限。或者,您可以向一组用户授予对某项目中的所有 Cloud Tasks 资源的访问权限。如需了解详情,请参阅
保护队列配置。
每种 Cloud Tasks 方法都要求调用者拥有必要的权限。本页介绍了 Cloud Tasks 支持的权限和角色。更新
queue.yaml(或旧版 queue.xml 文件)或使用 Google Cloud 控制台时,系统也会检查权限。
启用 Cloud Tasks API
如需查看和分配 Cloud Tasks 的 IAM 角色,您必须为项目启用 Cloud Tasks API。在启用此 API 之前,您无法在 Google Cloud 控制台中查看 Cloud Tasks 角色。
控制台
启用 Cloud Tasks API。
启用 API 所需的角色
如需启用 API,您需要拥有 Service Usage Admin IAM 角色 (roles/serviceusage.serviceUsageAdmin),该角色包含 serviceusage.services.enable 权限。了解如何授予角色。
启用 API
gcloud
启用 Cloud Tasks API:
启用 API 所需的角色
如需启用 API,您需要拥有 Service Usage Admin IAM
角色 (roles/serviceusage.serviceUsageAdmin),该角色包含
serviceusage.services.enable 权限。了解如何授予
角色。
gcloud services enable cloudtasks.googleapis.com
预定义角色
下表列出了 Cloud Tasks 预定义 IAM 角色及其对应的权限。
预定义角色可满足大多数典型的用例。如果预定义角色无法满足您的用例,您可以
创建 IAM 自定义角色。
| Role |
Permissions |
Cloud Tasks Admin
Beta
(roles/cloudtasks.admin)
Full access to queues and tasks.
|
cloudtasks.*
cloudtasks.cmekConfig.get
cloudtasks.cmekConfig.update
cloudtasks.locations.get
cloudtasks.locations.list
cloudtasks.queues.create
cloudtasks.queues.delete
cloudtasks.queues.get
cloudtasks.queues.getIamPolicy
cloudtasks.queues.list
cloudtasks.queues.pause
cloudtasks.queues.purge
cloudtasks.queues.resume
cloudtasks.queues.setIamPolicy
cloudtasks.queues.update
cloudtasks.tasks.create
cloudtasks.tasks.delete
cloudtasks.tasks.fullView
cloudtasks.tasks.get
cloudtasks.tasks.list
cloudtasks.tasks.run
monitoring.timeSeries.list
resourcemanager.projects.get
resourcemanager.projects.list
|
Cloud Tasks Editor
Beta
(roles/cloudtasks.editor)
Editor role for cloudtasks
|
cloudtasks.cmekConfig.get
cloudtasks.locations.*
cloudtasks.locations.get
cloudtasks.locations.list
cloudtasks.queues.create
cloudtasks.queues.delete
cloudtasks.queues.get
cloudtasks.queues.list
cloudtasks.queues.pause
cloudtasks.queues.purge
cloudtasks.queues.resume
cloudtasks.queues.update
cloudtasks.tasks.*
cloudtasks.tasks.create
cloudtasks.tasks.delete
cloudtasks.tasks.fullView
cloudtasks.tasks.get
cloudtasks.tasks.list
cloudtasks.tasks.run
monitoring.timeSeries.list
resourcemanager.projects.get
resourcemanager.projects.list
|
Cloud Tasks Viewer
Beta
(roles/cloudtasks.viewer)
Get and list access to tasks, queues, and locations.
|
cloudtasks.cmekConfig.get
cloudtasks.locations.*
cloudtasks.locations.get
cloudtasks.locations.list
cloudtasks.queues.get
cloudtasks.queues.list
cloudtasks.tasks.fullView
cloudtasks.tasks.get
cloudtasks.tasks.list
monitoring.timeSeries.list
resourcemanager.projects.get
resourcemanager.projects.list
|
Cloud Tasks Enqueuer
Beta
(roles/cloudtasks.enqueuer)
Access to create tasks.
|
cloudtasks.tasks.create
cloudtasks.tasks.fullView
resourcemanager.projects.get
resourcemanager.projects.list
|
Cloud Tasks Queue Admin
Beta
(roles/cloudtasks.queueAdmin)
Admin access to queues.
|
cloudtasks.locations.*
cloudtasks.locations.get
cloudtasks.locations.list
cloudtasks.queues.*
cloudtasks.queues.create
cloudtasks.queues.delete
cloudtasks.queues.get
cloudtasks.queues.getIamPolicy
cloudtasks.queues.list
cloudtasks.queues.pause
cloudtasks.queues.purge
cloudtasks.queues.resume
cloudtasks.queues.setIamPolicy
cloudtasks.queues.update
resourcemanager.projects.get
resourcemanager.projects.list
|
Cloud Tasks Task Deleter
Beta
(roles/cloudtasks.taskDeleter)
Access to delete tasks.
|
cloudtasks.tasks.delete
resourcemanager.projects.get
resourcemanager.projects.list
|
Cloud Tasks Task Runner
Beta
(roles/cloudtasks.taskRunner)
Access to run tasks.
|
cloudtasks.tasks.fullView
cloudtasks.tasks.run
resourcemanager.projects.get
resourcemanager.projects.list
|
Service agent roles
Service agent roles should only be granted to service agents.
| Role |
Permissions |
Cloud Tasks Service Agent
(roles/cloudtasks.serviceAgent)
Grants Cloud Tasks Service Account access to manage resources.
|
iam.serviceAccounts.getAccessToken
iam.serviceAccounts.getOpenIdToken
logging.logEntries.create
|
后续步骤
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2026-05-18。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2026-05-18。"],[],[]]