Data Migration Toolbox




Data Migration Tool is an app to migrate Dynamics CRM/Power Platform data between environments, using fetch XML queries. 
What can you expect when you use this tool?
  • It keeps Guid records.
  • You can turn off the plugins to migrate data.
  • You can apply a fetch filter per table.
  • It's another way to deploy a portal.
  • It executes an Upsert.
  • It doesn't delete existing records.
  • You can have a data backup.
Other tools like Data Transporter on XRMToolbox also help you to copy data between environments respecting the record Guids and select the CRUD actions you want to apply. Both apps XRMTool and DMT run only on Windows.

This post will explain How to use the Data Migration tool; during my years of experience, I have done this knowledge transfer for different reasons, so I considered it helpful to have these directions immortalized on the internet. I used this tool for different purposes such as a catalog table, some old Portal deployments (known as Power Pages today)

To download the data migration tool app, follow the directions on the official page: Dataverse development tools (Microsoft Dataverse) - Power Apps | Microsoft Learn


Install DMT

The next directions are a brief summary of what you will find on the preview link.
Install Power Platform Tools on Visual Studio Code:


On the VC terminal, execute the next line.
pac tool cmt
Once it is installed, it will open the app immediately.


On the main menu, you will always have 3 options:

After you select any of these options, you must authenticate and select the environment where you export/import the data. I used to connect with Office 365 and check the List of available organizations to choose the environment where it will export/import data. 

Create Schema


Creating a schema is to prepare the Query that will be used to extract the data from the environment. This is the most crucial part because you must be very detailed about how and which data will be imported if you want this to be an Upsert or don't need any of your plugins to be triggered. 

In a hypothetical scenario, you can have a plugin that executes every time a Contact is created/updated. If you import 1,000 contacts, Imagine all the traffic processes this import can do. I have seen this as a typical issue in many projects, making the environment impossible to work. Note: This option doesn't turn off the power automated flows but it causes the same effect.

(The following images and videos are just an example of the Create Schema Process)






Export Data

Once you select the environment, you can export the data based on the schema previously created.




Just select where are going to export the data package 


Import Data

In this step, you can import previously exported data to the Destiny environment.



Once It has finished import, you can review the import log if there were warnings or errors for more details:


Some common issues can be related to:
  • Some data dependencies to create the record (lookup, parent records..). In this scenario, you have to split the data migration into two steps: import parent or dependency records and then import the rest. For example, this happened to me when I tried to deploy the entity/table permissions of a Portal (Power Page), so I had to deploy first the Parent/Global records and then the child permissions.
  • You don't have the right permissions on the environment to edit those tables/fields.

Best Practices
The following are things you should consider while using this tool to migrate your configuration data:

  • While creating the export data schema, you must define uniqueness rules appropriately for each entity to avoid any unintentional data updates on the target system.
  • Import the exported data in a pre-production environment (preferably a mirror image of the production environment) to ensure that the data import results are as you intended.
  • Back up your production environment before importing the data.
 Reference: (Move configuration data across organizations - Power Platform | Microsoft Learn


Sometimes, you don't have any extra environment to experiment with previous vital releases. Nevertheless, an alternative can be to extract data from the production environment with the same schema as backup.

Comments

Popular posts from this blog

Portal (Power Pages) WebAPI & forget about clearing cache

Using external Fonts in Power Pages