Error " The Given Key '3' Was Not Present In The Dictionary" While Migrating Orchestrator Data

How to resolve the System.Exception: Error:1 , Message:An error occurred while migrating Orchestrator data. The given key 3 was not present in the dictionary. ?

Issue Description: System.Exception: Error:1 Message:An Error occurred while migrating Orchestrator data. The given key '3' was not present in the dictionary .

Resolution: Perform the below suggested steps

  1. Recreate the missing tenant with id = x using (aprox same) following tsql query:

set identity_insert Tenants on

INSERT INTO [dbo].[Tenants]

VALUES

(x ,'testtenant' ,'testtenant' ,1 ,0 ,null ,null ,null ,null ,getdate() ,1 ,null ,null ,null ,lower(newid())

  1. Re-attempt to install/upgrade Orch using platform installer.

Note: Ensure to take a backup before making any DB changes.