错误:(gcloud.services.enable)用户没有访问项目的权限(或者它可能不存在):调用者没有权限 [英] ERROR: (gcloud.services.enable) User does not have permission to access project (or it may not exist): The caller does not have permission

查看:167
本文介绍了错误:(gcloud.services.enable)用户没有访问项目的权限(或者它可能不存在):调用者没有权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个可以从Cloud Shell运行的脚本,以在所有项目中启用API.它正在顺利地完成每个项目,但是我收到了每个项目的权限被拒绝的消息.我是所有者,因此不应有任何许可问题.

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.

作为权限测试,如果我仅运行"gcloud服务启用cloudresourcemanager.googleapis.com",则该API将成功启用.

As a permission test, if I run just "gcloud services enable cloudresourcemanager.googleapis.com", the API successfully enables.

我想念什么?

#!/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

推荐答案

卢卡斯,这种方式可以工作:

Lucas, this way could work:

#!/bin/bash
for project in  $(gcloud projects list --format="value(projectId)")
do
    echo "ProjectId:  $project"
    gcloud config set project $project
    gcloud services enable cloudresourcemanager.googleapis.com  --project $project
done

我正在关注此文档.

这篇关于错误:(gcloud.services.enable)用户没有访问项目的权限(或者它可能不存在):调用者没有权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