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 is deploying a containerized web service directly from source code to Cloud Run in an application project (app-proj). To meet governance requirements, the deployment must store and pull container images using a new pkg.dev Docker repository named prod-images in a separate project (registry-proj):
ci-builder@app-proj.iam.gserviceaccount.com)cd-deployer@app-proj.iam.gserviceaccount.com)Which configuration should you apply in registry-proj?
prod-images Docker repository in registry-proj. On that repository, grant roles/artifactregistry.writer to ci-builder@app-proj.iam.gserviceaccount.com, and grant roles/artifactregistry.reader to both cd-deployer@app-proj.iam.gserviceaccount.com and the app-proj Cloud Run Service Agent.Artifact Registry separates repository creation from artifact push and pull operations, requiring explicit Identity and Access Management (IAM) bindings whenever services operate across project boundaries or use custom service accounts. When deploying to Cloud Run from source code using a centralized registry project, both the build pipeline and the runtime deployment platform require distinct, role-appropriate permissions on the target repository.
pkg.dev repository: Unlike legacy registry hosts, repositories on the pkg.dev domain must exist before Cloud Build can push an image or Cloud Run can pull it.roles/artifactregistry.writer) to ci-builder@app-proj.iam.gserviceaccount.com gives Cloud Build permission to read base layers and write the newly built container image.roles/artifactregistry.reader) to cd-deployer@app-proj.iam.gserviceaccount.com and the Cloud Run Service Agent (service-APP_PROJECT_NUMBER@serverless-robot-prod.iam.gserviceaccount.com) enables both the deployment API call and the Cloud Run control plane to pull the image across projects.prod-images repository ensures each identity receives only the exact permissions needed on a single repository rather than project-wide access.registry-proj.Granting roles/artifactregistry.writer to the custom build account and roles/artifactregistry.reader to the deploying and Cloud Run Service Agent accounts at the repository level satisfies every cross-project access path without over-privileging any principal with delete or repository administration rights.
prod-images on the first push, and grant roles/artifactregistry.admin at the project level in registry-proj to ci-builder@app-proj.iam.gserviceaccount.com and the app-proj Compute Engine default service account.Artifact Registry Administrator (roles/artifactregistry.admin) is a high-privilege role intended for platform administrators who create, configure, and delete repositories as well as modify repository IAM policies across a project. Relying on automatic repository creation assumes legacy registry behavior where pushing an image automatically provisions the underlying storage location.
pkg.dev repository creation: Repositories on the pkg.dev domain are never auto-created on push; any build attempting to push to a non-existent pkg.dev repository will fail immediately.roles/artifactregistry.admin at the project level allows the build and runtime accounts to delete repositories, overwrite any team's artifacts, and alter IAM policies across all repositories in registry-proj.cd-deployer@app-proj.iam.gserviceaccount.com.pkg.dev repositories must be created beforehand with gcloud artifacts repositories create or infrastructure-as-code tooling.registry-proj.roles/artifactregistry.admin includes artifactregistry.repositories.create, delete, and setIamPolicy.No answer using pkg.dev auto-creation would succeed; however, project-level roles/artifactregistry.admin would only be appropriate for a centralized platform administrator account tasked with provisioning and managing all repositories in registry-proj.
prod-images Docker repository in registry-proj. On that repository, grant roles/artifactregistry.writer to the default Cloud Build service account for app-proj, and grant roles/artifactregistry.repoAdmin to the app-proj Compute Engine default service account.repoAdmin doWhen Cloud Build and Cloud Run run within the same project using default identities, Cloud Build uses its default service account and Cloud Run uses default service agents and the Compute Engine default service account. The Artifact Registry Repository Administrator role (roles/artifactregistry.repoAdmin) grants full read, write, and delete permissions for artifacts inside a repository.
ci-builder@app-proj.iam.gserviceaccount.com), Cloud Build authenticates as ci-builder, not the default Cloud Build service account. The image push will fail with an authorization error.cd-deployer), not the Compute Engine default service account.roles/artifactregistry.repoAdmin to a runtime account allows it to overwrite and permanently delete production container images when it only needs read access.repoAdmin rights: roles/artifactregistry.repoAdmin includes artifactregistry.repositories.deleteArtifacts and uploadArtifacts, which should never be granted to a runtime service account.You were intentionally running builds with the default Cloud Build service account instead of ci-builder, and a repository maintainer needed roles/artifactregistry.repoAdmin to manage and clean up stored images.
prod-images Docker repository in registry-proj, grant roles/artifactregistry.createOnPushWriter at the project level to ci-builder@app-proj.iam.gserviceaccount.com, and grant roles/storage.objectViewer on the repository's underlying Cloud Storage bucket to the app-proj Cloud Run Service Agent.createOnPushWriter and Cloud Storage IAM doThe Artifact Registry Create-on-Push Writer role (roles/artifactregistry.createOnPushWriter) is a specialized transition role that lets principals read and write artifacts while automatically creating gcr.io-backed repositories when pushing to legacy gcr.io URLs. Meanwhile, Storage Object Viewer (roles/storage.objectViewer) is a Cloud Storage role used to read objects in GCS buckets.
roles/storage.objectViewer has no effect on Artifact Registry image pulls, causing Cloud Run deployments to fail with permission-denied errors.roles/artifactregistry.createOnPushWriter at the project level violates least privilege because prod-images is an explicitly created pkg.dev repository and does not need gcr.io create-on-push capabilities across the entire project.cd-deployer@app-proj.iam.gserviceaccount.com for executing Cloud Run deployments.roles/artifactregistry.* roles rather than Cloud Storage bucket policies.roles/artifactregistry.createOnPushWriter is designed specifically for migrating gcr.io workflows to Artifact Registry.registry-proj to ci-builder.You were managing a legacy Container Registry (gcr.io) workflow before its shutdown, where image layers lived in project Cloud Storage buckets, or migrating gcr.io URLs into Artifact Registry repositories.
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