Import to Cloud Instance Error

Hi we’re migrating from our onPrem instance to a Cloud instance and we’re encountering problems when importing one space. The error that we get an error
Found unmapped Ids in document ‘unknown name’ (Octopus.Core.Model.Variables.TenantVariable):
“RelatedDocumentId”: “Certificates-2-D4C63A85E7894C5D8C20D9297FEA1A43”,.
Reference path: Project ‘XXXXXX’ => Tenant ‘xxxx’

We’ve archived every certificate that has expired and made sure all the tenant variables have certificates that are valid. Any help would be appreciated.

Good afternoon @freyr.finnbogason,

Welcome to the Octopus Community and sorry to hear you are having issues with importing into Octopus.

I have seen it before where a Tenant can’t be deleted because it is linked to an archived certificate, I am wondering whether this is happening to your instance during the import.

Are you able to look at Certificates-2-D4C63A85E7894C5D8C20D9297FEA1A43 and see if it has any archived certificates linked to that Tenant (Tenant ‘SPThin). If it does are you able to delete that tenant from the archived certificate, try the export again so you get an updated export and then try the import again?

If this doesn’t work I did find this forum post where a similar issue happened to a customer and one of our support team resolved it by manually deleting that reference from the JSON documents in the export. It might be worth giving that a read to see if you can do something similar.

Let me know the outcome of checking the archived certificates and if that doesn’t work I can help you out with trying to edit the JSON for that export.

Kind Regards,

Clare Martin

Hi Clare
Thank you for the quick reply, yes I found the other post but i’m not sure what to delete in my import zip file I can find the Certificates-2-D4C63A85E7894C5D8C20D9297FEA1A43 inside 28 files only the ones named TenantVariables-…json
I went through all the archived certificates inside the space and removed all roles and environment linked to it the same result after export and import however.
An example how the reference is inside a TenantVariables-… file
{

“Id”: “TenantVariables-4713-D4C63A85E7894C5D8C20D9297FEA1A43”,

“TenantId”: “Tenants-508-D4C63A85E7894C5D8C20D9297FEA1A43”,

“OwnerId”: “LibraryVariableSets-107-D4C63A85E7894C5D8C20D9297FEA1A43”,

“OwnerType”: “LibraryVariableSet”,

“EnvironmentId”: null,

“VariableTemplateId”: “8eade75f-39a4-44bf-8a1d-16a2a8fedced”,

“SpaceId”: “Spaces-22-D4C63A85E7894C5D8C20D9297FEA1A43”,

“Value”: “Certificates-2”,

“RelatedDocumentId”: “Certificates-2-D4C63A85E7894C5D8C20D9297FEA1A43”

}

Can I remove this or should I replace it with $null?

Hey @freyr.finnbogason,

So if you delete all the below you hopefully should be good to go:

{
“Id”: “TenantVariables-4713-D4C63A85E7894C5D8C20D9297FEA1A43”,
“TenantId”: “Tenants-508-D4C63A85E7894C5D8C20D9297FEA1A43”,
“OwnerId”: “LibraryVariableSets-107-D4C63A85E7894C5D8C20D9297FEA1A43”,
“OwnerType”: “LibraryVariableSet”,
“EnvironmentId”: null,
“VariableTemplateId”: “8eade75f-39a4-44bf-8a1d-16a2a8fedced”,
“SpaceId”: “Spaces-22-D4C63A85E7894C5D8C20D9297FEA1A43”,
“Value”: “Certificates-2”,
“RelatedDocumentId”: “Certificates-2-D4C63A85E7894C5D8C20D9297FEA1A43”
}

I am not sure what happened here but it may be that when you archived some of the certificates Octopus either has not gracefully deleted that reference or its Bento (our import/export tool) not handelling it properly.

Let me know how you get on with deleting that in all the 28 files (for just the Certificates-2-D4C63A85E7894C5D8C20D9297FEA1A43), this is just a project export so it will not mess up the original project but feel free to do a Database Backup if you are worried and want that bit of extra security.

Kind Regards,

Clare Martin

Hi Clare
In trying to resolve this we’ve deleted all archived expired certificate and gone throught the tenant variables trying to find any reference to those certificates. We still get the error in importing.
But if we delete everything like you suggests then that basically creates and empty file since this is the only thing inside the files.

Hi @freyr.finnbogason,

Just jumping in for Clare as she is on our UK team and offline for the day.

It’s possible there’s a reference to this Cert ID in an unexpected JSON. Have you searched every file in that export, or just a subset? Is this something you could upload for us to tinker with on our side? Keep in mind we would have access to your sensitive variables, certs, and accounts in that project.

I have a script that can purge all of the sensitive data in that export to make it more external-use friendly that I can send you, but that script will actually put dummy data in all of your certs. We could also try using a modified version of the script to find any references to that certificate.

Please let me know if you’d like a secure upload link, or the script itself.

Best,
Jeremy

Hi Jeremy
We would appreciate the script itself it might then be possible to upload a zip file for you guys to analyze, thanks in advance

Hi @freyr.finnbogason,

I’ve DMed you the script.

This was resolved in DMs via a PowerShell script. If you see this in the future, please reach out to us and reference this thread.

Best,
Jeremy

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.