File: //snap/google-cloud-cli/396/help/man/man1/gcloud_iam_service-accounts_keys_create.1
.TH "GCLOUD_IAM_SERVICE\-ACCOUNTS_KEYS_CREATE" 1
.SH "NAME"
.HP
gcloud iam service\-accounts keys create \- create a service account key
.SH "SYNOPSIS"
.HP
\f5gcloud iam service\-accounts keys create\fR \fIOUTPUT\-FILE\fR \fB\-\-iam\-account\fR=\fIIAM_ACCOUNT\fR [\fB\-\-key\-file\-type\fR=\fIKEY_FILE_TYPE\fR;\ default="json"] [\fIGCLOUD_WIDE_FLAG\ ...\fR]
.SH "DESCRIPTION"
If the service account does not exist, this command returns a
\f5PERMISSION_DENIED\fR error.
.SH "EXAMPLES"
To create a new service account key and save the private portion of the key
locally, run:
.RS 2m
$ gcloud iam service\-accounts keys create key.json \e
\-\-iam\-account=my\-iam\-account@my\-project.iam.gserviceaccount.com
.RE
.SH "POSITIONAL ARGUMENTS"
.RS 2m
.TP 2m
\fIOUTPUT\-FILE\fR
The path where the resulting private key should be written. File system write
permission will be checked on the specified path prior to the key creation.
.RE
.sp
.SH "REQUIRED FLAGS"
.RS 2m
.TP 2m
\fB\-\-iam\-account\fR=\fIIAM_ACCOUNT\fR
The service account for which to create a key.
To list all service accounts in the project, run:
.RS 2m
$ gcloud iam service\-accounts list
.RE
.RE
.sp
.SH "OPTIONAL FLAGS"
.RS 2m
.TP 2m
\fB\-\-key\-file\-type\fR=\fIKEY_FILE_TYPE\fR; default="json"
The type of key to create. \fIKEY_FILE_TYPE\fR must be one of: \fBjson\fR,
\fBp12\fR.
.RE
.sp
.SH "GCLOUD WIDE FLAGS"
These flags are available to all commands: \-\-access\-token\-file, \-\-account,
\-\-billing\-project, \-\-configuration, \-\-flags\-file, \-\-flatten,
\-\-format, \-\-help, \-\-impersonate\-service\-account, \-\-log\-http,
\-\-project, \-\-quiet, \-\-trace\-token, \-\-user\-output\-enabled,
\-\-verbosity.
Run \fB$ gcloud help\fR for details.
.SH "NOTES"
The option \-\-key\-file\-type=p12 is available here only for legacy reasons;
all new use cases are encouraged to use the default 'json' format.
These variants are also available:
.RS 2m
$ gcloud alpha iam service\-accounts keys create
.RE
.RS 2m
$ gcloud beta iam service\-accounts keys create
.RE