mirror of
https://github.com/88lex/sa-gen.git
synced 2025-02-20 21:53:01 +08:00
initialize sa-gen
This commit is contained in:
parent
8a70e71afe
commit
d404213e3d
1 changed files with 18 additions and 0 deletions
18
sa-gen
Normal file
18
sa-gen
Normal file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
#forked from DashLt at https://gist.github.com/DashLt/4c6ff6e9bde4e9bc4a9ed7066c4efba4 and
|
||||
#forked from mc2squared at https://gist.github.com/mc2squared/01c933a8172a26af88285610a0e5af8d
|
||||
# requires gcloud command line tools; go to https://cloud.google.com/sdk/docs/quickstarts to get them
|
||||
# max 100 service accounts per project
|
||||
# run gcloud init --console-only first and select a project
|
||||
# Create a folder for your keys before running the script
|
||||
KEYS_DIR=/opt/sa-gen/keys
|
||||
COUNT=1
|
||||
for name in sagen{1..100}; do
|
||||
echo creating service account for $name
|
||||
gcloud iam service-accounts create $name
|
||||
done
|
||||
for name in $(gcloud iam service-accounts list --format='value(email)'); do
|
||||
echo Creating $COUNT.json for service account $name
|
||||
gcloud iam service-accounts keys create $KEYS_DIR/$COUNT.json --iam-account=$name
|
||||
let COUNT+=1
|
||||
done
|
Loading…
Reference in a new issue