Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcloud auth activate-service-account logout / revoke / remove / unset

I,ve added my service-account successfuly using below command.

gcloud auth activate-service-account --key-file=mycredentialsialreadyhad.json

Now I can't remove or logout from it.

any help would be greatly appreciated.

edit: i tried this commands and got error

  1. gcloud auth revoke

ERROR: (gcloud.auth.revoke) Cannot revoke GCE-provided credentials.

  1. gcloud config configurations delete default

ERROR: (gcloud.config.configurations.delete) Deleting named configuration failed because configuration [default] is set as active. Use gcloud config configurations activate to change the active configuration.

edit2: this gcloud cli is on GCP ubuntu VM

like image 405
ashen madusanka Avatar asked Dec 10 '20 08:12

ashen madusanka


People also ask

How do I remove gcloud authentication?

If you want to delete the added or custom service account, go to IAM or Access > IAM, tick the checkbox of your added service account then click Remove to remove the access and fully remove it to your project.

How do I delete a service account in GCP?

Go to your Google Account. On the left navigation Panel, click Data & personalization. On the Download, delete, or make a plan for your data panel, click Delete a service or your account. On the Delete your Google Account panel, click Delete your account.


2 Answers

UPDATE

Try a command with a specified account because you can't revoke the Compute Engine service account(default).

For example:

gcloud auth revoke [email protected]

and run:

gcloud auth list

It should only display the default service account:

[PROJECT-NUMBER][email protected]

like image 63
JM Gelilio Avatar answered Sep 27 '22 19:09

JM Gelilio


Use the below syntax to activate the service account. Here we need to mention service account ID. gcloud auth activate-service-account [email protected] --key-file=xxxxxx.json --project=xxxxxx

Use the below syntax to revoke the service account: gcloud auth revoke [email protected]
Error encountered in your case because the service account ID was not mentioned in gcloud auth revoke command , which is trying to revoke your active google account.

Permissions are denied if you disable the service account instead of revoke. If you revoke the service account then default account will get activated and that might have permission to storage.

like image 43
Chandra Kiran Pasumarti Avatar answered Sep 27 '22 19:09

Chandra Kiran Pasumarti