top of page
Search

DATA MIGRATION IN DATAVERSE




Migration of Dataverse table Schema and data from one environment to another.


So today we will learn how to migrate the Schema and data in Dataverse tables from the development environment to Production. All the steps are written below, and everything is explained with the help of screenshots.

In order to migrate data, we first need to export and import Dataverse table schema from Source environment to destination environment.


Step 1: For this, we need to create a solution. Give a name to your solution and select CDS Default Publisher. Click on create.




Step 2: Open the Solution and add the table by clicking on Add from Existing -> Tables. Select your Table and then Next. Click on add all components -> Next.



Our Dataverse table has been added successfully. Click on Publish all Customizations.



Step 3: Click on Export -> Next -> Unmanaged -> Export.


After a few minutes the solution will be exported, and we need to import the created Solution into our destination environment.


Step 4: Open the environment -> Solutions -> Import -> Browse -> Select the exported package -> Next.


After a few minutes the solution will be imported successfully. Go to Tables and check for your Table. We will see that it has been successfully created.

This is how entire Table Schema can be migrated.


Now, we need to export and import Dataverse table data from Source environment to destination environment for which we will use Windows PowerShell (As a scripting language, PowerShell is commonly used for automating the management of systems. It is also used to build, test, and deploy solutions).


Step 1: Create a folder in your C Drive and name it as ‘Migration_tool’



Step 2: Search for Windows PowerShell by clicking on Windows


Step 3: The next step is to change the path or directory as shown below.



Step 4: Copy and Paste the given PowerShell script in the above-mentioned PowerShell Window to download tools from Nuget (NuGet is a Software/package manager designed to enable developers to share reusable code) and Press Enter.


$sourceNugetExe = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" $targetNugetExe = ".\nuget.exe" Remove-Item .\Tools -Force -Recurse -ErrorAction Ignore Invoke-WebRequest $sourceNugetExe -OutFile $targetNugetExe Set-Alias nuget $targetNugetExe -Scope Global -Verbose ## ##Download Plugin Registration Tool ## ./nuget install Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool -O .\Tools md .\Tools\PluginRegistration $prtFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool.'} move .\Tools\$prtFolder\tools\*.* .\Tools\PluginRegistration Remove-Item .\Tools\$prtFolder -Force -Recurse ## ##Download CoreTools ## ./nuget install Microsoft.CrmSdk.CoreTools -O .\Tools md .\Tools\CoreTools $coreToolsFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.CoreTools.'} move .\Tools\$coreToolsFolder\content\bin\coretools\*.* .\Tools\CoreTools Remove-Item .\Tools\$coreToolsFolder -Force -Recurse ## ##Download Configuration Migration ## ./nuget install Microsoft.CrmSdk.XrmTooling.ConfigurationMigration.Wpf -O .\Tools md .\Tools\ConfigurationMigration $configMigFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.XrmTooling.ConfigurationMigration.Wpf.'} move .\Tools\$configMigFolder\tools\*.* .\Tools\ConfigurationMigration Remove-Item .\Tools\$configMigFolder -Force -Recurse ## ##Download Package Deployer ## ./nuget install Microsoft.CrmSdk.XrmTooling.PackageDeployment.WPF -O .\Tools md .\Tools\PackageDeployment $pdFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.XrmTooling.PackageDeployment.Wpf.'} move .\Tools\$pdFolder\tools\*.* .\Tools\PackageDeployment Remove-Item .\Tools\$pdFolder -Force -Recurse ## ##Remove NuGet.exe ## Remove-Item nuget.exe



Step 5: Next, the tool will be downloaded in the previously created folder ‘Migration_tool’.


To migrate the data from the source to destination Open the Created folder, select configuration manager, and here we will have the utility called data migration utility. We need to click on it and the below shown interface will open.




Step 6: Next, we need to create the schema as the very first step. Select ‘Create Schema’ and click on Continue. Select Office 365 and click on show advanced. Now, we need to provide Username and Password of the Source environment from where we want the data to be migrated.



After successfully logging in we need to select the environment from where data is to be migrated. Click on log in.



Step 7: Next, all the existing Dataverse tables or entities will be shown on the top right dropdown. Select your Dataverse table from here i.e., ‘StudentDetails’ in our case.



Now, we need to add this entire table so click on Add Entity which will add all the fields on the right , under Selected fields and entities.

Click on Save and Export.



Give the name to your file for export which is ‘DataMigrationTool’ in our case. The schema will be saved now. Click on Yes to export data.



Here, we need to provide our export data file name and click on export which will export the data into zip file.


After clicking on Export Data our export will be successful:


Click on Exit.


Step 8: Now, we will Import the data to the destination environment. Select Import same as shown in Step5.

Now, we need to provide the destination server credentials which is the same in our case as the Source. We just need to select the Environment we need data to be imported into.

Follow the same steps as done for export and select the required environment which is ‘Dev’ in our case.


After log in we need to import the file we exported in the last step. Select the zip file and click on Open.



Next, click on import data:


Now the schema validation will take place and data input will be successful.


Click on Exit and check the destination environment after refreshing the Table. And here we can see that all the data has been migrated successfully from source to destination environment.



This was all about Data Migration in Dataverse from One environment to another. Hope you enjoyed it.







For further queries or demo please comment below or contact us.




For any for consultant/ support work on O365/ development, contact us or visit our website www.sigilotech.com

110 views0 comments

Comments


bottom of page