nkdAgility / azure-devops-migration-tools

Azure DevOps Migration Tools allow you to migrate Teams, Backlogs, Tasks, Test Cases, and Plans & Suits from one Project to another in Azure DevOps / TFS both within the same Organisation, and between Organisations.
https://marketplace.visualstudio.com/items?itemName=nkdagility.vsts-sync-migration
MIT License
475 stars 322 forks source link

[Bug]: Unable to configure store #2041

Closed NotAwar closed 1 month ago

NotAwar commented 2 months ago

Version

Source Version

Azure DevOps Service

Target Version

Azure DevOps Service

Relevant configuration

{
  "ChangeSetMappingFile": null,
  "Source": {
    "$type": "TfsTeamProjectConfig",
    "Collection": "https://dev.azure.com/*",
    "Project": "*",
    "ReflectedWorkItemIDFieldName": "Custom.ReflectedWorkItemId",
    "AllowCrossProjectLinking": false,
    "AuthenticationMode": "Prompt",
    "PersonalAccessToken": "*",
    "PersonalAccessTokenVariableName": "*",
    "LanguageMaps": {
      "AreaPath": "Area",
      "IterationPath": "Iteration"
    },
    "CollectionName": "https://dev.azure.com/*"
  },
  "Target": {
    "$type": "TfsTeamProjectConfig",
    "Collection": "https://dev.azure.com/*",
    "Project": "*",
    "ReflectedWorkItemIDFieldName": "Custom.ReflectedWorkItemId",
    "AllowCrossProjectLinking": false,
    "AuthenticationMode": "Prompt",
    "PersonalAccessToken": "*",
    "PersonalAccessTokenVariableName": "*",
    "LanguageMaps": {
      "AreaPath": "Area",
      "IterationPath": "Iteration"
    },
    "CollectionName": "https://dev.azure.com/*"
  },
  "FieldMaps": [],
  "GitRepoMapping": null,
  "LogLevel": "Debug",
  "CommonEnrichersConfig": [],
  "Processors": [
    {
      "$type": "WorkItemMigrationConfig",
      "Enabled": true,
      "UpdateCreatedDate": true,
      "UpdateCreatedBy": true,
      "WIQLQuery": "SELECT [System.Id] FROM WorkItems WHERE [System.AreaPath] = '*'",
      "AttachmentMigration": true,
      "AttachmentWorkingPath": "c:\\temp\\WorkItemAttachmentWorkingFolder\\",
      "FixHtmlAttachmentLinks": false,
      "SkipToFinalRevisedWorkItemType": false,
      "WorkItemCreateRetryLimit": 5,
      "FilterWorkItemsThatAlreadyExistInTarget": true,
      "PauseAfterEachWorkItem": false,
      "AttachmentMaxSize": 480000000,
      "AttachRevisionHistory": false,
      "LinkMigrationSaveEachAsAdded": false,
      "GenerateMigrationComment": true,
      "WorkItemIDs": null,
      "MaxGracefulFailures": 0,
      "SkipRevisionWithInvalidIterationPath": false,
      "SkipRevisionWithInvalidAreaPath": false
    }
  ],
  "Version": "15.0",
  "workaroundForQuerySOAPBugEnabled": false,
  "WorkItemTypeDefinition": {
    "sourceWorkItemTypeName": "targetWorkItemTypeName"
  },
  "Endpoints": {
    "InMemoryWorkItemEndpoints": [
      {
        "Name": "Source",
        "EndpointEnrichers": null
      },
      {
        "Name": "Target",
        "EndpointEnrichers": null
      }
    ]
  }
}

Relevant log output

Unable to configure store: Check persmissions and credentials for Prompt
Microsoft.TeamFoundation.TeamFoundationServerUnauthorizedException: TF30063: You are not authorized to access https://dev.azure.com/*/. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.

What happened?

I have Project Collection administrator in both source and target, I have tried several debugging methods according to #1996 but after a month I still seem to have issues with authenticating. I get no prompt window and the run fails instantly.

Debug in Visual Studio

Stischu commented 1 month ago

I have the exact same problem. Please let me know if someone figure this one out.

MrHinsh commented 1 month ago

I have heard back from the Product Team, and the Object Model only works with "Full Access" PAT tokens.

image

NotAwar commented 2 weeks ago

Updating this issue in case it helps someone else.

When setting "PersonalAccessTokenVariableName": "*" as well as AccessToken and using prompt:

  1. For some reason I still do not get any prompts, but I ended up chaning to AccessToken
  2. Realized AccessToken for some reason did not give me access and still gave a 401 permission error.
  3. changed the "PersonalAccessTokenVariableName": "variable" variable to "PersonalAccessTokenVariableName": "" - This has to be empty if you're not using it, in hindsight this seems obvious, for some reason i didn't believe this to be the issue because it had worked several times previously.

For some reason this variable is prioritized over the AccessToken and therefore you get a 401 error. This is probably due to it being an env variable.