Migrate your packages from MyGet to Azure Artifacts

Azure DevOps Services

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:

  • 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
    

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.

    A screenshot showing how to connect to feed.

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

    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