Overview
The Formal Connector enables secure access to BigQuery. When domain-wide delegation is enabled, it can impersonate users in your organization, ensuring proper access control and audit logging of all BigQuery operations.Differences with other technologies
The connection to BigQuery differs from other technologies in two important ways:- No Native Users: Unlike Postgres or HTTP, Formal native users are not supported for BigQuery currently. Instead, the connector uses Google ADC to connect to BigQuery.
- Automatic Impersonation: When domain-wide delegation is configured, the Connector will automatically impersonate detected end users for BigQuery requests.
Setup
1. Configure Domain-wide Delegation
Before creating a BigQuery resource in Formal, you’ll need a service account with domain-wide delegation enabled in your Google Workspace. This step must be done by an admin user of your Google organization. Start by creating a service account in your Google Cloud Console if you don’t have one already, then enable domain-wide delegation:- Go to your Google Workspace Admin Console
- Navigate to Security > Access and data control > API Controls > Manage domain-wide delegation.
- Click Add New:
- Client ID: Your service account’s client ID
- OAuth Scopes:
https://www.googleapis.com/auth/bigqueryhttps://www.googleapis.com/auth/cloud-platform
- Click Authorize
2. Create a BigQuery Resource
To create a BigQuery Resource in Formal, follow these steps:- Navigate to the Resources page.
- Click on the “Create Resource” button.
- Fill in the required fields:
- Technology: Select
BigQueryfrom the dropdown - Resource Friendly Name: Enter a name of your choice to identify this resource
- Hostname: Enter
bigquery.googleapis.com - Port: Enter
443if your Connector has TLS certificates enabled, anything else otherwise (e.g.7777)
- Technology: Select
- Click on the
Createbutton to complete the resource creation.
3. Connect to BigQuery
The last step before querying BigQuery is to deploy your Formal Connector using your service account credentials. The connector uses Google ADC to detect the service account credentials and connect to BigQuery. Once your Formal Connector is set up, you can connect to BigQuery through the Formal Connector using thebq command line tool:
Policy Evaluation
Formal supports the following policy evaluation stages for BigQuery:- Session: Evaluate and enforce policies at connection time
- Pre-Request: Evaluate and enforce policies before query execution
- Post-Request: Evaluate and enforce policies after data retrieval
Monitoring and Logging
The Connector provides detailed logs of all BigQuery operations, including:- Query execution
- Data access patterns
- User identity
- Evaluated / triggered policies
Troubleshooting
Common issues include:- TLS errors: Google SDK is strict when using a TLS certificate, and will fail if it isn’t signed by a trusted certificate authority.
- Service account credentials: The Formal Connector doesn’t use the correct service account credentials
- Permissions: The service account does not have the necessary permissions, especially domain-wide delegation