Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcloud compute list networks error: "Some requests did not succeed: - Insufficient Permission"

I have created a project and setup a Windows 2012 VM. I am trying to list the networks in the project. Here are the steps I performed:

Initially, I logged into the VM as per the credentials created when creating the VM. From there, opened the Google Cloud SDK Shell (As Administrator) Next, I set the project name as follows:

C:\windows\system32> gcloud config set project <proj-name>

Then, I tried to list the networks (should only be one - default). Here is the error relating to permission.

C:\windows\system32> gcloud compute networks list
NAME IPV4_RANGE GATEWAY_IPV4
ERROR: (gcloud.compute.networks.list) Some requests did not succeed:
 - Insufficient Permission
like image 281
etak Avatar asked Nov 28 '22 10:11

etak


2 Answers

This is a problem with the permissions of the credentials of the created Virtual Machine.

To work around, you can use gcloud auth login and log into your Google account via the browser. You may also create a service account in the Cloud Console and load it onto the machine, then activate using gcloud auth activate-service-account.


This issue is easiest to see in the Cloud Console. Navigate to the instance page for this VM; you'll see something like:

Permissions for VM, showing "Compute" set to "Disabled"

Note that "Compute" is set to "Disabled".

To change these permissions when creating a new VM instance in the Cloud Console, expand the "Management, disk, networking, access & security options" view:

Management, disk, networking, access & security options

Then, navigate to "Access & security" and change the permissions for "Compute":

Set Permissions

This will create the new Virtual Machine that has read access to your project's Google Compute Engine settings.


To create a new instance using gcloud, add the following flag to gcloud compute instances create:

--scopes "https://www.googleapis.com/auth/compute.readonly"

You'll need to add any additional permissions you'd like, as well.

like image 97
Zachary Newman Avatar answered Apr 23 '23 22:04

Zachary Newman


First use gcloud auth login command to authenticate and get credentials for the tool.

like image 30
Kamran Avatar answered Apr 23 '23 23:04

Kamran