1 – Create your service account programmatic access on Google Cloud
IAM & Administration -> Service Accounts -> Create New Service Account -> Keys -> Add Keys
2 – Choose json as output
3 – Activate it with the command below
gcloud auth activate-service-account --key-file="~/gcloud.json"
4 – To check, you can use this command
$ gcloud auth list
Credentialed Accounts
ACTIVE ACCOUNT
* devops@devopsclick-132321.iam.gserviceaccount.com
5 – If you have multiple accounts, you can switch between them using
$ gcloud config set account ACCOUNT