Grant least-privilege list access to Compute images and disks for an external user in a project. What should you do?
Choose an answer
Tap an option to check your answer.
Correct answer: Create a custom IAM role containing compute.disks.list and compute.images.list in includedPermissions, and grant it to the user at the project level..
Why this is the answer
The correct approach is to create a custom IAM role with only the necessary permissions: compute.disks.list and compute.images.list. Granting this custom role at the project level ensures the user can list all images and disks within that project without having broader, unnecessary permissions. This adheres to the principle of least privilege, minimizing potential security risks. The other options are incorrect because they grant excessive permissions: Creating a custom role based on roles/compute.imageUser would include more permissions than just listing, such as creating and deleting images. Basing a role on roles/storage.admin is entirely incorrect as it pertains to Cloud Storage, not Compute Engine resources, and would grant extensive permissions to storage buckets. Directly granting roles/storage.admin at the project level is also incorrect for the same reason and provides far too much access.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed