403错误试图在BigQuery中创建计划查询,声称服务帐户没有许可,但它确实有限 我测试所需的权限以在BigQuery上创建计划的查询。 预定查询将在Project1中使用服务帐户进行编程(sa1@project1.iam.gserviceaccou ...

问题描述 投票:0回答:0
)在

[email protected]

中编程中的查询。 预定查询将以另一个服务帐户从

project2

[email protected]
)。
我授予以下角色:
to管理
服务帐户用户
to

[email protected]

target数据集(

project1
    )上的bigquery数据编辑器
  • to bigquery job用户to
    [email protected]
    bigquery Resource查看器to组织(因为查询使用
  • [email protected]
  • 视图) 连接到
    [email protected]
    (该项目中的目标数据集)时,我运行以下内容。 我还尝试使用Terraform实现同样的问题,并使用相同的错误消息。
    test_dataset
    我得到以下输出:
  • [email protected] 错误是一个谎言,因为
    project1
    具有
    服务帐户用户
  • [email protected]
  • 中的角色,并且此角色包括region-us.INFORMATION_SCHEMA.JOBS_BY_ORGANIZATION许可。
    我在这里错过了什么?
    GCP支持使我发疯,根本没有帮助。
    
    (已更改了服务帐户,数据集和项目名称)
        
  • 最终,Google的支持指导了我答案。
    project1
    约束(组织策略)是
    (默认情况下),这使我无法将服务帐户从
  • gcloud config set auth/impersonate_service_account [email protected] bq mk \ --transfer_config \ --target_dataset=test_dataset \ --display_name='test bq scheduled query' \ --params='{"destination_table_template":"test_jobs", "write_disposition":"WRITE_APPEND", "query":"SELECT job_id FROM `region-us.INFORMATION_SCHEMA.JOBS_BY_ORGANIZATION` WHERE DATE_TRUNC(creation_time, DAY) = '2025-01-22'"}' \ --data_source=scheduled_query \ [email protected]
附加到

Updated property [auth/impersonate_service_account]. WARNING: This command is using service account impersonation. All API calls will be executed as [[email protected]]. BigQuery error in mk operation: Requesting user [email protected] does not have iam.serviceAccounts.actAs permission to act as service account [email protected]

的资源。
I将约束设置为

[email protected]
中的

,我能够成功执行命令。
错误消息非常误导,日志也没有暗示限制。
    

google-cloud-platform google-bigquery service-accounts google-cloud-iam
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.