Skip to content

Latest commit

 

History

History
138 lines (84 loc) · 5.29 KB

migrate-packages.md

File metadata and controls

138 lines (84 loc) · 5.29 KB
title description ms.service ms.reviewer ms.date monikerRange recommendations
Migrate NuGet packages from MyGet to Azure Artifacts
How to migrate your NuGet packages from MyGet to an Azure Artifacts feed
azure-devops-artifacts
elbatk
06/22/2023
azure-devops
true

Migrate your NuGet packages from MyGet to Azure Artifacts

[!INCLUDE version-eq-azure-devops]

Using the AzureArtifactsPackageMigration PowerShell module, you can easily migrate your NuGet packages to Azure Artifacts. This article will walk you through an example of migrating NuGet packages from MyGet to Azure Artifacts.

In this article, you'll learn how to:

[!div class="checklist"]

  • Install the AzureArtifactsPackageMigration PowerShell module.
  • Connect to Azure Artifacts feeds.
  • Migrate to Azure Artifacts.

Prerequisites

Install PowerShell module

Using the command line interface, run the provided commands to install and import the PowerShell module. You can also download the migration scripts directly from the azure-artifacts-migration GitHub repository.

  1. Open a PowerShell prompt window.

  2. Run the following commands to install the AzureArtifactsPackageMigration PowerShell module and import it into your current session.

    Install-Module -Name AzureArtifactsPackageMigration -Scope CurrentUser -Force
    Import-Module -Name AzureArtifactsPackageMigration
  1. Open a terminal and run the pwsh command to start PowerShell.

  2. Run the following commands to install the AzureArtifactsPackageMigration module and import it into your current session.

    Install-Module -Name AzureArtifactsPackageMigration -Scope CurrentUser -Force
    Import-Module -Name AzureArtifactsPackageMigration

Migration setup

To migrate your packages, you'll need to get the source URLs for both the source feed (MyGet) and destination feed (Azure Artifacts).

Azure Artifacts

  1. Sign in to your Azure DevOps organization, and then navigate to your project.

  2. Select Artifacts, select your feed from the dropdown menu and then select Connect to feed.

    :::image type="content" source="../media/connect-to-feed-devops.png" alt-text="A screenshot showing how to connect to feed.":::

  3. Select NuGet.exe and then copy your feed's source URL.

    :::image type="content" source="../media/nuget-source-url.png" alt-text="Screenshot showing how to find the feed source URL.":::

    • Project-scoped feed:

      https://pkgs.dev.azure.com/<ORGANIZATION_NAME>/<PROJECT_NAME>/_packaging/<FEED_NAME>/nuget/v3/index.json
    • Organization-scoped feed:

      https://pkgs.dev.azure.com/<ORGANIZATION_NAME>/_packaging/<FEED_NAME>/nuget/v3/index.json

MyGet

  1. Sign in to your MyGet Account.

  2. Navigate to the feed you wish to migrate.

  3. Select Feed Details.

  4. Select Packages and then copy your NuGet V3 feed URL.

    https://www.myget.org/F/<FEED_NAME>/api/v3/index.json 
    

Migrate packages

If your MyGet feed is private, you'll need to create a password to authenticate. You can skip the first step if your MyGet feed is public.

  1. Run the following command to convert your password to a secure string.

    $password = ConvertTo-SecureString -String '<YOUR_PASSWORD>' -AsPlainText -Force
  2. Run the following command to migrate your packages to Azure Artifacts.

    • Migrate from a private MyGet feed:

        Move-MyGetNuGetPackages -SourceIndexUrl '<MYGET_SOURCE_URL>' -DestinationIndexUrl '<ARTIFACTS_FEED_SOURCE_URL>' -DestinationPAT '<AZURE_DEVOPS_PAT>' -DestinationFeedName '<ARTIFACTS_FEED_NAME>' -SourceUsername '<MYGET_USERNAME>' -SourcePassword $password -Verbose
    • Migrate from a public MyGet feed:

        Move-MyGetNuGetPackages -SourceIndexUrl '<MYGET_SOURCE_URL>' -DestinationIndexUrl '<ARTIFACTS_FEED_SOURCE_URL>' -DestinationPAT '<AZURE_DEVOPS_PAT>' -DestinationFeedName '<ARTIFACTS_FEED_NAME>' -Verbose

Related articles