Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 83 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,86 @@
# dataverse-configuration-migration-tool
Custom .net cli tool to import configuration data into a dataverse environment


# Dataverse Configuration Migration Tool

This repository contains a custom .NET CLI tool designed to import configuration data into Microsoft Dataverse environments. It streamlines the migration of configuration data, supports schema validation, and offers extensibility for advanced scenarios.

## Features

- Import configuration data into Dataverse
- Schema validation and rule-based checks
- Support for special characters and self-hierarchy imports
- Extensible for custom validation and reporting

## Getting Started

### Prerequisites

- [.NET 8.0 SDK](https://dotnet.microsoft.com/download/dotnet/8.0)
- Access to a Microsoft Dataverse environment

### Building the Tool

1. Clone the repository:
```powershell
git clone https://github.com/dotnetprog/dataverse-configuration-migration-tool.git
cd dataverse-configuration-migration-tool/src/Dataverse.ConfigurationMigrationTool/Dataverse.ConfigurationMigrationTool.Console
```
2. Build the project:
```powershell
dotnet build
```

### Usage


Before running the tool, set your `clientId`, `clientSecret` and `url` securely using [dotnet user-secrets](https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets):

```powershell
cd src/Dataverse.ConfigurationMigrationTool/Dataverse.ConfigurationMigrationTool.Console
dotnet user-secrets set "Dataverse:ClientId" "<your-client-id>"
dotnet user-secrets set "Dataverse:ClientSecret" "<your-client-secret>"
dotnet user-secrets set "Dataverse:Url" "<your-env-url>"
```

Run the CLI tool with the required arguments (no need to pass clientId or clientSecret on the command line):

```powershell
dotnet run --project Dataverse.ConfigurationMigrationTool.Console -- import --data "path/to/data.xml" --schema "path/to/schema.xml"
```

#### Import Command Line Arguments

Verb: `import`
- `--data` : Path to the data xml file
- `--schema` : Path to the schema XML file

Additional options and advanced usage can be found by running `dotnet run -- --help`.

## Contributing

Contributions are welcome! To get started:

1. Fork the repository and create a new branch for your feature or bugfix.
2. Make your changes and add tests as appropriate.
3. Ensure all tests pass:
```powershell
dotnet test ../Console.Tests/Dataverse.ConfigurationMigrationTool.Console.Tests.csproj
```
4. Submit a pull request with a clear description of your changes.

Please review open issues and the todo list below for ideas on what to contribute.


### Generating Schema and Data Files

To use the `import` command, you need a schema file and a data file. These can be generated from your Dataverse environment using the official Configuration Migration tool. For detailed instructions, refer to the Microsoft documentation:

- [Create a schema and export configuration data](https://learn.microsoft.com/en-us/power-platform/admin/create-schema-export-configuration-data)

This guide explains how to:
- Create a schema file that defines the data to export
- Export configuration data from your environment

*__NOTE__*: the `data_schema.xml` and `data.xml` will be inside the exported zip. You need to extract those files and use them to import command as described above.

## Todo list:

- Functionnal testing for self hierarchy import jobs.✅
- Add support for special characters. ✅
- <del> Add support to map users to owner.</del>
- <del>Add support to map created on to OverrideCreatedOn.</del>
- Refactor Schema validations into multiple validation rules
- Add configuration for tool reporting
- Add unit tests for everything
- Add CI/CD pipeline to build and execute the tool.
Loading