When I ssh to the vm, I want to run gcloud command, but shows error like this:
yclin1822@guruvm:~$ gcloud compute instances list
ERROR: (gcloud.compute.instances.list) Some requests did not succeed: – Insufficient Permission: Request had insufficient authentication scopes.
How can I solve it?
During the instance creation in "Access scopes" you used the Default option need to choose the "Allow full access to all Cloud APis" option.
Once you already created do the steps:
- stop the VM instance
- click in Edit , next in API access scopes select "Allow full access to all Cloud APis" and click in save
- Start instance and check please
Hope it helps.
One way this could happen is if you are trying to run the command from an SSH session within one of your VM’s.
Some commands (like creating a vm from Cloud Shell prompt as su) can only be run from a Cloud Shell from the GCP Console.
Is this type (insufficient auth scope) of error logged at any place (besides the screen) for investigation at a later time? I had a similar issue. I was following your example from the previous video, where VM is created using Cloud Shell with default access scope, then I sshed into the VM and was trying to delete it, which failed with similar auth error. I searched in stackdriver logging to see if there is more context around the error and I was not able to locate it.
Sankar, Stackdriver Logging won’t have the commands you run in an SSH session unless you do something to set that up. The startup stuff is logged because it is configured to show up in syslog, which is one of the things that the agent sends. If you have more questions, though, please post a new question. Comments like this tend to get lost and never answered–and furthermore, you don’t get any notifications for responses to them.