Migrate NuGet packages to Azure Artifacts
Azure DevOps Services
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 NuGet packages.
- Install NuGet CLI.
- Install PowerShell version 5.1 or later for Windows and version 6 or later for Linux/Mac.
- A personal access token to authenticate your feed.
- Azure DevOps Services account.
- Azure Artifacts feed.
Install the PowerShell module
Open an elevated PowerShell prompt window.
Run the following commands to install the
AzureArtifactsPackageMigrationPowerShell module and import it into your current session.
Install-Module -Name AzureArtifactsPackageMigration -Scope CurrentUser -Force Import-Module -Name AzureArtifactsPackageMigration
Alternatively, you can also download the migration scripts from the GitHub repository.
To migrate your packages, you will need to get the package source URL for both the source and destination feeds.
Select Artifacts and then select your feed.
Select Connect to feed.
Select NuGet.exe and then follow the instructions in the Project setup to set up your config file.
Log in to your MyGet Account.
Navigate to the feed you want to migrate.
Select Feed Details.
Select Packages and then copy the NuGet V3 feed URL.
Migrate NuGet packages
If your myget feed is private, you will need to create a password to authenticate. You can skip the first step if your myget feed is public.
Run the following command to convert your password to a secure string.
$password = ConvertTo-SecureString -String '<YOUR_PASSWORD>' -AsPlainText -Force
Run the following command to migrate your packages to Azure Artifacts;
Migrate from a private source 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 source feed:
Move-MyGetNuGetPackages -SourceIndexUrl '<MYGET_SOURCE_URL>' -DestinationIndexUrl '<ARTIFACTS_FEED_SOURCE_URL>' -DestinationPAT '<AZURE_DEVOPS_PAT>' -DestinationFeedName '<ARTIFACTS_FEED_NAME>' -Verbose