This page shows how to manage dataset-level policy insights, which are machine learning-based findings about permission usage for your BigQuery datasets. Policy insights can help you identify which principals have permissions that they don't need.
This page focuses on policy insights for datasets. Recommender also offers policy insights for the following resource types:
Dataset-level policy insights are sometimes linked to role recommendations. Role recommendations suggest actions that you can take to remediate the issues identified by dataset-level policy insights.
Before you begin
-
Enable the Recommender API.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles. - Be familiar with IAM role recommendations.
- Ensure that you have an organization-level or project-level activation of the Premium or Enterprise tier of Security Command Center. For more information, see Billing questions.
- Optional: Read about Recommender insights.
Required roles
To get the permissions that you need to manage dataset-level policy insights, ask your administrator to grant you the following IAM roles on your project:
- BigQuery Data Owner (
roles/bigquery.dataOwner) - IAM Recommender Admin (
roles/recommender.iamAdmin) -
Manage dataset-level policy insights with the gcloud CLI or REST API:
Service Usage Consumer (
roles/serviceusage.serviceUsageConsumer)
For more information about granting roles, see Manage access to projects, folders, and organizations.
These predefined roles contain the permissions required to manage dataset-level policy insights. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
The following permissions are required to manage dataset-level policy insights:
-
View dataset-level policy insights:
-
recommender.iamPolicyInsights.get -
recommender.iamPolicyInsights.list
-
-
Modify dataset-level policy insights:
recommender.iamPolicyInsights.update -
Manage dataset-level policy insights with the gcloud CLI or REST API:
serviceusage.services.use
You might also be able to get these permissions with custom roles or other predefined roles.
List dataset-level policy insights
To list all dataset-level policy insights for your project, use one of the following methods:gcloud
Use the gcloud recommender
insights list command to view all dataset-level policy insights for your
project.
Before you run the command, replace the following values:
PROJECT_ID: The ID of the project that you want to list insights for.LOCATION: The location of the datasets whose insights you want to list.
gcloud recommender insights list --insight-type=google.iam.policy.Insight \ --project=PROJECT_ID \ --location=LOCATION\ --filter="insightSubtype:PERMISSIONS_USAGE_BIGQUERY_DATASET"
The output lists all of the dataset-level policy insights for your project in the specified location. For example:
INSIGHT_ID CATEGORY INSIGHT_STATE LAST_REFRESH_TIME SEVERITY INSIGHT_SUBTYPE DESCRIPTION 101d03ad-6148-4628-943e-fcf1a3af6b57 SECURITY ACTIVE 2024-02-02T08:00:00Z LOW PERMISSIONS_USAGE_BIGQUERY_DATASET 0 of the permissions in this role binding were used in the past 90 days. 15133dd9-4cbc-41e9-8990-b189241676d8 SECURITY ACTIVE 2024-02-02T08:00:00Z LOW PERMISSIONS_USAGE_BIGQUERY_DATASET 0 of the permissions in this role binding were used in the past 90 days. 1590aeae-d5bf-4e3d-b7d5-e230212f5faf SECURITY ACTIVE 2024-02-02T08:00:00Z LOW PERMISSIONS_USAGE_BIGQUERY_DATASET 4 of the permissions in this role binding were used in the past 90 days. 280e5a14-4d09-4ac6-8e14-be7407611ad7 SECURITY ACTIVE 2024-02-02T08:00:00Z LOW PERMISSIONS_USAGE_BIGQUERY_DATASET 0 of the permissions in this role binding were used in the past 90 days. 34102078-085f-45d3-ae72-81da16c75781 SECURITY ACTIVE 2024-02-02T08:00:00Z LOW PERMISSIONS_USAGE_BIGQUERY_DATASET 10 of the permissions in this role binding were used in the past 90 days.
REST
The Recommender API's
insights.list
method lists all dataset-level policy insights for your
project.
Before using any of the request data, make the following replacements:
PROJECT_ID: The ID of the project that you want to list insights for.LOCATION: The location of the datasets whose insights you want to list.
HTTP method and URL:
GET https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/insightTypes/google.iam.policy.Insight/insights?filter=insightSubtype%20%3D%20PERMISSIONS_USAGE_BIGQUERY_DATASET
To send your request, expand one of these options: