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 my-playground


## List The Service Accounts ##

#gcloud iam service-accounts list --project my-playground


## Update the Service Account ##

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


## Disable and Enable Service Accounts ##

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

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


## Grant Service account an IAM Role ##

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


## Delete the Service Account ##

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


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@my-playground.iam.gserviceaccount.com


## List service account keys ##

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


## Delete service account keys ##

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

No comments:

Post a Comment