简体   繁体   English

为什么我需要 serviceusage.services.use 才能列出 BigQuery 数据集?

[英]Why do I require serviceusage.services.use in order to list BigQuery datasets?

I attempted to get a list of BigQuery datasets in a project using this command:我尝试使用以下命令获取项目中的 BigQuery 数据集列表:

gcloud alpha bq datasets list --project my-project

and it failed with error:它失败并出现错误:

ERROR: (gcloud.alpha.bq.datasets.list) User [me@mydomain.com] does not have permission to access projects instance [my-project] (or it may not exist): Caller does not have required permission to use project my-project.错误:(gcloud.alpha.bq.datasets.list)用户[me@mydomain.com]无权访问项目实例[my-project](或它可能不存在):调用者没有使用所需的权限项目我的项目。 Grant the caller the roles/serviceusage.serviceUsageConsumer role, or a custom role with the serviceusage.services.use permission, by visiting https://console.developers.google.com/iam-admin/iam/project?project=my-project and then retry.通过访问https://console.developers.google.com/iam-admin/iam/project?project=my-授予调用者角色/serviceusage.serviceUsageConsumer 角色或具有 serviceusage.services.use 权限的自定义角色项目,然后重试。

I granted myself the role:我授予自己这个角色:

gcloud projects add-iam-policy-binding my-project \
  --member=user:me@mydomain.com \
  --role=roles/serviceusage.serviceUsageConsumer

and then it worked:然后它起作用了:

➜ gcloud alpha bq datasets list --project my-project
ID                        LOCATION
msmg-my-project:dataset1  EU
msmg-my-project:dataset2  EU
msmg-my-project:dataset3  EU

What I don't understand is why this is required.我不明白为什么这是必需的。 Why do I require serviceusage.services.use in order to list BigQuery datasets?为什么我需要 serviceusage.services.use 才能列出 BigQuery 数据集?

UPDATE: This is the list of pre-defined roles that were already granted to me@mydomain.com:更新:这是已授予 me@mydomain.com 的预定义角色列表:

  • Access Context Manager Reader访问上下文管理器阅读器
  • Bigtable Viewer大表查看器
  • Browser浏览器
  • Cloud Asset Viewer云资产查看器
  • Error Reporting User错误报告用户
  • Logs Viewer日志查看器
  • Monitoring Dashboard Configuration Viewer监控仪表板配置查看器
  • Monitoring Viewer监控查看器
  • Organization Policy Viewer组织政策查看器
  • Security Reviewer安全审查员
  • Tech Support Editor技术支持编辑
  • Vertex AI Viewer顶点 AI 查看器

Plus one custom role that grants:加上一个自定义角色,授予:

  • bigquery.jobs.create bigquery.jobs.create
  • bigquery.jobs.list bigquery.jobs.list
  • bigquery.readsessions.create bigquery.readsessions.create
  • bigquery.readsessions.getData bigquery.readsessions.getData
  • bigquery.readsessions.update bigquery.readsessions.update
  • bigquery.savedqueries.get bigquery.savedquery.get
  • bigquery.savedqueries.list bigquery.savedqueries.list
  • datacatalog.tagTemplates.get datacatalog.tagTemplates.get
  • datacatalog.tagTemplates.getTag datacatalog.tagTemplates.getTag
  • datacatalog.taxonomies.get datacatalog.taxonomies.get
  • datacatalog.taxonomies.list datacatalog.taxonomies.list

I asked the same question to Google Support and the support technician replied with:我向 Google 支持人员提出了同样的问题,支持技术人员回答说:

when you try to use command-line with command as mentioned in the command “–project” indicates that it first tries to access the project to list the particular resources of that project, which requires roles/serviceusage.serviceUsageConsumer role当你尝试使用命令行时,命令“--project”中提到的命令表示它首先尝试访问项目以列出该项目的特定资源,这需要角色/serviceusage.serviceUsageConsumer 角色

Which I think explains why I am able to see datasets in the UI but not on the command-line我认为这解释了为什么我能够在 UI 中看到数据集,但不能在命令行中看到

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 BigQuery Explorer 列表中显示来自另一个项目的数据集? - How do I display datasets from another project in BigQuery Explorer list? 如何在 Google AppScript 中获取 BigQuery 数据集中的表列表 - How do I get the list of tables in my BigQuery dataset in a Google AppScript 我可以使用 GCP 中的 bigQuery 命令行工具进行 ETL 工作吗? - Can I use the bigQuery command line tool in GCP to do ETL work? 批量删除 BigTable 表和 BigQuery 数据集 - Batch delete BigTable tables and BigQuery datasets Dataprep 将数据集/表留在 BigQuery 中 - Dataprep is leaving Datasets/Tables behind in BigQuery 将单个项目中的 Google BigQuery 数据集导出为 bq 命令行中的列表? - Export Google BigQuery datasets in a single project as list in bq command-line? 什么时候以及为什么我应该使用 List.from 而不是 .toList()? - When and why should I use List.from instead of .toList()? 为什么我无法将复制的查询粘贴到 BigQuery? - Why am I not able to paste copied queries into BigQuery? 如何在 Cloudformation 中使用嵌套列表或附加到列表? - How do I use nested lists or append to a list in Cloudformation? 如何将 BigQuery 中的细分导入 Firebase? - How do I import segments from BigQuery into Firebase?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM