Your team is deploying a serverless data processing application in a Google Cloud project named proj-data-pipeline. The application requires access to the BigQuery API (bigquery.googleapis.com), but execution fails because the API has not been enabled for the project. Following Google Cloud best practices and the principle of least privilege, which IAM role should you assign to the cloud administrator, and which command must they execute using the Google Cloud CLI to enable the API?
- Grant the administrator the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin) on proj-data-pipeline, and execute gcloud services enable bigquery.googleapis.com --project=proj-data-pipeline.Answer
- BGrant the administrator the Owner role (roles/owner) on proj-data-pipeline, and execute gcloud components enable bigquery.googleapis.com --project=proj-data-pipeline.
- CGrant the administrator the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin) at the Organization level, and execute gcloud services enable bigquery.googleapis.com without specifying a project flag.
- DGrant the administrator the Quota Administrator role (roles/servicemanagement.quotaAdmin) on proj-data-pipeline, and execute gcloud alpha quotas requests create --service=bigquery.googleapis.com.
Answer
Grant the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin) to the administrator for proj-data-pipeline, and run gcloud services enable bigquery.googleapis.com --project=proj-data-pipeline.
Enabling a Google Cloud API requires the serviceusage.services.enable permission, which is provided by the predefined Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Executing gcloud services enable bigquery.googleapis.com --project=proj-data-pipeline explicitly enables the service on the designated project while maintaining least privilege.
Step-by-Step Solution
Key Concept
Enabling Cloud Service APIs using gcloud CLI and least privilege IAM roles
Estimated Time:2m 0s