How to give service account access to two projects?

假装没事ソ 提交于 2020-08-10 19:19:23

问题


Using Google Cloud, there exists a BigQuery View table that queries two projects.

However, on the project where the view is located, we wish to run a query against it from Airflow/Composer. Currently it fails with a 403.

AFAIK it will use the default composer service account - however it doesn't have access to the 2nd project used in the sql of the view.

How do I give composer's service account access to the second project?


回答1:


Think about a service account like a user account: you have a user email that you authorize on different project and component. Exactly the same thing with the service account email.

The service account belongs to a project. An user account belongs to a domain name/organisation. No real difference at the end.

So, you can use a service account email like any user accounts:

  • Grant authorization in any project
  • Add it in Google Groups
  • Even grant it viewer or editor role on GSuite document (Sheet, Docs, Slides,...) to allow it to access and to read/update these document!! Like any users!

EDIT

With Airflow, you can defined connexions and a default connexion. You can use this connexion in your DAG and thus use the service account that you want.




回答2:


I think you have to add the service account into project IAM.



来源:https://stackoverflow.com/questions/62933850/how-to-give-service-account-access-to-two-projects

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!