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 |
[!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.
-
An Azure DevOps organization and a project. Create an organization or a project if you haven't already.
-
An Azure Artifacts feed. Create a new feed if you don't have one already.
-
Install Azure Artifacts Credential Provider.
-
A personal access token to authenticate with Azure DevOps.
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.
-
Open a PowerShell prompt window.
-
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
-
Open a terminal and run the
pwsh
command to start PowerShell. -
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
To migrate your packages, you'll need to get the source URLs for both the source feed (MyGet) and destination feed (Azure Artifacts).
-
Sign in to your Azure DevOps organization, and then navigate to your project.
-
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.":::
-
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
-
-
Sign in to your MyGet Account.
-
Navigate to the feed you wish to migrate.
-
Select Feed Details.
-
Select Packages and then copy your NuGet V3 feed URL.
https://www.myget.org/F/<FEED_NAME>/api/v3/index.json
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.
-
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 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
-