本頁說明如何授予 Google Cloud 使用者帳戶或服務帳戶存取專案中基本 Dataproc Metastore 資源的權限。本頁面說明的角色可授予建立 Dataproc Metastore 服務的權限。
視您希望帳戶擁有的控制範圍而定,授予帳戶下列其中一個預先定義的 IAM 角色:
roles/metastore.editor
授予 Dataproc Metastore 資源的完整控制權roles/metastore.admin
,可授予 Dataproc Metastore 資源的完整控制權,包括更新 IAM 權限。
如要進一步瞭解這些角色提供的特定 IAM 權限,請參閱「Dataproc Metastore IAM 角色」。
事前準備
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Dataproc Metastore API.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Dataproc Metastore API.
resourcemanager.projects.get
resourcemanager.projects.getIamPolicy
resourcemanager.projects.setIamPolicy
PROJECT_ID
:您要啟用 Metastore 存取權的專案 ID。PRINCIPAL
:主體的類型和電子郵件 ID (電子郵件地址)。- 使用者帳戶:user:EMAIL_ID
- 服務帳戶:serviceAccount:EMAIL_ID
- Google 網路論壇:group:EMAIL_ID
METASTORE_ROLE
:下列其中一個值,視您要授予主體的角色而定:roles/metastore.editor
或roles/metastore.admin
。如要進一步瞭解這些角色授予的權限,請參閱 Dataproc Metastore 身分與存取權管理角色。
必要的角色
您必須在使用的Google Cloud 專案中具備 roles/owner
(擁有者) 基本 IAM 角色,或是具備授予下列權限的角色:
如要在遵循最小權限原則的情況下取得這些權限,請要求管理員授予您 roles/resourcemanager.projectIamAdmin
(專案 IAM 管理員) 角色。
如何授予存取角色
gcloud
如要使用 gcloud CLI,可以安裝及初始化 Google Cloud CLI,也可以使用 Cloud Shell。
執行下列 add-iam-policy-binding
指令,將 Dataproc Metastore 預先定義的角色授予 IAM 主體 (使用者帳戶或服務帳戶)。
gcloud projects add-iam-policy-binding PROJECT_ID \ --member=PRINCIPAL \ --role=METASTORE_ROLE
更改下列內容: