Prepare and test your skills

Prepare and test your skills

Free sample question with answers and detailed explanation below. The Professional Cloud Developer practice bank has an additional 608 practice questions.Try 10 free realistic questions: instant score, no credit card, and no account required.
Your team stores Docker images in a standard Artifact Registry repository named app-images inside build-project. A custom Cloud Build service account builds and pushes images, while a custom GKE node service account in prod-runtime-project pulls them.
You need to configure security and storage optimization for app-images:
dev--tagged images older than 14 days, while retaining prod--tagged images and the 5 most recent versions of each package.Which IAM and cleanup policy configuration should you implement?
app-images, configure a single delete policy with tagState set to Any tag state and tag prefix dev- older than 14d, and configure a keep policy for prod--tagged images.Default Google Cloud service accounts automatically receive certain permissions only within the same project. Immutable tags prevent tags from being moved to new images and block deletion of any tagged image in a Docker repository.
prod-runtime-project, explicit IAM role bindings are mandatory.tagState is set to Any tag state; tagState must be set to TAGGED to filter by tag prefixes. Additionally, a single rule cannot simultaneously target dev- images at 14 days and untagged images at 30 days.dev--tagged images.tagState: TAGGED.All services ran in the same project using default service accounts, no tagged images ever needed to be deleted, and only untagged images were targeted for cleanup.
Instead of using repository-wide immutable tags when you need to expire development tags, use keep policies targeting prod- tag prefixes so production tags are preserved while temporary tags can still be pruned.
roles/editor to the Cloud Build service account and roles/artifactregistry.repoAdmin to the GKE node service account on app-images. Grant roles/artifactregistry.admin to the platform engineer and configure a single keep policy that combines the prod- tag prefix condition with keeping the 5 most recent versions, applying all policies directly with --no-dry-run.Basic roles (roles/owner, roles/editor, roles/viewer) are legacy, highly permissive IAM roles spanning services across Google Cloud. Keep policies in Artifact Registry retain specific artifact versions either by matching filter conditions or by preserving a count of the most recent versions.
roles/editor to Cloud Build violates the principle of least privilege and is discouraged in production environments because it grants broad modification rights far beyond Artifact Registry. Likewise, granting roles/artifactregistry.repoAdmin to GKE nodes allows them to write and delete images in app-images, violating the pull-only requirement.prod- tag prefixes) and the keep most recent versions setting inside the same keep policy. They must be configured as two separate keep policies.--no-dry-run bypasses previewing affected artifacts, risking accidental removal of critical container images.30d) and dev--tagged (14d) images, no old images will be purged.tagState, prefixes, age) or mostRecentVersions, never both in one rule.validateOnly: true) showing exactly which versions would be deleted before committing changes.There were no least-privilege constraints in a disposable test project, and you only needed a single-criteria retention rule without previewing deletions.
Always pair roles/artifactregistry.writer for build pipelines and roles/artifactregistry.reader for runtime clusters, keep conditional and version-count keep policies separate, and test with a dry run first.
app-images, grant roles/artifactregistry.writer to the Cloud Build service account and roles/artifactregistry.reader to the GKE node service account. Grant roles/artifactregistry.admin to the platform engineer, create separate conditional delete policies (for UNTAGGED images older than 30d and TAGGED images with prefix dev- older than 14d) alongside separate keep policies (one for prod- tag prefixes and one keeping the 5 most recent versions), test with a dry run, and then apply the policies.Artifact Registry supports fine-grained Identity and Access Management (IAM) bindings at the individual repository level and automated cleanup policies on standard repositories. Combining repository-level predefined roles with separate delete and keep rules enables strict access boundaries and predictable lifecycle management for Docker container images.
roles/artifactregistry.writer directly on app-images gives the custom Cloud Build service account read and write permissions for that repository only. Granting roles/artifactregistry.reader on app-images to the custom GKE node service account in prod-runtime-project enables cross-project image pulls without write or delete privileges.roles/artifactregistry.admin provides the artifactregistry.repositories.update and artifactregistry.versions.delete permissions required to configure and apply cleanup policies.tagState to be set to TAGGED, so the dev- rule (14d) and the UNTAGGED rule (30d) must be separate delete policies. Similarly, conditional rules (prod- prefix) and most recent versions (keep 5) cannot be combined in a single keep policy, so defining two keep policies ensures both retention criteria are enforced. Whenever an image matches both a delete policy and a keep policy, the keep policy takes precedence.prod-runtime-project.This configuration applies strict least privilege across projects, follows Artifact Registry's structural rules for tag-state filtering and keep policies, and validates deletions via a dry run before enforcing automated cleanup.
build-project, grant roles/artifactregistry.writer to the Cloud Build service account and roles/artifactregistry.reader to the GKE node service account. Grant roles/artifactregistry.repoAdmin to the platform engineer, create a virtual repository fronting app-images, and apply the delete and keep cleanup policies to the virtual repository.Project-level IAM bindings apply permissions across every Artifact Registry repository in a project. The Artifact Registry Repository Administrator (roles/artifactregistry.repoAdmin) role permits reading, writing, and deleting artifacts, while a virtual repository acts as a single read-only endpoint aggregating one or more upstream repositories.
roles/artifactregistry.writer and roles/artifactregistry.reader at the project level exposes all repositories in build-project rather than scoping access solely to app-images.roles/artifactregistry.repoAdmin can manually delete artifacts, it lacks the artifactregistry.repositories.update permission needed to create, modify, or remove repository cleanup policies.roles/artifactregistry.repoAdmin) manages artifacts inside existing repositories, whereas Artifact Registry Administrator (roles/artifactregistry.admin) is required to manage repository configurations like cleanup policies.The goal were to provide a unified read-only endpoint across multiple private and remote Docker repositories using a virtual repository, and all repositories in build-project intentionally shared identical access requirements.
To enforce automated retention and deletion, cleanup policies must always be attached directly to each underlying standard repository by a principal holding artifactregistry.repositories.update (such as roles/artifactregistry.admin).
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 Validated