【发布时间】:2026-01-19 11:40:01
【问题描述】:
每次我在云计算实例上使用 bq 时,都会得到以下信息:
/usr/local/share/google/google-cloud-sdk/platform/bq/third_party/oauth2client/contrib/gce.py:73: UserWarning: You have requested explicit scopes to be used with a GCE service account.
Using this argument will have no effect on the actual scopes for tokens
requested. These scopes are set at VM instance creation time and
can't be overridden in the request.
warnings.warn(_SCOPES_WARNING)
这是 Debian 8 中 f1 中的默认 micro。我授予此实例对所有云 API 的访问权限,并且它的服务帐户也是项目的所有者。我运行gcloud init。但是这个错误仍然存在。
有什么问题吗?
【问题讨论】:
-
只是为了确认一下,您在 bq 中使用了“--use_gce_service_account”标志,对吧?您是否指定了任何其他标志?
-
@MichaelSheldon 我没有指定标志。即使是简单的
bq ls也会以警告结尾。bq help没有。 -
您一定已经告知
bq要使用哪些凭据...您是否使用通过gcloud auth指定的应用程序默认凭据? -
@MichaelSheldon 我为默认的
...-compute@...服务帐户做了gcloud init。此外,bq确实有效,但每次都提到此警告。 -
感谢您的澄清!我不确定这个警告是否不好,因为 bq 需要某些范围,这些范围可能已在容器中配置,也可能未配置。在您的情况下,它们显然配置正确。但如果不是,此警告可能会帮助某人调试情况。
标签: google-bigquery google-compute-engine google-cloud-platform