The `gcloud projects list` method might fail when you are obtaining the project number of a project with an ID that is a substring of another project, as the filter does a partial find not an entire find. I've found it better to use the describe method as follows gcloud projects describe "{PROJECT_ID}" --format="value(projectNumber)"
as it will target the exact project id.