I am trying to execute gsutil commands in Windows11 CLI.
I am providing you the command and relevant error:
gsutil ls
ServiceException: 401 Anonymous caller does not have storage.buckets.list access to the Google Cloud project. Permission 'storage.buckets.list' denied on resource (or it may not exist).
gsutil mb [BUCKET NAME]
Creating [BUCKET NAME]...
You are attempting to access protected data with no configured
credentials. Please visit https://cloud.google.com/console#/project
and sign up for an account, and then run the "gcloud auth login"
command to configure gsutil to use these credentials.
Note: I have tired this after executing gcloud auth login
and the login was successful.
My IAM admin roles has the following storage permissions:
I am not sure what have been done with this and the entire things works fine in the google console. Can anyone helps me in solving this issue.
Thank you in advance to those who lend a hand with this.
Things I tried:
gcloud init
gcloud auth login
-> Successfulgsutil command
-> FailedThe problem is simple, I tried to look into my gcloud
configuration.
gcloud config list
Output
[accessibility]
screen_reader = True
[compute]
region = us-central1
zone = us-central1-c
[core]
account = [ACCOUNT]
disable_usage_reporting = False
pass_credentials_to_gsutil = False
project = [PROJECT_ID]
The pass_credentials_to_gsutil
was set to False
and I changed it into True
using the following command.
gcloud config set pass_credentials_to_gsutil True
Voila, now able to list and create buckets from my Windows11 CLI.