Question

Difficulty: EasyCreating and Managing Service Accounts

You need to create a new service account named "app-scanner" in your Google Cloud project using the command-line interface. Which gcloud command should you run to accomplish this?

  1. gcloud iam service-accounts create app-scanner --display-name="App Scanner"Answer
  2. B
    gcloud iam service-accounts keys create app-scanner.json [email protected]
  3. C
    gcloud projects add-iam-policy-binding project-id --member="serviceAccount:app-scanner" --role="roles/editor"
  4. D
    gcloud services enable iam.googleapis.com

Answer

Execute the command 'gcloud iam service-accounts create app-scanner --display-name="App Scanner"' to create the service account.
To create a new service account in GCP using the gcloud CLI, the correct command syntax is 'gcloud iam service-accounts create [SA_NAME]'. Additional options such as '--display-name' can be specified to provide a descriptive label.

Step-by-Step Solution

1
Identify the gcloud command group responsible for service account management
The command group is 'gcloud iam service-accounts'.
Service account entities are managed under the IAM service accounts subgroup within the gcloud CLI.
2
Select the sub-command used for creating a new service account identity
The sub-command is 'create'.
The 'create' command provisions a new service account resource with the specified service account ID and optional display name.

Key Concept

Creating service accounts using gcloud CLI
Rate this question