0
0
GCPcloud~10 mins

Why advanced IAM matters in GCP - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to assign a role to a user in GCP IAM.

GCP
gcloud projects add-iam-policy-binding my-project --member='user:alice@example.com' --role=[1]
Drag options to blanks, or click blank then click option'
Aroles/storage.objectAdmin
Broles/owner
Croles/editor
Droles/viewer
Attempts:
3 left
💡 Hint
Common Mistakes
Assigning overly broad roles like owner or editor unnecessarily.
2fill in blank
medium

Complete the code to create a custom IAM role with specific permissions.

GCP
gcloud iam roles create customRole --project=my-project --permissions=[1] --title='Custom Role'
Drag options to blanks, or click blank then click option'
Acompute.instances.start,compute.instances.stop
Bstorage.buckets.delete,storage.objects.create
Cstorage.buckets.get,storage.objects.list
Diam.roles.create,iam.roles.delete
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing permissions that allow deleting or creating resources when only read access is needed.
3fill in blank
hard

Fix the error in the IAM policy binding command to grant a service account the correct role.

GCP
gcloud projects add-iam-policy-binding my-project --member=[1] --role='roles/storage.objectViewer'
Drag options to blanks, or click blank then click option'
AserviceAccount:my-service-account@my-project.iam.gserviceaccount.com
Buser:my-service-account@my-project.iam.gserviceaccount.com
Cgroup:my-service-account@my-project.iam.gserviceaccount.com
Ddomain:my-service-account@my-project.iam.gserviceaccount.com
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'user:' prefix for service accounts.
4fill in blank
hard

Fill both blanks to create a conditional IAM binding that grants access only if the request comes from a specific IP range.

GCP
gcloud projects add-iam-policy-binding my-project --member=[1] --role='roles/storage.objectViewer' --condition='expression=[2],title=IPRestriction'
Drag options to blanks, or click blank then click option'
Auser:alice@example.com
BipInCidr(request.sourceIp, '192.168.1.0/24')
Crequest.time < timestamp('2025-01-01T00:00:00Z')
Duser:bob@example.com
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong member types or incorrect condition expressions.
5fill in blank
hard

Fill all three blanks to define a least privilege IAM policy binding with a condition on device security status.

GCP
gcloud projects add-iam-policy-binding my-project --member=[1] --role=[2] --condition='expression=[3],title=DeviceSecurityCheck'
Drag options to blanks, or click blank then click option'
Auser:carol@example.com
Broles/iam.securityReviewer
Cdevice.trustedPlatformModulePresent == true
Droles/editor
Attempts:
3 left
💡 Hint
Common Mistakes
Assigning broad roles like editor or missing the condition expression.