列出某些帐户的项目 ID 的资产时,gcloud cli 命令显示错误 INVALID_ARGUMENT

问题描述

gcloud cli 在我尝试为某些帐户运行此命令时抛出错误 INVALID_ARGUMENT。

gcloud scc assets list projects/project-id

这是我得到的确切错误

ERROR: (gcloud.scc.assets.list) INVALID_ARGUMENT: Request contains an invalid argument.

没有具体的方法可以解决任何文档中的问题究竟是什么..

解决方法

您使用的是哪个 SDK 版本?我刚刚测试了与您提到的相同的 gcloud 命令,没有任何问题。

gcloud 版本:

Google Cloud SDK 349.0.0
alpha 2021.07.19
beta 2021.07.19
bq 2.0.70
core 2021.07.19
gsutil 4.65

命令:

gcloud scc assets list projects/my-project-id
,

您似乎在使用 Security Command Center Legacy,根据官方 documentation 已禁用该功能。

Security Command Center Legacy(以前称为 Cloud Security Command Center)和 Event Threat Detection Legacy 已被永久禁用。有关升级到 Security Command Center Standard 或 Premium 的信息,请参阅从旧版 Security Command Center 产品迁移。要查询高级层的灵活定价选项,请填写我们的查询表。您应该会在两个美国工作日内收到回复。

我建议您将帐户迁移到 Security Command Center Standard or Premium