WaelHamze / dyn365-ce-vsts-tasks

VSTS Extension for Dynamics 365 Customer Engagement
https://marketplace.visualstudio.com/items?itemName=WaelHamze.xrm-ci-framework-build-tasks
GNU General Public License v3.0
115 stars 54 forks source link

Import Config Migration Data Task - appears it does not handle errors correctly #285

Open ThomasOchsenbein opened 1 year ago

ThomasOchsenbein commented 1 year ago

When "Import Config Migration Data" task has an error, it appears to return success to Azure DevOps. To cause an import error for "Import Config Migration Data" task: 1) Export Teams records to zip 2) Rename one of the Teams in Dynamics 365 3) Try to import the zip file via "Import Config Migration Data" task

The log shows an error, it failed to update the record (shown below). However, the status in Azure DevOps is success (green tick). This seems to be incorrect, shouldn't it return error status to Azure DevOps?

At the end of the log it has "EXIT IMPORT PROCESS COMPLETE". Maybe the Microsoft.Xrm.Tooling is not returning an error when it seems it should be.

.
.
.
DataMigrationUtility.Import Information: 8 : ImportProcess for Team Started.
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Verbose: 16 : Execute Command - Create : team : RequestID=f07cefef-4e86-4d69-bc3d-c4adb4aaf222 
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Verbose: 16 : Execute Command - Create : team : RequestID=fd65aee7-1296-4a68-bd48-d71a4a4237d8 
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Verbose: 16 : Execute Command - Create : team : RequestID=ad286a63-b381-4986-b37a-3ac378e8858b 
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Verbose: 16 : No retry attempted for Command Create
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Verbose: 16 : No retry attempted for Command Create
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Verbose: 16 : No retry attempted for Command Create
Microsoft.Xrm.Tooling.Connector.CrmServiceClient Error: 2 : ************ FaultException`1 - Create : team |=> Duplicate record exists. Violation of PRIMARY KEY constraint 'cndx_PrimaryKey_Team'. Cannot insert duplicate key in object 'dbo.TeamBase'. The duplicate key value is <redacted>.
Source  : mscorlib
Method  : HandleReturnMessage
Date    : 4/26/2023
Time    : 6:09:57 AM
Error   : Message: Duplicate record exists. Violation of PRIMARY KEY constraint 'cndx_PrimaryKey_Team'. Cannot insert duplicate key in object 'dbo.TeamBase'. The duplicate key value is <redacted>.
ErrorCode: -2147220950
Trace: 
Error Details   :
ApiExceptionSourceKey   : Plugin/Microsoft.Crm.ObjectModel.TeamService
ApiSourceActivityKey    : 
.
.
.

DataMigrationUtility.Import Error: 2 : Insert to team with Record Id b8d3a22a-27e4-e511-80c1-001dd8b71cfa - PrimaryId Field teamid and PrimaryName Field name - FAILED with Error : Duplicate record exists. Violation of PRIMARY KEY constraint 'cndx_PrimaryKey_Team'. Cannot insert duplicate key in object 'dbo.TeamBase'. The duplicate key value is <redacted>.
DataMigrationUtility.Import Information: 8 : Processing Team (threaded (3)), Imported 70 of 70
Microsoft.Xrm.Tooling.ConfigurationMigration.Powershell Information: 8 : Processing Team (threaded (3)), Imported 70 of 70--Working
DataMigrationUtility.Import Verbose: 16 : Connection 1 has imported 24 of 24 : 70 
DataMigrationUtility.Import Verbose: 16 : Connection 1 has imported 24 of 24 : 70 - THREAD COMPLETE
DataMigrationUtility.Import Information: 8 : Processing Team (threaded), Imported 70 of 70
Microsoft.Xrm.Tooling.ConfigurationMigration.Powershell Information: 8 : Processing Team (threaded), Imported 70 of 70--Working
DataMigrationUtility.Import Information: 8 : ImportProcess for Team Complete. Duration=00:00:14.6464635.  Entity RPS:4.77931071893225
DataMigrationUtility.Import Information: 8 : Processing N:N for Teams
DataMigrationUtility.Import Information: 8 : Processing Entity M2M Relations team (threaded), Imported 0 of 70
Microsoft.Xrm.Tooling.ConfigurationMigration.Powershell Information: 8 : Processing Entity M2M Relations team (threaded), Imported 0 of 70--Working
DataMigrationUtility.Import Verbose: 16 : Connection 1 has imported 0 of 0 : 0 - THREAD COMPLETE
DataMigrationUtility.Import Verbose: 16 : Connection 1 has imported 0 of 0 : 0 - THREAD COMPLETE
DataMigrationUtility.Import Verbose: 16 : Connection 1 has imported 0 of 0 : 0 - THREAD COMPLETE
DataMigrationUtility.Import Information: 8 : Processing Entity M2M Relations team (threaded), Imported 0 of 70
Microsoft.Xrm.Tooling.ConfigurationMigration.Powershell Information: 8 : Processing Entity M2M Relations team (threaded), Imported 0 of 70--Working
DataMigrationUtility.Import Information: 8 : Entity M2M Relations team, Completed Importing 70 of 70
Microsoft.Xrm.Tooling.ConfigurationMigration.Powershell Information: 8 : Entity M2M Relations team, Completed Importing 70 of 70--Complete
DataMigrationUtility.Import Information: 8 : Completed Processing N:N for Teams
Microsoft.Xrm.Tooling.ConfigurationMigration.Powershell Information: 8 : Completed Processing N:N for Teams--Complete
DataMigrationUtility.Import Information: 8 : Entity Team, Completed Importing 3 of 70
Microsoft.Xrm.Tooling.ConfigurationMigration.Powershell Information: 8 : Entity Team, Completed Importing 3 of 70--Warning
DataMigrationUtility.Import Information: 8 : Stage Complete
DataMigrationUtility.Import Information: 8 : Import Process completed
Microsoft.Xrm.Tooling.ConfigurationMigration.Powershell Information: 8 : Import Process completed--Complete
DataMigrationUtility.Import Information: 8 : Import Process completed - Import duration: 00:00:19.1939362 - RPS:3.65
DataMigrationUtility.Import Information: 8 : *********************************************************
DataMigrationUtility.Import Information: 8 : ** EXIT IMPORT PROCESS COMPLETE **
DataMigrationUtility.Import Information: 8 : *********************************************************