Skip to main content
Data Export is an add-on featureData Export is available as an add-on feature to select plans. To learn more, read about our pricing. To add Data Export to your plan, contact Sales.
This topic explains how to create and test a BigQuery destination for Data Export. BigQuery is a cloud-based data processing and analysis platform that lets you work with large sets of data. By exporting your LaunchDarkly flag evaluation and experiment data to the same BigQuery warehouse as your other data, you can build custom reports in BigQuery to answer product behavior questions. To set up BigQuery Data Export, you must:

Prerequisites

To configure the BigQuery Data Export integration, you must have the following prerequisites:
One Data Export destination per environmentYou can configure only one Data Export destination per LaunchDarkly environment, regardless of destination kind. If you need more than one Data Export destination for the same data, configure them in different environments.

Create a Google Cloud service account

To begin, create a Google Cloud service account, called the destination service account, that holds the permissions LaunchDarkly needs in your BigQuery warehouse. You need a destination service account for every authentication method. To do this, follow the Google Cloud instructions to create a service account. In the “Permissions” step, grant the account the BigQuery User role.
The service account permissions section in Google Cloud.

The service account permissions section in Google Cloud.

Save the service account email for use later when you set up the integration in LaunchDarkly. If you already have a Google Cloud service account, here’s how to add the role:
  1. In Google Cloud, navigate to Service Accounts under “IAM & Admin” and open your service account for the LaunchDarkly export service.
  2. Click on the Permissions tab.
  3. Click Manage access.
  4. In the Role field, select “BigQuery User.”
  5. Click Save.
Your service account now has permission to act as a BigQuery user.

Create staging bucket

Next, create a Google Cloud storage bucket for staging data, and grant your service account access to it. To do this:
  1. Create a Google Cloud storage bucket. Save the bucket name for use later when you set up the integration in LaunchDarkly.
  2. In the “Choose where to store your data” section, choose a Region that matches the location of your destination dataset in BigQuery. Save this region for use later when you set up the integration in LaunchDarkly.
  3. From the bucket’s Permissions tab, grant your service account access to the bucket
Do not set a retention policy on the staging bucketBigQuery Data Export does not support staging buckets with a retention policy. If the bucket has a retention policy, exports fail and the destination displays a health check error. Remove the retention policy, or use a different bucket without one.

Choose an authentication method

LaunchDarkly supports two methods for authenticating your BigQuery Data Export destination to your Google Cloud project:
  • Service account impersonation: The LaunchDarkly export service account impersonates your destination service account. This is the default method. To use it, read Grant LaunchDarkly access to your Google Cloud service account.
  • Workload identity federation: LaunchDarkly authenticates with an OAuth client from your own identity provider (IdP) and exchanges the credentials for Google Cloud access through the Google Security Token Service (STS). LaunchDarkly does not need access to your service account. To use it, read Set up workload identity federation.
You select the authentication method when you create the destination. You cannot change it after you save the destination.

Grant LaunchDarkly access to your Google Cloud service account

If you use service account impersonation, grant your LaunchDarkly export service account access to your destination service account. If you use workload identity federation, skip this section. To find your LaunchDarkly export service account email address:
  1. Navigate to the Integrations page in LaunchDarkly and find “BigQuery Data Export.”
  2. Click Add integration. The BigQuery Data Export configuration page appears.
  3. Under “Authentication method,” keep Service account impersonation selected.
  4. Copy the Export service account email address and save it for use in the next step.
The BigQuery Data Export configuration in LaunchDarkly, displaying the "Export service account email" field.

The BigQuery Data Export configuration in LaunchDarkly, displaying the "Export service account email" field.

Then, in Google Cloud, grant the LaunchDarkly export service account access to your Google Cloud service account:
  1. In Google Cloud, navigate to Service Accounts and select the service account you created or configured in the previous section.
  2. Click the Principals with access tab.
  3. Click Grant access.
  4. In the “Add principals” section, paste your LaunchDarkly export service account email address into the New principals field.
  5. In the “Assign roles” section, assign the “Service Account User” role in the role field.
  6. Click Add another role.
  7. Assign the Service account token creator role in the second Role field.
  8. Click Save.

Set up workload identity federation

