Skip to content

Latest commit

 

History

History
37 lines (29 loc) · 1.18 KB

GCloud.md

File metadata and controls

37 lines (29 loc) · 1.18 KB

Google Cloud

#gcloud

Notes

# get configs
gcloud projects describe $(gcloud config list --format 'value(core.project)') --format 'value(name)'
gcloud projects describe $(gcloud config get-value project) --format 'value(name)'
gcloud info --format='value(config.paths.active_config_path)'
gcloud info --format='value(config.paths.sdk_root)'
gcloud config configurations list --filter='is_active=True' --format='value(name)'

# service accounts
gcloud iam service-accounts update {{ sa }} \
  --display-name "..." --description "..."  # update the description and the display name
gcloud iam service-accounts get-iam-policy {{ sa }}  # check the IAM policy for sa
gcloud iam service-accounts add-iam-policy-binding {{ sa }} \
  --member {{ email }} --role roles/{{ role }}  # add a user to the policy

How do I list the roles associated with a gcp service account?

gcloud projects get-iam-policy <YOUR GCLOUD PROJECT>  \
--flatten="bindings[].members" \
--format='table(bindings.role)' \
--filter="bindings.members:<YOUR SERVICE ACCOUNT>"

Configure ADC for Python:

gcloud auth application-default login
gcloud auth application-default set-quota-project common-billing-780115