CRM and CX Blogs by SAP
Stay up-to-date on the latest developments and product news about intelligent customer experience and CRM technologies through blog posts from SAP experts.
cancel
Showing results for 
Search instead for 
Did you mean: 
michalzeglen
Associate
Associate
198

This article describes how to use and configure anonymization feature of SAP Commerce DB Sync tool. Support for data anonymization was introduced in release v1.2.7 - it allows to alter the data on the fly during migration process based on provided configuration.

 

Prerequisites

DB Sync extensions has to be included in Customer's repository and properly configured for data migration. For more informations please refer to:

 

Configuration

Configuration is quite simple and consists of just two steps. Firstly, data anonymization has to be enabled, and then config file has to be adjusted to specify what data and how it will be altered during migration process. 

 

Enable anonymization feature

By default this is disabled, to enable set the following property:

 

migration.anonymizer.enabled=true

 

Configure how to anonymize the data

Configuration file is provided in SAP Commerce DB Sync tool, it can be found in commercedbsync extension under resources/anonymizer/config.yml. Out of the box it includes sample configuration for following tables:

  • users,
  • addresses,
  • emailaddress,
  • emailmessage,
  • useraudit,
  • pointofservice.

This should be a good starting point. However, it is important that you review and adjust this file to cover all necessary fields to ensure that data will be completely anonymized!

In this example we will use below OOTB configuration for tabes users and addresses:

 

tables:
  - name: users
    columns:
      - name: p_name
        operation: REPLACE
        text: "{GUID}-{RANDOM(number,5)}"
      - name: p_description
        operation: REPLACE
        text: "new description"
      - name: p_uid
        operation: REPLACE
        text: "{GUID}-{RANDOM(number,5)}"
        excludeRow: ["anonymous", "admin"]
      - name: p_originaluid
        operation: REPLACE
        text: "{GUID}-{RANDOM(number,5)}@test.com"
      - name: p_email
        operation: REPLACE
        text: "{GUID}-{RANDOM(number,5)}@test.com"

  - name: addresses
    columns:
      - name: p_cellphone
        operation: REPLACE
        text: "{RANDOM(number,10)}"
      - name: p_phone1
        operation: REPLACE
        text: "{RANDOM(number,10)}"
      - name: p_phone2
        operation: REPLACE
        text: "{RANDOM(number,10)}"
      - name: p_email
        operation: REPLACE
        text: "{GUID}-{RANDOM(string,5)}.{RANDOM(number,2)}@test.com"
        exclude: ["anette.customer@hybris.com", "keenreviewer24@hybris.com"]
      - name: p_fax
        operation: REPLACE
        text: "{RANDOM(number,10)}"
      - name: p_firstname
        operation: REPLACE
        text: "name_{RANDOM(number,5)}"
      - name: p_lastname
        operation: REPLACE
        text: "lastname_{RANDOM(number,5)}"
      - name: p_middlename
        operation: REPLACE
        text: "middlename_{RANDOM(number,5)}"
      - name: p_middlename2
        operation: REPLACE
        text: "middlename2_{RANDOM(number,5)}"
      - name: p_postalcode
        operation: REPLACE
        text: "{RANDOM(number,5)}"
      - name: p_streetname
        operation: REPLACE
        text: "{RANDOM(street)}"
      - name: p_streetnumber
        operation: REPLACE
        text: "{RANDOM(number,3)}"
      - name: p_town
        operation: REPLACE
        text: "{RANDOM(city)}"

 

By inspecting code above, you can see that it is possible to define how to alter data for specific column and also exclude certain values, or entire rows from the anonymization process.

In this example, in users table we don't want to alter any columns related to admin user. That way we still have a valid user that we can log in to after the data is migrated and anonymized.

Please also notice that for addresses random city and street is used. Those fields will be populated on randomly picked predefined data from commercedbsync/resources/anonymizer/address.json file.

For more information regarding anonymization configuration please refer to Anonymizer Documentation.

 

Running data migration with anonymization

Once anonymizer is enabled and configuration is in place there are no more extra steps - you can just start the migration from HAC and wait for the process to finish.

Screenshot 2024-12-24 at 14.40.36.png

 

Validation

After successful migration it is necessary to validate that data has been properly anonymized. It can be done by running some queries or checking in the Backoffice.

 

Example before data anonymization (source db):

Table: users

PKp_uidp_namep_description
8796093054980adminAdministratoradministrator description
8796096364548canonlover@hybris.comCanon LoverTest description 1
8796096724996vipgiold@hybris.comCustomer VIP GoldTest description 2
8796096790532aaron.customer@hybris.comAaron CustomerTest description 3
8796096856068andrew.customer@hybris.comAndrew CustomerTest description 4

Table: addresses

PKp_phone1p_townp_streetname
8796093054999+81 4535 1332OsakaShinsaibashi
8796093087767+81 7684 8185TokioShinkawa Chuo
8796093120535+81 1114 9907YokohamaSakuragicho
8796093153303+81 4220 68YokohamaSumiyoshi-Cho
8796093186071+81 7093 958Tokio Higashi Shimbashi

 

Example after data anonymization (target db):

Table: users

PKp_uidp_namep_description
8796093054980adminAdministratoradministrator description
879609636454830d04a66-0cea-446c-875a-2b8dbc9e8564-437037c0f2cb1-76fc-4ee6-8bc8-629d7b75f9c9-31824new description
8796096724996749b7b2e-b987-49cc-839f-3d53ebd0dcfd-57335a3c2ca1e-c5bf-4678-aec8-bd69b3037277-18655new description
879609679053259fc93bf-3470-4855-9dac-0abaf3b883e0-69104a030c308-7fa3-4b77-a1f3-1ce6dc12fa41-70960new description
879609685606872e282f2-8ea4-437e-be0a-9b32fb6dec0f-188722a737580-6d47-4876-a136-86e83b5dded9-65694new description

Table: addresses

PKp_phone1p_townp_streetname
87960930549994654719409Andorra la VellaViali di Circonvallazione
87960930877676487859143PalermoClerkenwell Road
87960931205355821083594AmsterdamFriedrichstrabe
87960931533035577704800LeipzigPonte Vecchio
87960931860711970063394WarsawCorso Buenos Aires