Bird
0
0

Which of the following is the correct way to assign a role to a user in GCP IAM policy JSON?

easy📝 Configuration Q12 of 15
GCP - Cloud IAM Advanced
Which of the following is the correct way to assign a role to a user in GCP IAM policy JSON?
A"members": "roles/viewer", "role": ["user:alice@example.com"]
B"role": "user:alice@example.com", "members": ["roles/viewer"]
C"user": "roles/viewer", "member": "alice@example.com"
D"members": ["user:alice@example.com"], "role": "roles/viewer"
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct IAM JSON structure

    IAM bindings use "role" for the role name and "members" as a list of identities.
  2. Step 2: Match correct syntax

    "members": ["user:alice@example.com"], "role": "roles/viewer" correctly places the user in "members" and the role in "role" with proper formatting.
  3. Final Answer:

    "members": ["user:alice@example.com"], "role": "roles/viewer" -> Option D
  4. Quick Check:

    Role = roles/viewer, Members = user list [OK]
Quick Trick: Remember: role is a string, members is a list [OK]
Common Mistakes:
  • Swapping role and members fields
  • Using string instead of list for members
  • Incorrect key names like 'user' or 'member'

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GCP Quizzes