How to map permissions to roles - google-bigquery

Permission denied. Please get bigquery.jobs.listExecutionMetadata or bigquery.jobs.listAll permission at organisation level to access Admin Resource Charts.
I am getting the above error while trying to access the Monitoring dashboard in BigQuery.
Question: How do I find which role has these permissions so that role can be assigned to principle ?
Thanks in advance for your help

You need to set the roles at the organization level. Applying it to the organization level means that you provide permission to access all of a project’s BigQuery resources. These roles are used on the organization level because BigQuery Monitoring requires it.
The predefined roles that BigQuery has with these permissions are:
bigquery.jobs.listExecutionMetadata
bigquery.jobs.listAll
BigQuery Admin
BigQuery Resource Admin
BigQuery Resource Editor
BigQuery Resource Viewer
On the other hand, if you have these roles and BigQuery Monitoring is sending you the same error you probably have the roles set at a project level, applying it to a project level means that it will have only access to that project.
These are the required permissions to use BigQuery Monitoring. See this to know how to grant permissions at organization level.
Additionally, you can see all the BigQuery Roles in this document.

Related

Permissions for access to Bigquery Project-Id

When we're working on different projects in bigquery, we're changing project-id from the top panel. We need to get "Bigquery Admin" permission so we can make this choice from above, but we want to keep these permissions to a minimum, so what can we do?
We've discovered this document, but we don't know which roles are meant to be enough for us. We just don't expect to be able to question the data and keep the query costs on the customer.
Is there a quick way to get this permission? Does the user need to define manual by these roles? Is there a practical way we can get "Bigquery Admin"?
Just a quick refresher, in this GCP Documentation:
Permissions determine what operations are allowed on a resource.
A role is a collection of permissions. You cannot grant a permission to the user directly. Instead, you grant them a role. When you grant a role to a user, you grant them all the permissions that the role contains.
So Bigquery Admin is already a predefined role. You can just assign this role to an authenticated principal to access Bigquery resources on a certain project.

Does service account need BQ job user role in the same project as datasets it will query?

My GCP expert tells me that my SA only needs data viewer role in the project in which the datasets I want to query are and that as long as it has job user role in any other project the query job should work.
But when I run the query I get this error:
google.api_core.exceptions.Forbidden: 403 POST https://bigquery.googleapis.com/bigquery/v2/projects/... : Access Denied: Project ... : User does not have bigquery.jobs.create permission in project ....
So does the SA need BQ job user role in exactly the same project where the datasets are?
Your GCP expert is correct!
as long as it has job user role in any other project ...
You just need to make sure you are running the job from within the project where that SA has job user role. This project will be billed for the cost of running job
In order to avoid the error you are facing, it is necessary to have the bigquery.jobs.create permission, as you can see in the error. You have two options:
1.- Create a custom role with such a permission.
2.- Add the BigQuery Job User or BigQuery User role. Both of them have the bigquery.jobs.create permission you need.

BigQuery dataset level access control via IAM

Issue: In GCP IAM I have >30 users assigned the pre-defined roles BigQuery Data Viewer and BigQuery Data Editor, and now when I create a new dataset, it's automatically accessible to these 30+ users because of "policy inheritance".
Question: As BQ project admin, I want a newly created dataset only accessible to certain users (a small subset of the 30+ users). What's the best approach to do this? Thanks!
You cannot override the permissions granted at higher leves. So, if you want to restrict access at dataset level, the best approach would be to:
1) Remove the current permissions BigQuery Data Viewerand BigQuery Data Editor from project level.
2) Grant the permissions again, but only at dataset level
This also complies with the recommended best practice of least privilege. Also, if possible, use groups to grant the permissions, as it will be easier to manage.
In addition to this, you could use another project to create the dataset and allow access to the desired subset of users; however, I wouldn't recommend this approach as it only makes more difficult to handle the data and the users with access to them.

Google Big Query : How to get the authorization to change the authorizations on Data Sets

I would like to add a member (xxxxxxx#developer.gserviceaccount.com) in the list of members that are allowed to read the tables in a data set.
However, when in the Big Query console, when I click on SHARE DATASET , I have the message :
**"You don't have permission to edit the permissions of the selected resource "****
However, I have the permission to use the query editor and to run queries on this Data Set.
How can I add a member to the list of members who can read this DATA SET so that to access to this Data Set through a Virtual Machine ?
The error message you are receiving is because you do not have the required permissions associated with your account to share a Dataset with another member.
In order to do this, you(if possible), or an admin of the project, i.e., someone with project editor or project owner role assigned. Will need to assign the needed permissions to allow you to share datasets.
You can see all the available permissions in this document Predefined roles and permissions
For a comprehensive document dealing with controlling access to Datasets review this document Controlling access to datasets
As long as you have the appropriate roles/permissions you should have no problems sharing BigQuery Datasets

Grant User only access to use SQL Admin (read only) without accessing SQL DB content?

Our SQL administrator is currently ill and in the hospital however we have an upcoming security audit from the SQL cluster. Therefore we would like to grant the security auditor now read only access so that he can see all settings (primary which DB has which settings and which users are created). But the auditor shouldn´t have any rights to access DB content. Could that be performed? If yes how?
As Per my understanding you are looking for this solution where you want only definition access to user not the data reader operation access.
If this is the case then You can do it using GRANT Schema Permissions (Transact-SQL)
The VIEW DEFINITION permission lets a user see the metadata of the securable on which the permission is granted. However, VIEW DEFINITION permission does not confer access to the securable itself. For example, a user that is granted only VIEW DEFINITION permission on a table can see metadata related to the table in the sys.objects catalog view. However, without additional permissions such as SELECT or CONTROL, the user cannot read data from the table.
For more details go through the link
For grant access to different functionality of SQL Server you can go through the following link
GRANT PERMISSION