Prepare and test your skills

Prepare and test your skills

Free sample question with answers and detailed explanation below. The Associate Cloud Engineer practice bank has an additional 2,014 practice questions.Try 10 free realistic questions: instant score, no credit card, and no account required.
You need to create a new user-managed service account named app-processor using the Google Cloud CLI. The configuration must satisfy the following operational requirements:
App Processor and a description of Processes incoming storage objects.roles/storage.objectViewer) at the project level in project my-corp-prod.Which sequence of gcloud commands should you execute to accomplish this?
gcloud iam service-accounts create app-processor --display-name="App Processor" --description="Processes incoming storage objects"gcloud projects add-iam-policy-binding my-corp-prod --member="user:app-processor@my-corp-prod.iam.gserviceaccount.com" --role="roles/storage.objectViewer"user: Prefix Member Binding DoesThe gcloud projects add-iam-policy-binding command binds an IAM role to a specified identity on a project. However, this option specifies the member string with the user: prefix (user:app-processor@my-corp-prod.iam.gserviceaccount.com) instead of the serviceAccount: prefix.
user: designates a human user with a Google Account or Google Workspace account.app-processor@my-corp-prod.iam.gserviceaccount.com is a service account and not a Google user account, attempting to bind it using the user: prefix results in a validation error or fails to authenticate the workload properly.roles/storage.objectViewer permissions because Cloud IAM will not match the service account's identity token to a user: policy binding.user:, serviceAccount:, group:, or domain:.serviceAccount:, followed by the full email address ending in .iam.gserviceaccount.com.This command would be correct if app-processor@my-corp-prod.iam.gserviceaccount.com were an individual human user's email address authenticated through Google Workspace or Cloud Identity, rather than a service account identity.
Always remember the principal prefixes used in Google Cloud IAM:
serviceAccount: for user-managed and Google-managed service accounts.user: for individual Google Accounts or Google Workspace users.group: for Google Groups.domain: for an entire Google Workspace domain.gcloud iam service-accounts create app-processor --display-name="App Processor" --description="Processes incoming storage objects" --role="roles/storage.objectViewer"--role AttemptsThis option attempts to create the service account and assign an initial project-level IAM role simultaneously by appending a --role flag directly to the gcloud iam service-accounts create command.
gcloud iam service-accounts create does not support a --role flag. Executing this command will result in an unrecognized argument error from the gcloud CLI.gcloud iam service-accounts create command only accepts flags related to identity metadata, such as --display-name, --description, and --project.resourcemanager.projects resource, requiring a call to gcloud projects add-iam-policy-binding.This syntax would be correct if the Google Cloud CLI implemented a composite helper command that automatically chained identity creation and project IAM policy binding under a single CLI flag, but such a flag does not exist on gcloud iam service-accounts create.
Candidates often confuse the graphical Cloud Console workflow with CLI commands. In the console, Step 2 allows selecting project roles before finishing, which leads some beginners to mistakenly assume that --role is a direct parameter of service account creation in gcloud.
gcloud iam service-accounts create app-processor --display-name="App Processor" --description="Processes incoming storage objects"gcloud projects add-iam-policy-binding my-corp-prod --member="serviceAccount:app-processor@my-corp-prod.iam.gserviceaccount.com" --role="roles/storage.objectViewer"Creating and configuring a service account in Google Cloud using the Google Cloud CLI (gcloud) requires a multi-step workflow. The command gcloud iam service-accounts create provisions the non-human identity within the project, allowing you to define administrative metadata such as the display name and description. Once provisioned, permissions on project resources are assigned by binding IAM roles to the service account identity at the project level using gcloud projects add-iam-policy-binding.

gcloud iam service-accounts create app-processor generates the new service account resource with the email format app-processor@my-corp-prod.iam.gserviceaccount.com. The flags --display-name="App Processor" and --description="Processes incoming storage objects" assign user-friendly identifiers to document the account's operational context.gcloud projects add-iam-policy-binding my-corp-prod updates the project's IAM policy. Setting --member="serviceAccount:app-processor@my-corp-prod.iam.gserviceaccount.com" accurately specifies the service account member type prefix, and --role="roles/storage.objectViewer" grants read access to Cloud Storage objects across the project.serviceAccount: prefix ensures Cloud IAM resolves the principal as a managed service account identity rather than a user account.Unlike the Cloud Console walkthrough—which combines service account creation, project role assignments, and user delegation into a single wizard—the command-line interface separates service account generation from project policy bindings. Using gcloud projects add-iam-policy-binding with the designated serviceAccount: prefix is the standard, valid command syntax to grant operational roles to newly created service accounts.
gcloud iam service-accounts create app-processor --display-name="App Processor" --description="Processes incoming storage objects"gcloud iam service-accounts add-iam-policy-binding app-processor@my-corp-prod.iam.gserviceaccount.com --member="serviceAccount:app-processor@my-corp-prod.iam.gserviceaccount.com" --role="roles/storage.objectViewer"gcloud iam service-accounts add-iam-policy-binding DoesThe command gcloud iam service-accounts add-iam-policy-binding modifies the IAM access policy of the service account itself, rather than granting the service account access to external project resources like Cloud Storage.
roles/storage.objectViewer on the service account itself is meaningless, because a service account resource does not hold Cloud Storage objects.my-corp-prod.roles/iam.serviceAccountUser) or Service Account Token Creator (roles/iam.serviceAccountTokenCreator).gcloud projects add-iam-policy-binding) or to the specific resource directly.This command structure would be correct if the goal were to grant a human user or developer the ability to attach or impersonate the service account using the roles/iam.serviceAccountUser role on the service account resource.
Understanding the dual nature of service accounts as both an identity (principal) and a resource is a core requirement of Google Cloud IAM. Confusing gcloud projects add-iam-policy-binding with gcloud iam service-accounts add-iam-policy-binding is a common mistake on cloud security exams.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated