0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

gcp asset exportをbigqueryに対してする際のエラー対処方法

Posted at

gcpのassetをBigQueryに出力する際に
assetを取得するプロジェクトと、出力先のBigQueryのプロジェクトが異なるとエラーが起きて、export出来ない

gcloud  asset export --project="プロジェクトA" --bigquery-table="projects/プロジェクトB/datasets/データセット名/tables/テーブル名" --content-type=resource

#以下のようなエラーが出る
ERROR: (gcloud.beta.asset.export) User [xxxxx@xxxxx] does not have permission to access project [プロジェクトA:exportAssets] (or it may not exist): The caller does not have permission

解決方法はこちらに書いてあった
https://cloud.google.com/asset-inventory/docs/faq#how_do_i_export_assets_to_tables_that_dont_belong_to_the_current_project

assetのexportをする際はassetのサービスアカウント(service-PROJECT_A_NUMBER@gcp-sa-cloudasset.iam.gserviceaccount.com)がBQのテーブルを作りに行く
そのため、プロジェクトAのassetのサービスアカウントにプロジェクトBのBigQueryのユーザ権限とデータ編集者権限をつけないといけない

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?