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 manages a Google Cloud organization with a production folder containing 10 microservice projects, including orders-prod and billing-prod. During a security audit, you discover that a service account (orders-svc@orders-prod.iam.gserviceaccount.com) was previously granted the roles/storage.objectAdmin role at the production folder level.
You need to update the IAM allow policies to follow the principle of least privilege and satisfy these requirements:
orders-svc to read objects from any Cloud Storage bucket in orders-prod.orders-svc to create objects only in the gs://billing-invoices bucket in billing-prod.orders-svc from accessing any other buckets in billing-prod or any resources in the other 8 projects.Which action should you take?
roles/storage.objectAdmin role binding for orders-svc from the production folder, grant roles/storage.objectViewer to orders-svc on the orders-prod project, and grant roles/storage.objectCreator to orders-svc directly on the gs://billing-invoices bucket.Granular resource-level role binding is the practice of attaching IAM allow policies at the lowest level in the Google Cloud resource hierarchy (organization, folder, project, or individual service resource) that satisfies a workload's operational requirements. Because child resources automatically inherit allow policies from all ancestor nodes, placing a role binding at the smallest required scope prevents unintended access across sibling projects and resources.
roles/storage.objectAdmin from the production folder immediately stops policy inheritance into all 10 projects, ensuring orders-svc can no longer access resources in the 8 unrelated projects or delete objects in any bucket.orders-prod: Granting roles/storage.objectViewer (storage.objects.get and storage.objects.list) at the orders-prod project level allows the service account to read objects in every existing and future bucket within orders-prod.billing-prod: Granting roles/storage.objectCreator directly on the gs://billing-invoices bucket resource limits object creation strictly to that bucket without exposing any other buckets in billing-prod.orders-prod project and gs://billing-invoices bucket) cleanly without granting unnecessary delete rights.orders-svc cannot affect the other 8 production projects or other buckets in billing-prod.Unlike folder-level or broad project-level bindings, pairing a project-level viewer role with a bucket-level creator role leverages Cloud Storage's support for resource-level allow policies while removing the inherited folder-level admin grant that caused over-privileged access.
roles/storage.objectAdmin from the production folder, create a custom role in the production folder containing storage.objects.get, storage.objects.list, and storage.objects.create, and grant it to orders-svc on both the orders-prod and billing-prod projects.Custom IAM roles allow administrators to bundle specific permissions to enforce least privilege when predefined roles do not fit. However, IAM custom roles can only be created at the organization level or the project level, and their scope is restricted to the organization or project in which they are defined.
production folder is invalid; folder-usable custom roles must be defined at the organization level.orders-prod and billing-prod allows orders-svc to create objects in orders-prod and read, list, and create objects in every bucket inside billing-prod.roles/storage.objectViewer and roles/storage.objectCreator) already provide the exact permission sets required without the administrative burden of maintaining custom roles.No predefined role matched the required permissions, the custom role was created at the organization level (or separately in each project), and separate read and write custom roles were bound at the appropriate project and bucket scopes.
Before building a custom role, always check whether combining predefined roles at different levels of the resource hierarchy satisfies the least-privilege requirement cleanly.
roles/storage.objectAdmin from the production folder, grant roles/storage.objectViewer to orders-svc on the orders-prod project, and grant roles/storage.objectCreator to orders-svc on the billing-prod project.Assigning an IAM role at the project level grants all permissions contained in that role across every compatible service resource inside that project. Because projects act as container resources in the Google Cloud resource hierarchy, every Cloud Storage bucket within billing-prod inherits the project's allow policy.
billing-prod: Granting roles/storage.objectCreator on the billing-prod project allows orders-svc to create objects in all existing and future Cloud Storage buckets inside billing-prod, not just gs://billing-invoices.production folder binding protects the other 8 projects, binding the creator role at the project level leaves other sensitive buckets in billing-prod exposed to unauthorized object uploads or overwrites.billing-prod would automatically grant orders-svc object creation permissions.The orders-svc service account needed to upload objects to every Cloud Storage bucket across the entire billing-prod project rather than only a single designated bucket.
When designing IAM policies, always choose the lowest-level resource in the hierarchy that meets the requirement. Use project-level bindings when access spans many resources (like reading any bucket in orders-prod), and use resource-level bindings when access is meant for a single bucket (like gs://billing-invoices).
roles/storage.objectAdmin binding on the production folder, and add roles/storage.objectViewer on the orders-prod project and roles/storage.objectCreator on the gs://billing-invoices bucket so the more specific child policies override the folder policy.In Google Cloud IAM, allow policies propagate downward through the resource hierarchy from the organization to folders, projects, and individual resources. A resource's effective allow policy is always the union of the allow policy attached directly to that resource and all allow policies inherited from its parent ancestors.
roles/storage.objectAdmin at the production folder level means orders-svc continues to inherit full object read, create, and delete permissions across all 10 projects in the folder.roles/storage.objectViewer on orders-prod and roles/storage.objectCreator on gs://billing-invoices has no restrictive effect because roles/storage.objectAdmin already contains a superset of those permissions.billing-prod and all 8 unrelated projects.There is no scenario where adding narrower allow policies at a child level restricts permissions granted by a parent allow policy; to restrict inherited permissions without removing the parent binding, you would need an IAM deny policy, though removing the excessive folder binding is the proper fix here.
Developers often assume IAM inheritance works like traditional file systems where child permissions can replace parent permissions. In Google Cloud IAM, allow policies are strictly additive.
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