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:
gcloud projects list
--format="table(projectId)"
02 The command output should return the requested GCP project ID(s):
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:
gcloud functions list
--project cc-bigdata-project-123123
--format="(NAME,REGION)"
04 The command output should return the requested function names and their regions:
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:
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:
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:
gcloud projects get-iam-policy cc-bigdata-project-123123
08 The command output should return the IAM policy configured for your GCP project:
bindings:
- members:
- serviceAccount:123412341234-compute@developer.gserviceaccount.com
- serviceAccount:123412341234@cloudservices.gserviceaccount.com
role: roles/editor
- members:
- user:email@domain.com
role: roles/owner
- 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: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. If the
roles/logging.logWriter role is not attached to the associated service account, Cloud Logging API can't write logs for the verified Google Cloud function due to insufficient permissions.
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.