User Guide: Privacera Encryption Integration with Databricks Unity Catalog¶
This user guide explains how to integrate Privacera Encryption with Databricks Unity Catalog to enable encryption, decryption, and data masking. It provides step-by-step instructions to help you configure and use these features effectively.
Prerequisites¶
- Databricks Unity Catalog enabled workspace.
- Privacera Encryption for Databricks Unity Catalog must be enabled and integrated (single-user or shared cluster setup).
- Encryption, presentation, and masking schemes created in Privacera Portal.
- Scheme policies configured so that users, groups, or roles have Protect, Unprotect, and Mask permissions as needed.
For detailed prerequisites and setup by cluster type, see:
- Encryption - Databricks Unity Catalog
- Prerequisites
- Setup - Single-User Cluster
- Setup - Shared Cluster
1. Create System and Custom Schemes¶
1.1. Create System Schemes (Encryption, Presentation)¶
- Log in to the Privacera Portal
- Navigate to Encryption & Masking > Encryption & Masking
- Click Generate System Scheme
- Confirm the creation by clicking Yes
- System schemes will be created for:
- Encryption
- Presentation
- Review the list of default system schemes
1.2. Create Custom Schemes (Encryption, Presentation, Masking)¶
- Navigate to Encryption & Masking > Schemes
- Click Add Scheme
- Select the scheme type: Encryption, Presentation, or Masking
- Enter the required details and click Save
2. Create Scheme Policies¶
Users and roles must have scheme policies to call the encryption UDFs.
2.1. Protect Access (for encrypting data)¶
- Navigate to Access Management > Scheme Policies > PEG (privacera_peg)
- Under ACCESS, click Add New Policy
- Enter a policy name (e.g., Protect Access)
- Under Encryption Schemes, select the encryption schemes (e.g.,
SYSTEM_SSN,SYSTEM_EMAIL,SYSTEM_CREDITCARD,SYSTEM_ADDRESS) - Under Grant Permissions(s), Grant Protect to the User
- Click Save
2.2. Unprotect Access (for decrypting data)¶
- Navigate to Access Management > Scheme Policies > PEG (privacera_peg)
- Under ACCESS, click Add New Policy
- Enter a policy name (e.g., Unprotect Access)
- Under Encryption Schemes, select the same encryption (and optionally presentation) schemes
- Under Grant Permissions(s), Grant Unprotect to the User
- Click Save
2.3. Mask Access (for masking data)¶
- Navigate to Access Management > Scheme Policies > PEG (privacera_peg)
- Under ACCESS, click Add New Policy
- Enter a policy name (e.g., Mask Policy)
- Under Protect Scheme, enter the masking schemes (e.g.,
MASK_SSN,MASK_EMAIL,MASK_ADDRESS) - Under Grant Permission(s), Grant Mask to the User
- Click Save
3. Encrypt Data¶
Use the protect UDF in your catalog and schema where the UDFs were created. Replace <catalog>.<schema> with your UDF location (e.g., hive_metastore.privacera for single-user, or your UC catalog and schema for shared cluster).
Example: Create a table with sample data and encrypt a column
4. Decrypt Data¶
4.1. Decrypt without presentation scheme¶
Apply unprotect on the CTAS-created encrypted_data table:
| SQL | |
|---|---|
4.2. Decrypt with presentation scheme (formatted/obfuscated output)¶
| SQL | |
|---|---|
5. Mask Data¶
Use the mask UDF with a masking scheme on plaintext columns:
| SQL | |
|---|---|
6. Summary¶
| Operation | UDF | Typical use |
|---|---|---|
| Encrypt | protect | Write sensitive data in encrypted form |
| Decrypt (without presentation) | unprotect | Read encrypted data (plain decryption) |
| Decrypt (with presentation) | unprotect | Read encrypted data with presentation scheme (obfuscated output) |
| Mask | mask | Show masked values on plaintext data |
For cluster-specific setup, UDF creation, and troubleshooting, see the Databricks Unity Catalog Encryption connector documentation.