Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google cloud platform gcloud-没有任何API的权限,即使我是所有者并且可以通过web UI正常工作_Google Cloud Platform_Gcloud - Fatal编程技术网

Google cloud platform gcloud-没有任何API的权限,即使我是所有者并且可以通过web UI正常工作

Google cloud platform gcloud-没有任何API的权限,即使我是所有者并且可以通过web UI正常工作,google-cloud-platform,gcloud,Google Cloud Platform,Gcloud,我是我新创建的组织的所有者,我在该组织下创建了一个项目,并将其链接到我有1000美元信用的组织账单帐户。通过web UI,我能够启动集群、虚拟机、网络。。。但当我想通过gcloud这样做时,我的权限被拒绝了。例如: $ gcloud compute networks list API [compute.googleapis.com] not enabled on project [XXX]. Would you like to enable and retry (this will take

我是我新创建的组织的所有者,我在该组织下创建了一个项目,并将其链接到我有1000美元信用的组织账单帐户。通过web UI,我能够启动集群、虚拟机、网络。。。但当我想通过gcloud这样做时,我的权限被拒绝了。例如:

$ gcloud compute networks list
API [compute.googleapis.com] not enabled on project [XXX]. 
Would you like to enable and retry (this will take a few minutes)? 
(y/N)?  y

ERROR: (gcloud.compute.networks.create) PERMISSION_DENIED: The caller does not have permission
但我可以在web UI GCP中看到API已明确启用(并且可以使用),只是gcloud不允许我使用它们。gcloud下的帐户与我在web控制台中使用的帐户完全相同-由
gcloud auth list
验证,并且:

$ gcloud config configurations describe myproject
is_active: true
name: myproject
properties:
  compute:
    region: europe-west1
    zone: europe-west1-b
  core:
    account: <my-email>
    project: <the-project-I-want>


^上面的
PROJECT\u ID
显示了我所在组织的ID,而不是该组织下的实际项目。

因此,问题是当
gcloud config set PROJECT
和gcloud出于某种原因默认为组织时,我使用了错误的
PROJECT\u ID


因此,我必须使用
gcloud projects list
找到正确的项目id,然后使用
gcloud config set project{project-id}
不是项目名称!)

执行
gcloud auth list
。验证活动帐户(带星号)是否为您授予自己所有者权限的帐户。您还可以执行
gcloud auth login
来指定要使用的凭据。使用与登录谷歌云控制台相同的设置。我知道你在问题中提到了
gcloud auth list
,但你显然忽略了使用
gcloud
和你的凭据设置的内容。是的,
gcloud auth list
中的星号标记
ACTIVE
与我在GCP IAM中看到的电子邮件地址完全相同,其中该(唯一)帐户标记为
Owner
。顺便说一句,
gcloud projects list
返回此组织的适当项目,因此某些通信必须正常进行,因为API不起作用。请使用登录到谷歌云控制台的相同凭据运行
gcloud auth login
。您认为正在使用的凭据不是
gcloud
实际使用的凭据-前提是您对凭据的权限实际上是正确的。您可能只想运行
gcloud init
重置所有内容并重新创建您的授权。因此,不幸的是,它没有完全起作用
gcloud init
再次使
gcloud服务列表
工作,但不工作,例如创建网络。但我注意到这可能是可疑的:
API[compute.googleapis.com]没有在项目[{project_ID}上启用-该项目ID与实际项目不对应,而是与组织对应。即使我做了
gcloud config set项目
,它可能仍在尝试在组织上工作?我更新了我的问题。太好了-我很高兴你解决了这个问题。你的问答应该帮助别人。难以置信的人!就是这样!
$ gcloud services list
ERROR: (gcloud.services.list) User [<myusername>] does not have permission to access project [myproject] (or it may not exist): The caller does not have permission
$ gcloud services list
NAME                              TITLE
bigquery-json.googleapis.com      BigQuery API
cloudapis.googleapis.com          Google Cloud APIs
clouddebugger.googleapis.com      Stackdriver Debugger API
cloudtrace.googleapis.com         Stackdriver Trace API
compute.googleapis.com            Compute Engine API
container.googleapis.com          Kubernetes Engine API
containerregistry.googleapis.com  Container Registry API
datastore.googleapis.com          Cloud Datastore API
logging.googleapis.com            Stackdriver Logging API
monitoring.googleapis.com         Stackdriver Monitoring API
oslogin.googleapis.com            Cloud OS Login API
pubsub.googleapis.com             Cloud Pub/Sub API
servicemanagement.googleapis.com  Service Management API
serviceusage.googleapis.com       Service Usage API
sql-component.googleapis.com      Cloud SQL
storage-api.googleapis.com        Google Cloud Storage JSON API
storage-component.googleapis.com  Google Cloud Storage
$ gcloud compute networks create testing-net --subnet-mode=custom '--description=Network to host testing kubernetes cluster'

API [compute.googleapis.com] not enabled on project [{PROJECT_ID}]. 
Would you like to enable and retry (this will take a few minutes)? 
(y/N)?  y

ERROR: (gcloud.compute.networks.create) PERMISSION_DENIED: The caller does not have permission