I'm looking to put together a script that I can run from Cloud Shell to enable an API in all projects. It is successfully going through each project, but I am getting a permission denied message for every one. I am the owner so there shouldn't be any permission issues.
As a permission test, if I run just "gcloud services enable cloudresourcemanager.googleapis.com", the API successfully enables.
What am I missing?
#!/bin/bash
for project in $(gcloud projects list --format="value(projectId)")
do
echo "ProjectId: $project"
for enableapi in $(gcloud services enable cloudresourcemanager.googleapis.com list --project $project --format=list)
do
echo " -> Enabled $enableapi"
done
done