unable to stop impersonation of an GCP Service Account

239 Views Asked by At

Weeks ago I've started impersonation of an ServiceAccount using gcloud auth activate-service-account command. Now I can't get back to my normal user account and every command I run is using impersonation, even gcloud config set project ... throws: WARNING: This command is using service account impersonation.

I tried gcloud auth login, gcloud init and more... Removed credentials.db file from .config/gcloud of my Linux home directory. The docs have nothing on a subject how to stop impersonation.

Does anyone know the proper command to stop impersonation?

2

There are 2 best solutions below

0
mr.TKO On

This might not be production-ready solution or there are better options, but it worked for me

  1. First try gcloud auth application-default login and follow instructions (browser will open) - it might help

If above didn't help for you, I did additional step before rerunning the command above:

  1. I've removed application default credentials from the config folder: `rm ~/.config/gcloud/application_default_credentials.json
  2. run again: gcloud auth application-default login
0
Paku On
  1. Remove service account impersontation config part from .config/gcloud/configurations/config_default

Might be different file in configurations if .config/gcloud/active_config is not set as default

  1. Delete .config/gcloud/application_default_credentials.json
  2. Run gcloud auth application-default login