If you use workload identity federation instead of service account impersonation, LaunchDarkly does not need access to your Google Cloud service account. Instead, LaunchDarkly exchanges credentials from your identity provider for a token that impersonates your destination service account. If you are setting up workload identity federation in Google Cloud for the first time, read Google’s Workload identity federation documentation. Before you configure the destination in LaunchDarkly, you need:
  • An OAuth client in your identity provider for LaunchDarkly to use. Save the client ID, the client secret, and your identity provider’s OAuth token endpoint URL. The token endpoint must be a public https:// URL.
  • A workload identity pool and provider in your Google Cloud project, configured to trust your identity provider. Save the provider’s full resource name.
  • The destination service account and staging bucket you set up in Create a Google Cloud service account and Create staging bucket.
  • The “Workload Identity User” role, roles/iam.workloadIdentityUser, granted to your workload identity principal on the destination service account. This lets the federated identity impersonate the destination service account after the token exchange.

Configure the BigQuery Data Export integration

Finally, in LaunchDarkly, configure the BigQuery Data Export integration. To do this, you first need to retrieve the following information from your Google Cloud account: Then configure the integration:
  1. Return to the Integrations page in LaunchDarkly and find “BigQuery Data Export.”
  2. Click Add integration. The BigQuery Data Export configuration page appears and lists the prerequisites for the integration.
  3. Give the integration a human-readable Name.
  4. Select a LaunchDarkly Project and environment to export data from. Environments that already have a Data Export destination are unavailable.
  5. Enter the GCP project ID. The ID must begin with a lowercase letter and contain only lowercase letters, numbers, and hyphens. LaunchDarkly also accepts legacy domain-scoped project IDs, such as example.com:my-project.
  6. Enter your GCS bucket name.
  7. Select your GCS bucket region from the list.
  8. Enter an Export dataset ID to name your dataset. If your dataset does not already exist, LaunchDarkly creates it automatically. The ID can contain only letters, numbers, and underscores. BigQuery limits dataset IDs to 1024 characters. Dataset IDs are case-sensitive, which means LD_Events and ld_events are different datasets.
  9. Under “Authentication method,” select Service account impersonation or Workload identity federation.
  10. Enter the fields for the method you selected:
    • Service account impersonation: Enter your Destination service account email. This must be a Google service account email address that ends with gserviceaccount.com.
    • Workload identity federation: Enter the following:
      • Identity provider token URL: The OAuth2 token endpoint of your identity provider. This must be a public https:// URL.
      • Client ID
      • Client secret: LaunchDarkly does not display the client secret after you save the destination.
      • Workload identity provider resource name: The full resource name of your workload identity pool provider, for example //iam.googleapis.com/projects/123/locations/global/workloadIdentityPools/pool/providers/provider. You can find it in the Google Cloud console under “Workload Identity Federation.”
      • Destination service account email: This must be a Google service account email address that ends with gserviceaccount.com.
      • (Optional) Identity provider scopes, if your identity provider requires scopes in the token request. Separate multiple scopes with spaces.
  11. Read the Integration Terms and Conditions, then select the I have read and agree to the Integration Terms and Conditions checkbox.
  12. Click Test connection and save. LaunchDarkly tests the BigQuery connection and, if it succeeds, creates and activates the destination.
The BigQuery Data Export configuration page in LaunchDarkly, displaying the workload identity federation credential fields.

The BigQuery Data Export configuration page in LaunchDarkly, displaying the workload identity federation credential fields.

Existing datasets need additional permissionsIf you provide an existing dataset, your service account needs the “BigQuery Data Editor” role in addition to the “BigQuery User” role.
Your BigQuery Data Export integration is now complete. To open or review the different event kinds for BigQuery Data Export destinations, read Warehouse Data Export schema reference. Each BigQuery Data Export destination in your LaunchDarkly account must write to a different dataset. You cannot save a destination whose GCP project ID and export dataset ID match another BigQuery Data Export destination in the same account.

View or edit a destination

After you save the destination, all of its connection fields are read-only, including the GCP project ID, the GCS bucket name and region, the export dataset ID, the authentication method, and the credentials for that method. LaunchDarkly does not display the workload identity federation client secret after setup. To view an existing BigQuery Data Export destination:
  1. Navigate to the Integrations page in LaunchDarkly and find “BigQuery Data Export.”
  2. Find the destination you want to view and click Edit. The BigQuery Data Export configuration page appears with the destination’s settings. A side panel shows the destination’s connection status and the time of its last successful export.
You can rename the destination from the edit page. To change any other value, such as the dataset or bucket, or to rotate a workload identity federation client secret, delete the destination and configure a new one.

Health checks

If your warehouse Data Export integration develops connection problems or other errors, the integration displays a health check warning. Common causes for BigQuery destinations include a disabled BigQuery API on the project, a staging bucket with a retention policy, a staging bucket in a different region than the dataset, and missing permissions on the destination service account or staging bucket. To learn more, read Warehouse health checks.