Skip to content

Instantly share code, notes, and snippets.

@mjroeleveld
Last active December 9, 2022 15:16
Show Gist options
  • Save mjroeleveld/e834ef9eb857dfdf6e97a9567925d8ae to your computer and use it in GitHub Desktop.
Save mjroeleveld/e834ef9eb857dfdf6e97a9567925d8ae to your computer and use it in GitHub Desktop.
Restore default GCP service accounts
PROJECT=project
PROJECT_NUMBER=1343214123423
# GKE
gcloud projects add-iam-policy-binding $PROJECT --member=serviceAccount:service-$PROJECT_NUMBER@container-engine-robot.iam.gserviceaccount.com --role=roles/container.serviceAgent
gcloud projects add-iam-policy-binding $PROJECT --member=serviceAccount:service-$PROJECT_NUMBER@containerregistry.iam.gserviceaccount.com --role=roles/editor
# Compute
gcloud projects add-iam-policy-binding $PROJECT --member=serviceAccount:[email protected] --role=roles/editor
gcloud projects add-iam-policy-binding $PROJECT --member=serviceAccount:[email protected] --role=roles/compute.serviceAgent
# APIs
gcloud projects add-iam-policy-binding $PROJECT --member=serviceAccount:[email protected] --role=roles/editor
# Cloud Build
gcloud projects add-iam-policy-binding $PROJECT --member=serviceAccount:[email protected] --role=roles/cloudbuild.builds.builder
# App Engine
gcloud projects add-iam-policy-binding $PROJECT --member=serviceAccount:[email protected] --role=roles/editor
gcloud projects add-iam-policy-binding $PROJECT --member=serviceAccount:service-$PROJECT_NUMBER@gae-api-prod.google.com.iam.gserviceaccount.com --role=roles/appengineflex.serviceAgent
@gautamr
Copy link

gautamr commented Jun 13, 2020

This saves my day ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment