Bird
Raised Fist0
GCPcloud~10 mins

Policy troubleshooter in GCP - Interactive Code Practice

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

Complete the command to start the Policy Troubleshooter for a specific resource.

GCP
gcloud policy-troubleshooter iam troubleshoot [1]
Drag options to blanks, or click blank then click option'
A--resource
B--resource-path
C--resource-id
D--resource-name
Attempts:
3 left
💡 Hint
Common Mistakes
Using '--resource' alone which is not a valid flag.
Confusing resource ID with resource name.
2fill in blank
medium

Complete the command to specify the permission to troubleshoot in Policy Troubleshooter.

GCP
gcloud policy-troubleshooter iam troubleshoot --resource-name=my-resource [1] storage.buckets.get
Drag options to blanks, or click blank then click option'
A--permission
B--role
C--permissions
D--role-name
Attempts:
3 left
💡 Hint
Common Mistakes
Using '--role' instead of '--permission'.
Using plural '--permissions' which is not valid.
3fill in blank
hard

Fix the error in the command to troubleshoot IAM policy for a user.

GCP
gcloud policy-troubleshooter iam troubleshoot --resource-name=my-resource --permission=storage.buckets.get --principal=[1]
Drag options to blanks, or click blank then click option'
Auser=alice@example.com
Balice@example.com
Cuser:alice@example.com
Duser alice@example.com
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the 'user:' prefix.
Using '=' or space instead of ':'.
4fill in blank
hard

Fill both blanks to troubleshoot IAM policy for a service account and specify the permission.

GCP
gcloud policy-troubleshooter iam troubleshoot --resource-name=my-resource --principal=[1] --permission=[2]
Drag options to blanks, or click blank then click option'
AserviceAccount:my-sa@project.iam.gserviceaccount.com
Bstorage.objects.list
Cuser:my-user@example.com
Dstorage.buckets.create
Attempts:
3 left
💡 Hint
Common Mistakes
Using a user principal instead of a service account.
Using a permission that does not match the resource.
5fill in blank
hard

Fill all three blanks to troubleshoot IAM policy for a user, specify the resource, and the permission.

GCP
gcloud policy-troubleshooter iam troubleshoot [1] --principal=[2] --permission=[3]
Drag options to blanks, or click blank then click option'
A--resource-name=my-bucket
Buser:bob@example.com
Cstorage.objects.get
D--resource-id=my-bucket
Attempts:
3 left
💡 Hint
Common Mistakes
Using '--resource-id' instead of '--resource-name'.
Omitting the 'user:' prefix in the principal.
Using an incorrect permission string.

Practice

(1/5)
1. What is the main purpose of the Policy Troubleshooter in Google Cloud?
easy
A. To find out why a user has or does not have access to a resource
B. To create new IAM policies automatically
C. To monitor network traffic between services
D. To backup data stored in Cloud Storage

Solution

  1. Step 1: Understand the role of Policy Troubleshooter

    The Policy Troubleshooter is designed to analyze access requests and explain why access is granted or denied.
  2. Step 2: Compare options with this role

    Only To find out why a user has or does not have access to a resource matches this purpose. Options B, C, and D describe unrelated functions.
  3. Final Answer:

    To find out why a user has or does not have access to a resource -> Option A
  4. Quick Check:

    Policy Troubleshooter explains access decisions = A [OK]
Hint: Remember: Troubleshooter explains access, not creates policies [OK]
Common Mistakes:
  • Thinking it creates or modifies policies
  • Confusing it with monitoring or backup tools
  • Assuming it manages network traffic
2. Which of the following is the correct way to specify parameters when using the Policy Troubleshooter API?
easy
A. Provide user email, permission string, and resource name
B. Provide only the resource name
C. Provide user password and resource IP
D. Provide project ID and billing account

Solution

  1. Step 1: Identify required inputs for Policy Troubleshooter

    The tool requires the user identity (email), the permission to check, and the resource to analyze.
  2. Step 2: Match inputs with options

    Provide user email, permission string, and resource name correctly lists these parameters. Options A, B, and D miss or misuse required inputs.
  3. Final Answer:

    Provide user email, permission string, and resource name -> Option A
  4. Quick Check:

    Correct parameters = user, permission, resource [OK]
Hint: Policy Troubleshooter needs user, permission, and resource [OK]
Common Mistakes:
  • Providing incomplete parameters
  • Using passwords or billing info instead of user email
  • Confusing resource name with IP or project ID
3. Given the following Policy Troubleshooter output snippet:
{"access": "GRANTED", "reasons": ["User has role roles/viewer on project"]}

What does this output mean?
medium
A. The user is denied access because no role matches
B. The user has access because they have the viewer role on the project
C. The user has access but only to storage buckets
D. The output is invalid and shows an error

Solution

  1. Step 1: Interpret the access field

    The field "access": "GRANTED" means the user is allowed access.
  2. Step 2: Understand the reason given

    The reason states the user has the role "roles/viewer" on the project, which grants read access.
  3. Final Answer:

    The user has access because they have the viewer role on the project -> Option B
  4. Quick Check:

    Access GRANTED with viewer role = B [OK]
Hint: Look for 'access: GRANTED' and role in reasons [OK]
Common Mistakes:
  • Confusing GRANTED with denied access
  • Assuming access is limited to storage only
  • Thinking the output is an error
4. You run the Policy Troubleshooter but it returns an error saying the resource is invalid. What is the most likely cause?
medium
A. The project billing is not enabled
B. The user email is missing
C. The permission string is too long
D. The resource name is misspelled or uses wrong format

Solution

  1. Step 1: Analyze the error message about invalid resource

    An invalid resource error usually means the resource identifier is incorrect or malformed.
  2. Step 2: Check other options for relevance

    Missing user email or permission length issues cause different errors. Billing status does not affect resource validation.
  3. Final Answer:

    The resource name is misspelled or uses wrong format -> Option D
  4. Quick Check:

    Invalid resource error = wrong resource name [OK]
Hint: Check resource name format carefully for typos [OK]
Common Mistakes:
  • Assuming missing user email causes resource error
  • Blaming billing issues for resource validation
  • Ignoring resource format requirements
5. You want to verify if a user can delete objects in a Cloud Storage bucket using Policy Troubleshooter. Which combination of inputs should you provide?
hard
A. User email, permission storage.objects.list, and bucket resource name
B. User email, permission storage.buckets.create, and project ID
C. User email, permission storage.objects.delete, and bucket resource name
D. User password, permission storage.objects.delete, and bucket resource name

Solution

  1. Step 1: Identify the permission to check

    To check delete access on objects, use the permission storage.objects.delete.
  2. Step 2: Provide correct user and resource

    Use the user's email (not password) and the specific bucket resource name to check access.
  3. Final Answer:

    User email, permission storage.objects.delete, and bucket resource name -> Option C
  4. Quick Check:

    Correct permission and resource for delete check = D [OK]
Hint: Match permission exactly to action you want to check [OK]
Common Mistakes:
  • Using wrong permission for delete action
  • Providing user password instead of email
  • Using project ID instead of bucket resource
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard