01 Run projects list command (Windows/macOS/Linux) with custom query filters to list the ID of each project available in your Google Cloud Platform (GCP) account:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
gcloud projects list
--format="table(projectId)"
02 The command output should return the requested GCP project ID(s):
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
PROJECT_ID
cc-bigdata-project-123123
cc-iot-app-project-112233
03 Run functions list command (Windows/macOS/Linux) using the ID of the GCP project that you want to examine as the identifier parameter and custom query filters to describe the name and the region of each Google Cloud function deployed within the selected project:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
gcloud functions list
--project cc-bigdata-project-123123
--format="(NAME,REGION)"
04 The command output should return the requested function names and their regions:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
NAME REGION
cc-web-app-function us-central1
cc-stream-function us-central1
05 Run functions describe command (Windows/macOS/Linux) using the name of the Google Cloud function that you want to examine as the identifier parameter, to describe the identifier (ID) of the service account associated with the selected function:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
gcloud functions describe cc-web-app-function
--region=us-central1
--format="value(serviceConfig.serviceAccountEmail)"
06 The command output should return the requested service account ID:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
123412341234-compute@developer.gserviceaccount.com
07 Run projects get-iam-policy command (Windows/macOS/Linux) to describe the IAM policy defined for the Google Cloud project used to managed your functions:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
gcloud projects get-iam-policy cc-bigdata-project-123123
08 The command output should return the IAM policy configured for your GCP project:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
bindings:
- members:
- serviceAccount:123412341234-compute@developer.gserviceaccount.com
role: roles/editor
- members:
- serviceAccount:123412341234-compute@developer.gserviceaccount.com
role: roles/viewer
- members:
- serviceAccount:service-123412341234@gcp-sa-pubsub.iam.gserviceaccount.com
role: roles/pubsub.serviceAgent
- members:
- serviceAccount:service-123412341234@serverless-robot-prod.iam.gserviceaccount.com
role: roles/run.serviceAgent
- members:
- serviceAccount:123412341234-compute@developer.gserviceaccount.com
- user:user@domain.com
role: roles/owner
- members:
- serviceAccount:service-123412341234@gcp-sa-vpcaccess.iam.gserviceaccount.com
role: roles/vpcaccess.serviceAgent
etag: ABCD1234ABCD
version: 1
Check the roles attached to the service account associated with your function, returned at step no. 6, to determine if the selected identity is using basic roles. If one of the following managed roles:
roles/owner,
roles/editor, and
roles/viewer is assigned to the service account associated with your function, the selected Google Cloud function is configured with basic roles.
09 Repeat steps no. 5 - 8 for each Google Cloud function created for the selected GCP project.
10 Repeat steps no. 3 – 9 for each GCP project deployed in your Google Cloud account.