Google Cloud 提供身分與存取權管理 (IAM),可讓您授予特定 Google Cloud 資源的存取權,但無法存取其他資源。IAM 可讓您採用最低權限安全原則,只將必要的資源存取權授予他人。
設定 IAM 允許政策之後,即可控管哪些使用者具備何種存取權限 (角色),可以存取哪些資源。允許政策會授予使用者特定角色,讓使用者擁有這些角色的權限。
本頁面說明 Cloud Billing API 適用的 IAM 角色。舉例來說,您可以使用 IAM 授予 Cloud 帳單帳戶的「帳單帳戶費用管理員」或「帳單帳戶檢視者」等角色。如需 IAM 及其功能的詳細說明,請參閱 IAM 說明文件。特別是「管理專案、資料夾和機構的存取權」和「管理其他資源的存取權」一節。
權限與角色
如要讓使用者在Google Cloud 控制台中查看 Cloud Billing 帳戶詳細資料,或讓 Cloud Billing API 方法傳回 Cloud Billing 帳戶資訊,使用者或呼叫者必須具備必要權限。
Cloud Billing Catalog API 的必要權限
使用 Cloud Billing Catalog API (服務清單和 SKU 清單) 時無須任何權限。這個 API 傳回的所有資料都是公開資料。
Cloud Billing Budget API 的必要權限
下表列出呼叫各項 Cloud Billing Budget API 方法所需的權限。此外,標準 IAM 帳單角色也會自動授予這些權限。
API 方法 | 所需權限 | 授予權限的 IAM 角色 |
---|---|---|
GetBudget |
如要取得預算詳細資料,呼叫方必須擁有預算 Cloud Billing 帳戶的 billing.budgets.get 權限。如果是單一專案預算,呼叫者可以擁有專案的下列權限,而非帳單帳戶權限: |
預算所屬 Cloud Billing 帳戶的「帳單帳戶管理員」、「帳單帳戶費用管理員」或「帳單帳戶檢視者」。 如果是單一專案預算,則為專案的專案擁有者、專案編輯者或專案檢視者。 |
ListBudgets |
如要傳回套用至 Cloud Billing 帳戶的預算清單,呼叫者必須具備 Cloud Billing 帳戶的 billing.budgets.list 權限。如果是單一專案預算,呼叫者可以擁有專案的下列權限,而非帳單帳戶權限: |
預算所屬 Cloud Billing 帳戶的「帳單帳戶管理員」、「帳單帳戶費用管理員」或「帳單帳戶檢視者」。 如果是單一專案預算,則為專案的專案擁有者、專案編輯者或專案檢視者。 |
CreateBudget |
如要建立新預算,呼叫方必須擁有預算所屬 Cloud Billing 帳戶的 billing.budgets.create 權限。如果是單一專案預算,呼叫端可以擁有專案的下列權限,而不需具備帳單帳戶權限: |
預算所屬 Cloud Billing 帳戶的「帳單帳戶管理員」或「帳單帳戶費用管理員」。 如果是單一專案預算,則為專案的「專案擁有者」或「專案編輯者」。 |
UpdateBudget |
如要更新現有預算,呼叫方必須擁有預算所屬 Cloud Billing 帳戶的 billing.budgets.update 權限。如果是單一專案預算,呼叫端可以擁有專案的下列權限,而不需具備帳單帳戶權限: |
預算所屬 Cloud Billing 帳戶的「帳單帳戶管理員」或「帳單帳戶費用管理員」。 如果是單一專案預算,則為專案的「專案擁有者」或「專案編輯者」。 |
DeleteBudget |
如要刪除現有預算,呼叫方必須擁有預算所屬 Cloud Billing 帳戶的 billing.budgets.delete 權限。如果是單一專案預算,呼叫端可以擁有專案的下列權限,而不需具備帳單帳戶權限: |
預算所屬 Cloud Billing 帳戶的「帳單帳戶管理員」或「帳單帳戶費用管理員」。 如果是單一專案預算,則為專案的「專案擁有者」或「專案編輯者」。 |
Cloud Billing Account API 的必要權限
下表列出呼叫各項 Cloud Billing 帳戶 API 方法所需的權限,以及包含這些權限的 Cloud Billing IAM 角色。
API 方法 | 所需權限 | 包含權限的 IAM 角色 |
---|---|---|
billingAccounts.create |
方法用於建立新的 Cloud Billing 子帳戶。呼叫方必須擁有子帳戶上層 Cloud Billing 帳戶的 billing.accounts.update 權限。 |
帳單帳戶管理員 |
billingAccounts.get |
Cloud Billing 帳戶的 billing.accounts.get 權限。 |
帳單帳戶管理員、帳單帳戶費用管理員、 帳單帳戶檢視者或帳單帳戶使用者 |
billingAccounts.list |
無,這個方法會傳回呼叫方有權存取的所有帳戶。 | Cloud Billing 帳戶的「帳單帳戶管理員」、「帳單帳戶費用管理員」、「帳單帳戶檢視者」或「帳單帳戶使用者」,或是專案的「專案帳單管理員」。 |
billingAccounts.getIamPolicy |
Cloud Billing 帳戶的 billing.accounts.getIamPolicy 權限。 |
帳單帳戶管理員、帳單帳戶費用管理員、 帳單帳戶檢視者或帳單帳戶使用者 |
billingAccounts.setIamPolicy |
Cloud Billing 帳戶的 billing.accounts.setIamPolicy 權限。 |
帳單帳戶管理員 |
billingAccounts.testIamPermissions |
無,這個方法可用來判斷呼叫方擁有的 Cloud Billing 帳戶權限。 | 不適用 |
billingAccounts.patch |
Cloud Billing 帳戶的 billing.accounts.update 權限。 |
帳單帳戶管理員 |
billingAccounts.projects.list |
Cloud Billing 帳戶的 billing.resourceAssociations.list 。
|
帳單帳戶管理員、帳單帳戶費用管理員或 帳單帳戶檢視者 |
projects.getBillingInfo |
resourcemanager.projects.get 專案。詳情請參閱「專案存取權控管」。 |
專案擁有者、專案編輯者或專案檢視者 |
projects.updateBillingInfo |
Cloud Billing 帳戶的 billing.resourceAssociations.create 和專案的 resourcemanager.projects.createBillingAssignment 。 |
帳單帳戶管理員或帳單帳戶使用者,以及專案帳單管理員 |
角色
您並非直接為使用者授予權限,而是指派「角色」給他們,每個角色可能具備一或多項權限。
針對同一項資源,您可以授予一或多個角色。
下表列出了您可以授予的角色,擁有這些角色的使用者即可存取 Cloud Billing API。此外,您也可以透過下表瞭解各個角色的作用和角色具備的權限。其中部分角色也包含其他 Google Cloud 服務的權限。
Role | Permissions |
---|---|
Billing Account Administrator( Provides access to see and manage all aspects of billing accounts. Lowest-level resources where you can grant this role:
|
|
Carbon Footprint Viewer(
|
|
Billing Account Costs Manager( Manage budgets for a billing account, and view, analyze, and export cost information of a billing account. Lowest-level resources where you can grant this role:
|
|
Billing Account Creator( Provides access to create billing accounts. Lowest-level resources where you can grant this role:
|
|
Project Billing Costs Manager( When granted in conjunction with cost view permissions on projects, provides access to billing information scoped to the projects to which the user has cost access. Lowest-level resources where you can grant this role:
|
|
Project Billing Manager( When granted in conjunction with the Billing Account User role, provides access to assign a project's billing account or disable its billing. Lowest-level resources where you can grant this role:
|
|
Billing Account User( When granted in conjunction with the Project Owner role or Project Billing Manager role, provides access to associate projects with billing accounts. Lowest-level resources where you can grant this role:
|
|
Billing Account Viewer( View billing account cost and pricing information, transactions, and billing and commitment recommendations. Lowest-level resources where you can grant this role:
|
|
請注意,roles/billing.admin
、roles/billing.costsManager
、roles/billing.viewer
和 roles/billing.projectManager
角色也具備其他 Google Cloud 服務的權限。
相關主題
- IAM 說明文件:管理專案、資料夾和機構的存取權
- IAM 說明文件中的「管理其他資源的存取權」
- 針對 Cloud Billing 建立自訂角色