Question

Difficulty: HardEnabling and Managing Cloud Service APIs

Your team needs to enable the Cloud Vision API (`vision.googleapis.com`) in a Google Cloud project named `proj-ai-prod` using the `gcloud` CLI while adhering to Google Cloud security and administrative best practices. Which of the following sequences represents the correct order of steps to configure permissions, set project context, activate the service, and verify its status?

  1. 1Assign the Service Usage Admin role (`roles/serviceusage.serviceUsageAdmin`) to the engineer's identity on project `proj-ai-prod`.
  2. 2Set the active project context in the gcloud CLI by executing `gcloud config set project proj-ai-prod`.
  3. 3Enable the Cloud Vision API by executing `gcloud services enable vision.googleapis.com`.
  4. 4Confirm the API is enabled by executing `gcloud services list --enabled --filter="NAME:vision.googleapis.com"`.

Answer

The correct sequence of steps is: 1) Assign the Service Usage Admin role (`roles/serviceusage.serviceUsageAdmin`) to the engineer's identity on project `proj-ai-prod`; 2) Set the active project context in the gcloud CLI by executing `gcloud config set project proj-ai-prod`; 3) Enable the Cloud Vision API by executing `gcloud services enable vision.googleapis.com`; 4) Confirm the API is enabled by executing `gcloud services list --enabled --filter="NAME:vision.googleapis.com"`.
The correct workflow follows standard GCP administration sequence: first authorization, then workspace context initialization, service execution, and status verification. Assigning `roles/serviceusage.serviceUsageAdmin` grants permissions to modify API states. Executing `gcloud config set project proj-ai-prod` explicitly targets the target project. Running `gcloud services enable vision.googleapis.com` enables the service API. Finally, running `gcloud services list --enabled --filter="NAME:vision.googleapis.com"` validates the operational status of the service.

Step-by-Step Solution

1
Grant requisite IAM access role on the project
The identity receives the Service Usage Admin role (`roles/serviceusage.serviceUsageAdmin`) on `proj-ai-prod`
Administrative permissions (`serviceusage.services.enable`) are required before invoking API enablement operations.
2
Set active CLI project context
The gcloud environment targets `proj-ai-prod` as the active project
Prevents accidental modification of incorrect project environments during CLI administration.
3
Execute the API enablement command
The `vision.googleapis.com` service API is enabled for `proj-ai-prod`
Activates the specific service API endpoints required for application workloads.
4
Inspect enabled services list
Output displays `vision.googleapis.com` as active
Provides empirical verification that the API enablement succeeded.

Key Concept

Enabling Cloud Service APIs via the gcloud CLI requires establishing appropriate IAM roles, targeting the correct project context, executing enablement, and verifying status.
Rate this question