GCP: Service Account gcloud cli

 ### Creating and Managing Service Accounts Using gcloud command-line ###

Ref Link: creating-managing-service-accounts

## Craeet Service account ##

#gcloud iam service-accounts create cmd-svc-accnt --description="Command Line Service Account" --display-name="Command Line Account" --project playground-s-11-c6c6f490


## List The Service Accounts ##

#gcloud iam service-accounts list --project playground-s-11-c6c6f490


## Update the Service Account ##

#gcloud iam service-accounts update  cmd-svc-accnt@playground-s-11-c6c6f490.iam.gserviceaccount.com --description="Command Line Service Account" --display-name="Chamge Command Line Account"  --display-name "Change Command Line Account" --project playground-s-11-c6c6f490


## Disable and Enable Service Accounts ##

#gcloud iam service-accounts disable cmd-svc-accnt@playground-s-11-c6c6f490.iam.gserviceaccount.com --project playground-s-11-c6c6f490

#gcloud iam service-accounts enable cmd-svc-accnt@playground-s-11-c6c6f490.iam.gserviceaccount.com --project playground-s-11-c6c6f490


## Grant Service account an IAM Role ##

#gcloud projects add-iam-policy-binding playground-s-11-c6c6f490 --member="serviceAccount:cmd-svc-accnt@playground-s-11-c6c6f490.iam.gserviceaccount.com" --role="roles/editor"


## Delete the Service Account ##

#gcloud iam service-accounts delete cmd-svc-accnt@playground-s-11-c6c6f490.iam.gserviceaccount.com --project playground-s-11-c6c6f490


Ref Link: creating-managing-service-account-keys

## Create service account keys ##

#gcloud iam service-accounts keys create key-file.json --iam-account=cmd-svc-accnt@playground-s-11-c6c6f490.iam.gserviceaccount.com


## List service account keys ##

#gcloud iam service-accounts keys list --iam-account cmd-svc-accnt@playground-s-11-c6c6f490.iam.gserviceaccount.com


## Delete service account keys ##

gcloud iam service-accounts keys delete 96b194863bedad164f9d3001a128f70fd469d0a1 --iam-account cmd-svc-accnt@playground-s-11-c6c6f490.iam.gserviceaccount.com

No comments:

Post a Comment