2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

"gcloud iam service-accounts keys create" を実行すると "FAILED_PRECONDITION: Precondition check failed." が発生

Posted at

概要

gcloudコマンドでサービスアカウントのキーを生成しようとしたところ、FAILED_PRECONDITION: Precondition check failed.というエラーが発生した。
具体的な原因を示してくれず不親切だが、結果的に発行可能なキーの上限に達していたのが原因だった。

実行したコマンド

# サービスアカウントのEmailアドレス
GCP_SA_EMAIL=sa-name@project-id.iam.gserviceaccount.com
# サービスアカウントの認証情報を保存するファイル
GCP_SA_KEY_FILE=key-file.json
# サービスアカウントのキーを生成
gcloud iam service-accounts keys create $GCP_SA_KEY_FILE \
  --iam-account=$GCP_SA_EMAIL

発生したエラー

ERROR: (gcloud.iam.service-accounts.keys.create) FAILED_PRECONDITION: Precondition check failed.

原因

サービスアカウントに対して発行可能なキーの上限10個に到達している。

以下の通り、公式ドキュメントにも記載がある。

サービス アカウントには最大 10 個のキーを設定できます。

対処方法

クラウドコンソールにログインして、

  • IAM と管理 > サービス アカウント > (対象のサービスアカウントを開く) > キー

にアクセスして、不要なキーを削除して9個以下にする。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?