Concedi agli utenti ruoli IAM di Dataproc Metastore di base

Questa pagina descrive come concedere a un account utente o di servizio l'accesso alle risorse di base di Dataproc Metastore in un progetto. Google Cloud I ruoli descritti in questa pagina forniscono l'accesso per creare un servizio Dataproc Metastore.

A seconda dell'ambito di controllo che vuoi che abbia l'account, gli concedi uno di questi ruoli IAM predefiniti:

  • roles/metastore.editor per concedere il controllo completo delle risorse Dataproc Metastore
  • roles/metastore.admin per concedere il controllo completo delle risorse Dataproc Metastore, incluso l'aggiornamento delle autorizzazioni IAM.

Per informazioni dettagliate sulle autorizzazioni IAM specifiche fornite da questi ruoli, consulta Ruoli IAM di Dataproc Metastore.

Prima di iniziare

  1. 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.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Enable the Dataproc Metastore API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  6. Verify that billing is enabled for your Google Cloud project.

  7. Enable the Dataproc Metastore API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

  8. Ruoli obbligatori

    Devi disporre del ruolo IAM di base roles/owner (Proprietario) nel progettoGoogle Cloud che stai utilizzando o di un ruolo che concede queste autorizzazioni:

    • resourcemanager.projects.get
    • resourcemanager.projects.getIamPolicy
    • resourcemanager.projects.setIamPolicy

    Per ottenere queste autorizzazioni seguendo il principio del privilegio minimo, chiedi all'amministratore di concederti il ruolo roles/resourcemanager.projectIamAdmin (amministratore IAM progetto).

    Come concedere i ruoli di accesso

    gcloud

    Per utilizzare gcloud CLI, puoi installare e inizializzare Google Cloud CLI oppure utilizzare Cloud Shell.

    Esegui il seguente comando add-iam-policy-binding per concedere un ruolo predefinito Dataproc Metastore a un'entità IAM (account utente o account di servizio).

      gcloud projects add-iam-policy-binding PROJECT_ID \
         --member=PRINCIPAL \
         --role=METASTORE_ROLE

    Sostituisci quanto segue:

    • PROJECT_ID: l'ID del progetto a cui vuoi attivare l'accesso a Metastore.
    • PRINCIPAL: Il tipo e l'ID email (indirizzo email) dell'entità.
      • Per gli account utente: user:EMAIL_ID
      • Per i service account: serviceAccount:EMAIL_ID
      • Per Google Gruppi: group:EMAIL_ID
    • METASTORE_ROLE: uno dei seguenti valori, a seconda del ruolo che vuoi concedere all'entità: roles/metastore.editor o roles/metastore.admin. Per informazioni dettagliate sulle autorizzazioni concesse da questi ruoli, consulta Ruoli IAM di Dataproc Metastore.