In the permissions table, select one of the following service accounts
in the Principal column:
For permission to resources at runtime, select the service account that
your Dataproc cluster uses. The default is the Compute Engine
service account, which is not recommended for security reasons
For permission to resources when using Wrangler or Preview in
Cloud Data Fusion (not at runtime), instead select the service
account that matches the format:
service-project-number@gcp-sa-datafusion.iam.gserviceaccount.com.
Click the pencil icon to the right of the service account.
Click Add Another Role.
Click the dropdown that appears.
Use the search bar to search and then select DLP Administrator.
Click Save. Check that DLP Administrator appears in the Role column.
Deploy the Sensitive Data Protection plugin
Go to your instance:
In the Google Cloud console, go to the Cloud Data Fusion page.
To open the instance in the Cloud Data Fusion Studio,
click Instances, and then click View instance.
In the Cloud Data Fusion web UI, click Hub in the upper right.
Click the Data Loss Prevention plugin.
Click Deploy.
Click Finish.
Click Create a pipeline.
Use the PII Filter transform
This transform separates sensitive records from non-sensitive records. A record
is considered sensitive if it matches criteria that you define in a
Sensitive Data Protection template. For example, when you create your template, you can
define sensitive data to be credit card information or Social Security numbers.
Open your pipeline in Cloud Data Fusion and click Studio>Transform.
Click the PII Filter transform.
Hold the pointer over the PII Filter node and click Properties.
Under Filter on, choose whether you want to filter records or fields.
In compliance with Sensitive Data Protection limits,
if a record exceeds 0.5 MB, your Cloud Data Fusion pipeline will fail.
To avoid such a failure, filter by field instead of record.
Under Template ID, enter the template ID of the Sensitive Data Protection
template you created.
Under Error Handling, define how to proceed when your pipeline encounters
sensitive data. Choose one of the following error handling options:
Stop pipeline: Stops the pipeline as soon as an error is encountered.
Skip record: Skips the record that caused the error. The pipeline
continues to run, and no error is reported.
Send to error: Sends errors to the error port. The pipeline continues to
run.
Click the X button.
Use the Redact transform
This transform identifies sensitive records in the input stream and applies
transformations that you define to those records. A record is considered
sensitive if it matches predefined Sensitive Data Protection filters you chose
or a custom template you defined.
In the Studio page of the Cloud Data Fusion web UI, click to expand
the Transform menu.
Click the Redact transform.
Hold the pointer over the Redact node and click Properties.
Choose if you want to apply transformations to predefined filters or if
you'd like to create your own.
You cannot combine these two options. You can either use predefined
filters OR create a custom template.
Predefined filters
To apply transformations to predefined filters, leave the Custom
Template set to No, and under Matching, define a rule:
Following Apply, click the dropdown and choose a transformation.
Learn more about the available transformations in the
Description section of the plugin's Documentation tab.
Following on, click the dropdown and choose a category, which is
a set of predefined Sensitive Data Protection filters grouped together
by type. For the full list of provided categories and what filters
they contain, see the DLP Filter Mapping section in the
plugin's Documentation tab.
To set multiple matching rules, click the + button.
Custom template
To apply transformations according to a custom template, set the Custom
Template to Yes.
Back in the Cloud Data Fusion web UI, in the Redact properties
menu, under Template ID, enter the template ID of the custom
template you created.
Click the X button.
Use the Decrypt transform
This transform identifies records that were encrypted using Sensitive Data Protection
in the input stream and applies decryption. Only records that were encrypted
using a reversible algorithm such as Format Preserving Encryption or
Deterministic Encryption can be decrypted.
In the Studio page of the Cloud Data Fusion web UI, click to expand
the Transform menu.
Click the Decrypt transform.
Hold the pointer over the Decrypt node and click Properties.
Enter the same values that were used to configure the Redact plugin that
encrypted this data. The properties for this plugin are identical to the
Redact plugin.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThis guide explains how to use the Sensitive Data Protection plugin within Cloud Data Fusion to filter, redact, or decrypt sensitive data.\u003c/p\u003e\n"],["\u003cp\u003eThe Sensitive Data Protection plugin offers three transforms: PII Filter for removing sensitive records, Redact for masking or encrypting data, and Decrypt for reversing Redact transformations.\u003c/p\u003e\n"],["\u003cp\u003eUtilizing the Sensitive Data Protection plugin requires enabling both the Cloud Data Fusion and DLP APIs, as well as granting the appropriate IAM permissions for data handling.\u003c/p\u003e\n"],["\u003cp\u003eSensitive Data Protection templates, either predefined or custom, are used to define what is considered sensitive data and how it should be handled within the PII Filter and Redact transforms.\u003c/p\u003e\n"],["\u003cp\u003eCosts associated with using this feature include Cloud Data Fusion usage and Sensitive Data Protection services, which can be estimated using the Google Cloud pricing calculator.\u003c/p\u003e\n"]]],[],null,["# Use Sensitive Data Protection with Cloud Data Fusion\n\nThis guide explains how to use [Sensitive Data Protection](/sensitive-data-protection) with Cloud Data Fusion.\n\nCloud Data Fusion provides a Sensitive Data Protection [plugin](/data-fusion/docs/concepts/overview#plugin)\nthat provides three transforms that can filter, redact, or decrypt your sensitive data:\n\n- The PII Filter transform lets you *filter* sensitive records from an\n input stream of data.\n\n- The Redact transform lets you *transform* sensitive data, such as\n masking the data or encrypting it.\n\n- The Decrypt transform lets you *decrypt* sensitive data that was previously\n encrypted using the Redact transform,\n\n| **Note:** The Sensitive Data Protection plugin available in Cloud Data Fusion is based on the Cloud Data Loss Prevention API and therefore complies with the Sensitive Data Protection [quotas and usage limits](/sensitive-data-protection/limits).\n\nCosts\n-----\n\n\nIn this document, you use the following billable components of Google Cloud:\n\n\n- [Cloud Data Fusion](/data-fusion/pricing)\n- [Sensitive Data Protection](/sensitive-data-protection/pricing)\n\n\nTo generate a cost estimate based on your projected usage,\nuse the [pricing calculator](/products/calculator). \nNew Google Cloud users might be eligible for a [free trial](/free). \n\n\u003cbr /\u003e\n\nBefore you begin\n----------------\n\n1. In the Google Cloud console, go to the project selector page and select or\n create a project.\n\n [Go to the project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n2. Enable the Cloud Data Fusion API for your project.\n\n [Enable the Cloud Data Fusion API](https://console.cloud.google.com/flows/enableapi?apiid=datafusion.googleapis.com)\n\n \u003cbr /\u003e\n\n3. Enable the DLP API (part of Sensitive Data Protection) for your project.\n\n [Enable the DLP API](https://console.cloud.google.com/marketplace/details/google/dlp.googleapis.com)\n\n \u003cbr /\u003e\n\n4. [Create a Cloud Data Fusion instance](/data-fusion/docs/how-to/create-instance).\n\n | **Note:** The Sensitive Data Protection plugin is available for instances using Cloud Data Fusion version 6.1.1 or higher.\n\nGrant Sensitive Data Protection permissions\n-------------------------------------------\n\n1. In the Google Cloud console, go to the IAM page.\n\n [Go to IAM](https://console.cloud.google.com/project/_/iam-admin/iam)\n\n \u003cbr /\u003e\n\n2. In the permissions table, select one of the following service accounts\n in the **Principal** column:\n\n 1. For permission to resources at runtime, select the service account that\n your Dataproc cluster uses. The default is the Compute Engine\n service account, which is not recommended for security reasons\n\n 2. For permission to resources when using Wrangler or Preview in\n Cloud Data Fusion (not at runtime), instead select the service\n account that matches the format:\n `service-`\u003cvar translate=\"no\"\u003eproject-number\u003c/var\u003e`@gcp-sa-datafusion.iam.gserviceaccount.com`.\n\n3. Click the pencil icon to the right of the service account.\n\n4. Click **Add Another Role**.\n\n5. Click the dropdown that appears.\n\n6. Use the search bar to search and then select **DLP Administrator**.\n\n \u003cbr /\u003e\n\n7. Click **Save** . Check that **DLP Administrator** appears in the **Role** column.\n\nDeploy the Sensitive Data Protection plugin\n-------------------------------------------\n\n1. Go to your instance:\n\n\n 1. In the Google Cloud console, go to the Cloud Data Fusion page.\n\n 2. To open the instance in the Cloud Data Fusion Studio,\n click **Instances** , and then click **View instance**.\n\n [Go to Instances](https://console.cloud.google.com/data-fusion/locations/-/instances)\n\n \u003cbr /\u003e\n\n2. In the Cloud Data Fusion web UI, click **Hub** in the upper right.\n\n3. Click the **Data Loss Prevention** plugin.\n\n4. Click **Deploy**.\n\n5. Click **Finish**.\n\n6. Click **Create a pipeline**.\n\n \u003cbr /\u003e\n\nUse the PII Filter transform\n----------------------------\n\nThis transform separates sensitive records from non-sensitive records. A record\nis considered sensitive if it matches criteria that you define in a\nSensitive Data Protection template. For example, when you create your template, you can\ndefine sensitive data to be credit card information or Social Security numbers.\n\n1. [Create a Sensitive Data Protection inspection template](/sensitive-data-protection/docs/creating-templates-inspect).\n\n2. Open your pipeline in Cloud Data Fusion and click **Studio** \\\u003e **Transform**.\n\n3. Click the **PII Filter** transform.\n\n4. Hold the pointer over the **PII Filter** node and click **Properties**.\n\n5. Under **Filter on**, choose whether you want to filter records or fields.\n\n In compliance with [Sensitive Data Protection limits](/sensitive-data-protection/limits#content_limits),\n if a record exceeds 0.5 MB, your Cloud Data Fusion pipeline will fail.\n To avoid such a failure, filter by field instead of record.\n6. Under **Template ID**, enter the template ID of the Sensitive Data Protection\n template you created.\n\n7. Under **Error Handling**, define how to proceed when your pipeline encounters\n sensitive data. Choose one of the following error handling options:\n\n - **Stop pipeline**: Stops the pipeline as soon as an error is encountered.\n - **Skip record**: Skips the record that caused the error. The pipeline continues to run, and no error is reported.\n - **Send to error**: Sends errors to the error port. The pipeline continues to run.\n8. Click the **X** button.\n\nUse the Redact transform\n------------------------\n\nThis transform identifies sensitive records in the input stream and applies\ntransformations that you define to those records. A record is considered\nsensitive if it matches predefined Sensitive Data Protection filters you chose\nor a custom template you defined.\n\n1. In the **Studio** page of the Cloud Data Fusion web UI, click to expand\n the **Transform** menu.\n\n2. Click the **Redact** transform.\n\n3. Hold the pointer over the **Redact** node and click **Properties**.\n\n4. Choose if you want to apply transformations to predefined filters or if\n you'd like to create your own.\n\n You cannot combine these two options. You can either use predefined\n filters OR create a custom template. \n\n ### Predefined filters\n\n To apply transformations to predefined filters, leave the **Custom\n Template** set to **No** , and under **Matching**, define a rule:\n 1. Following **Apply** , click the dropdown and choose a transformation.\n Learn more about the available transformations in the\n **Description** section of the plugin's **Documentation** tab.\n\n 2. Following **on** , click the dropdown and choose a category, which is\n a set of predefined Sensitive Data Protection filters grouped together\n by type. For the full list of provided categories and what filters\n they contain, see the **DLP Filter Mapping** section in the\n plugin's **Documentation** tab.\n\n To set multiple matching rules, click the **+** button.\n\n \u003cbr /\u003e\n\n \u003cbr /\u003e\n\n ### Custom template\n\n To apply transformations according to a custom template, set the **Custom\n Template** to **Yes**.\n 1. [Create a custom Sensitive Data Protection template](/sensitive-data-protection/docs/creating-templates-inspect).\n\n 2. Back in the Cloud Data Fusion web UI, in the Redact properties\n menu, under **Template ID**, enter the template ID of the custom\n template you created.\n\n5. Click the **X** button.\n\nUse the Decrypt transform\n-------------------------\n\nThis transform identifies records that were encrypted using Sensitive Data Protection\nin the input stream and applies decryption. Only records that were encrypted\nusing a reversible algorithm such as *Format Preserving Encryption* or\n*Deterministic Encryption* can be decrypted.\n\n1. In the **Studio** page of the Cloud Data Fusion web UI, click to expand\n the **Transform** menu.\n\n2. Click the **Decrypt** transform.\n\n3. Hold the pointer over the **Decrypt** node and click **Properties**.\n\n4. Enter the same values that were used to configure the **Redact** plugin that\n encrypted this data. The properties for this plugin are identical to the\n **Redact** plugin.\n\n5. Click the **X** button.\n\nWhat's next\n-----------\n\n- Follow a [tutorial to redact sensitive user data](/data-fusion/docs/tutorials/redacting-confidential-data).\n- Read more about [Sensitive Data Protection](/sensitive-data-protection/docs)."]]