使用 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,您需要服務使用情形管理員 IAM 角色 (roles/serviceusage.serviceUsageAdmin),其中包含 serviceusage.services.enable 權限。瞭解如何授予角色。
啟用 API
gcloud
啟用 Cloud Tasks API:
啟用 API 時所需的角色
如要啟用 API,您需要具備服務使用情形管理員 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
|
Cloudtasks 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
|
後續步驟
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2026-04-10 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2026-04-10 (世界標準時間)。"],[],[]]