Complete the code to assign the basic Viewer role to a user in GCP.
gcloud projects add-iam-policy-binding my-project --member='user:alice@example.com' --role=[1]
The basic Viewer role is roles/viewer, which grants read-only access.
Complete the code to assign the predefined Compute Admin role to a service account.
gcloud projects add-iam-policy-binding my-project --member='serviceAccount:my-sa@my-project.iam.gserviceaccount.com' --role=[1]
The Compute Admin role is roles/compute.admin, which allows full control of Compute Engine resources.
Fix the error in the custom role creation command by selecting the correct flag for the role ID.
gcloud iam roles create myCustomRole [1]='myCustomRoleId' --project=my-project --title='My Custom Role' --permissions=storage.buckets.get
The correct flag to specify the role ID when creating a custom role is --role-id.
Fill both blanks to create a custom role with the correct permissions and assign it to a user.
gcloud iam roles create myCustomRole --project=my-project --title='Custom Role' --permissions=[1] && gcloud projects add-iam-policy-binding my-project --member='user:bob@example.com' --role=[2]
The custom role is created with the permission storage.buckets.get and assigned using roles/myCustomRole.
Fill all three blanks to list all roles in a project, filter for custom roles, and describe one role.
gcloud iam roles list --project=my-project --filter='[1]' --format='value(name)' | grep '[2]' | xargs gcloud iam roles describe [3] --project=my-project
We filter roles by stage GA, grep for 'customRoles' to find custom roles, and describe the specific custom role by its full name.