Announcing the CrmDataPackager PowerShell module

I’ve released a new PowerShell module, CrmDataPackager, that lets you unpack Configuration Migration data zip files into separate files per record, m2m relationship, and even individual fields.

This module’s commands help you achieve ALM for your Dynamics 365 / Dataverse / Power Apps / CDS / CRM data. The commands included are Expand-CrmData and Compress-CrmData, which are analogous to the pack and unpack operations of Solution Packager, but used for configuration data.

These commands were first implemented in the Adoxio.Dynamics.DevOps module, and have been enhanced and relocated into this new CrmDataPackager module.

The module has been published to the PowerShell Gallery at https://www.powershellgallery.com/packages/CrmDataPackager. To install the module, run this command from the PowerShell command line:

Install-Module -Name CrmDataPackager -Scope CurrentUser

The first thing to do is run Expand-CrmData on your zip file. You’ll get a folder with all the records in separate folders.

Expand-CrmData -ZipFile 'C:\temp\AdventureWorksData.zip' -Folder 'C:\temp\data\AdventureWorks'

The new features included in this module are for the m2m relationships and selected text fields to be extracted to their own files.

This unpacked folder is what will typically get committed to source control. Another common use is to compare the data from multiple environments in a file diffing tool such as WinMerge.

Documentation for Expand-CrmData that explains all the components in the created folder and its folder hierarchy of unpacked files is available at https://github.com/amervitz/CrmDataPackager/blob/main/docs/functions/Expand-CrmData.md.

When you need to import your data, run Compress-CrmData on the folder and you’ll get back a zip file that can be imported using the Configuration Migration Tool. Documentation is at https://github.com/amervitz/CrmDataPackager/blob/main/docs/functions/Compress-CrmData.md.

Compress-CrmData -Folder 'C:\temp\data\AdventureWorks' -ZipFile 'C:\temp\packed\AdventureWorksData.zip'

In summary, including configuration data in an ALM process takes the following steps:

  1. Export data using the Configuration Migration tool (or its corresponding PowerShell module)
  2. Unpack the data zip file to a folder of individual files per record, m2m relation, and field, using Expand-CrmData
  3. Commit the data to source control. When using GitHub or Git in Azure DevOps, use pull requests to review the changes to data prior to merging to the main branch.
  4. When importing the data into a target environment, first pack the data files back into a zip file using Compress-CrmData.