Score:0

gcloud CLI command shows error INVALID_ARGUMENT when listing assets for project ID for some accounts

cn flag

I tried to run following command

gcloud scc assets list projects/project-id

and I got this error,

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

I have already updated gcloud SDK to the latest version (350.0.0)

John Hanley avatar
cn flag
My guess is that you have an IAM permission problem. 1) Run this command **gcloud info --run-diagnostics**. Any issues reported? 2) Run this command **gcloud scc assets list projects/project-id --verbosity=debug**. 3) Then try this level **gcloud scc assets list projects/project-id --log-http**.
Nihal Shantha avatar
cn flag
@JohnHanley when I run " gcloud info --run-diagnostics " command, i didn't get any issues. Both Network diagnostic and Property diagnostic were passed. after I run " gcloud scc assets list projects/project-id --log-http" command. then i got this error , "ERROR: (gcloud.scc.assets.list) Parent must match either [0-9]+, organization/[0-9]+, projects/.* or folders/.*.
John Hanley avatar
cn flag
The error message means that **projects/project-id** is invalid. The regular expression is `projects/.*` and I do not see an issue based upon your example. This is one example where I need to see the actual arguments you are using and the structure of your org. Without details, you will need Google Support. You can report this as a bug here: https://cloud.google.com/support/docs/issue-trackers
Nihal Shantha avatar
cn flag
@JohnHanley ok. Thank you.
Score:0
pe flag

Listing all assets

These examples show how to list all assets for an organization:

# ORGANIZATION_ID=12344321


 $ gcloud scc assets list $ORGANIZATION_ID

For more examples, run:


  $  gcloud scc assets list --help

Could you use the following commands:

NAME

gcloud alpha scc assets list - list Cloud Security Command Center assets

List all assets under project (example-project)


$  gcloud alpha scc assets list projects/example-project

OR

List all assets under organization (123456)


$  gcloud alpha scc assets list 123456

NOTES

This command is currently in ALPHA and may change without notice. If this command fails with API permission errors despite specifying the right project, you may be trying to access an API with an invitation-only early access allowlist. These variants are also available:


$  gcloud scc assets list


$  gcloud beta scc assets list

As per from the references you are trying to run a invalid command, if you wanna try with the same cli you have to add the alpha as parameter

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.