Ajinkya Bapat
Ajinkya Bapat

Reputation: 709

How to map users from Tenant 1 to Tenant 2 while migrating project between these tenants?

I am using Azure DevOps Migration Tools to migrate my ADO Project A which is in Tenant A to Project B in Tenant B.

I have a similar set of users in both ADs but users in both these tenants have different email addresses.

I believe, when I run this migration, it will assign work items to placeholders as those users are not present in the target project(atleast with the same email address).

How can I overcome this? I want to map these users when migrating to Project B so that those users are correctly mapped with their email addresses in Tenant B.

For example, User A in source project with email [email protected] should be mapped to User A in target project with email [email protected].

Can I do that? If yes, then how?

(I can't use the approach of switching the Directory of my Project A to Tenant B as is suggested in the Docs of the tool)

Upvotes: 1

Views: 568

Answers (3)

Starting with 15.0.1-Preview.1 this has now been added to the tooling.

We added a TfsUserMappingEnricherthat allows you to map users from Source to Target... this is not free and takes some work. Running theExportUsersForMappingConfig` to get the list of users will produce:

[
  {
    "Source": {
      "FriendlyName": "Martin Hinshelwood nkdAgility.com",
      "AccountName": "[email protected]"
    },
    "target": {
      "FriendlyName": "Hinshelwood, Martin",
      "AccountName": "[email protected]"
    }
  },
  {
    "Source": {
      "FriendlyName": "Rollup Bot",
      "AccountName": "[email protected]"
    },
    "target": {
      "FriendlyName": "Service Account 4",
      "AccountName": "[email protected]"
    }
  },
  {
    "Source": {
      "FriendlyName": "Another non mapped Account",
      "AccountName": "[email protected]"
    },
    "target": null
  }
]

##How it works

  1. Run ExportUsersForMappingConfig which will export all of the Users in Soruce Mapped or not to target.
  2. Run WorkItemMigrationConfig which will run a validator by detail to warn you of missing users. If it finds a mapping it will convert the field...

##Notes

  • Applies to all identity fields specified in the list
  • It really sucks that we have to match on Display name! Email is included for internal matching
  • On 'ExportUsersForMappingConfigyou can setOnlyListUsersInWorkItems` to filter the mapping based on the scope of the query. This is greater if you have many users.
  • Both use the TfsUserMappingEnricherOptions setting in CommonEnrichersConfig to know what to do.
{
  "ChangeSetMappingFile": null,
  "Source": {
    "$type": "TfsTeamProjectConfig",
    "Collection": "https://dev.azure.com/nkdagility/",
    "Project": "AzureDevOps-Tools",
    "ReflectedWorkItemIDFieldName": "nkdScrum.ReflectedWorkItemId",
    "AllowCrossProjectLinking": false,
    "AuthenticationMode": "Prompt",
    "PersonalAccessToken": "",
    "PersonalAccessTokenVariableName": "",
    "LanguageMaps": {
      "AreaPath": "Area",
      "IterationPath": "Iteration"
    }
  },
  "Target": {
    "$type": "TfsTeamProjectConfig",
    "Collection": "https://dev.azure.com/nkdagility-preview/",
    "Project": "migrationTest5",
    "ReflectedWorkItemIDFieldName": "nkdScrum.ReflectedWorkItemId",
    "AllowCrossProjectLinking": false,
    "AuthenticationMode": "Prompt",
    "PersonalAccessToken": "",
    "PersonalAccessTokenVariableName": "",
    "LanguageMaps": {
      "AreaPath": "Area",
      "IterationPath": "Iteration"
    }
  },
  "FieldMaps": [],
  "GitRepoMapping": null,
  "LogLevel": "Debug",
  "CommonEnrichersConfig": [
    {
      "$type": "TfsUserMappingEnricherOptions",
      "Enabled": true,
      "UserMappingFile": "C:\\temp\\userExport.json",
      "IdentityFieldsToCheck": [
        "System.AssignedTo",
        "System.ChangedBy",
        "System.CreatedBy",
        "Microsoft.VSTS.Common.ActivatedBy",
        "Microsoft.VSTS.Common.ResolvedBy",
        "Microsoft.VSTS.Common.ClosedBy"
      ]
    }
  ],
  "Processors": [
    {
      "$type": "ExportUsersForMappingConfig",
      "Enabled": true,
      "WIQLQuery": "SELECT [System.Id] FROM WorkItems WHERE [System.TeamProject] = @TeamProject AND [System.WorkItemType] NOT IN ('Test Suite', 'Test Plan','Shared Steps','Shared Parameter','Feedback Request') ORDER BY [System.ChangedDate] desc",
      "OnlyListUsersInWorkItems": true
    }
  ],
  "Version": "15.0"
}

Upvotes: 0

maf-soft
maf-soft

Reputation: 2552

Here is another way, but still not nice, because you have to duplicate it for every field:

{
  "$type": "FieldValueMapConfig",
  "WorkItemTypeName": "*",
  "sourceField": "System.AssignedTo",
  "targetField": "System.AssignedTo",
  "valueMapping": {
    "Lastname, Firstname (Company)": "Firstname Lastname",
    "Lastname2, Firstname2 (Company)": "Firstname2 Lastname2"
  }
}

Here are the identity fields I know (please add more!):

"System.AssignedTo",
"System.ChangedBy",
"System.CreatedBy",
"Microsoft.VSTS.Common.ActivatedBy",
"Microsoft.VSTS.Common.ResolvedBy",
"Microsoft.VSTS.Common.ClosedBy"

There is a nice automated export to create a list of users in that format: ExportUsersForMapping

And an improvement is planned.

Upvotes: 1

Jiawei Shi - MSFT
Jiawei Shi - MSFT

Reputation: 224

The template of Azure DevOps Migration Tools could map [email protected] to [email protected].

You just need to edit the template:

 {
      "$type": "MultiValueConditionalMapConfig",
      "WorkItemTypeName": "*",
      "sourceFieldsAndValues": {
        "Assigned To": "[email protected]",
        "Assigned To": "[email protected]"
      },
      "targetFieldsAndValues": {
        "Assigned To": "[email protected]",
        "Assigned To": "[email protected]"
      }
    },

Upvotes: -1

Related Questions