Edit

Share via


Set up an internal feed as an upstream source

Azure DevOps Services | Azure DevOps Server | Azure DevOps Server 2022

Azure Artifacts upstream sources simplify package management by enabling developers to store packages from multiple sources in a single feed. When a package is installed for the first time from an upstream source, Azure Artifacts automatically saves a copy to your feed to ensure continued access, even if the upstream source becomes temporarily unavailable. This tutorial walks you through how to set up an internal feed from the same organization as an upstream source in Azure Artifacts.

Prerequisites

Product Requirements
Azure DevOps - An Azure DevOps organization.
- An Azure DevOps project.

Create a feed

If you don’t already have a feed, follow these steps to create one and add common public registries as upstream sources:

  1. Sign in to Azure DevOps and go to your project.

  2. Select Artifacts, then select Create feed.

  3. Enter a Name for the feed and choose the appropriate Visibility and Scope settings.

  4. Select Include packages from common public sources to add common public registries as upstream sources.

  5. Select Create when you're done.

Connect to your feed

Use the following steps to configure your project and authenticate with your feed. This example uses a Rust project. For other technologies, see the project setup links in the following section.

  1. Sign in to Azure DevOps, and go to your project.

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

    A screenshot displaying how to select a feed from the dropdown list in Azure Artifacts.

  3. From the left navigation pane, select Cargo.

  4. In the Project setup section, copy the first snippet and add it to the cargo/config.toml file in your source repository. Your config.toml file should resemble the following:

    [registries]
    FEED_NAME = { index = "sparse+https://pkgs.dev.azure.com/ORGANIZATION_NAME/PROJECT_NAME/_packaging/FEED_NAME/Cargo/index/" }
    
  5. Configure a credential provider

  6. Log in to the registry

Project setup for other package types

If you’re using a different technology, use the links below to follow the appropriate project setup guidance to connect to your feed:

Set up the upstream feed

Follow these steps to set up an internal feed from the same organization as an upstream source:

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

  2. Select Artifacts, then select the feed you created earlier from the feed dropdown menu.

  3. Select the gear icon buttongear icon to navigate to Feed settings.

  4. Select Upstream sources, then select Add Upstream.

  5. On the Type tab, select Azure Artifacts feed in this organization.

  6. On the Configuration tab, from the Feed dropdown menu, select the feed you want to add as an upstream source. Select the desired View, then choose the Package type(s) to include, and optionally update the Upstream source name.

  7. Select Add when you're done.

    A screenshot showing how to add a new internal feed as an upstream source in Azure Artifacts.

  8. Select Save to apply your changes.

    A screenshot showing how to save upstream sources in Azure Artifacts.

Install packages from upstream

The following example illustrates a scenario where Test_Feed has CargoDemoFeed configured as an upstream source. For demonstration purposes Test_Feed is empty and contains no packages.

When a collaborator (or higher) installs a package from Test_Feed that is available in the upstream CargoDemoFeed, Azure Artifacts copies that package into the downstream Test_Feed and downloads it as part of the normal cargo install flow. After this first-time copy, all future downloads of that package from Test_Feed require only Feed Reader (or higher) permissions, because those later downloads don't modify the downstream feed. Only the first install copies the package from upstream to downstream, so only that initial action requires elevated permissions.

  1. Sign in to Azure DevOps, then navigate to the project that hosts the upstream feed (in this example, CargoDemoFeed).

  2. Select Artifacts, then from the dropdown menu, select the upstream feed (CargoDemoFeed).

  3. Find the package you want to install and note its name. In this example, atomic-waker is the package name. You can also search upstream packages directly from your downstream feed in the Azure Artifacts UI. See Search packages from upstream sources for more details.

  4. Navigate to the root of your project and open your Cargo.toml. Add the package under [dependencies]. Because this is a private crate dependency, you must specify the registry name in your Cargo.toml file. Cargo assumes crates.io as the default registry unless otherwise specified. Add the dependency as follows:

    CRATE_NAME = { version = "VERSION_NUMBER", registry = "FEED_NAME" }
    
    # Example:
    # [dependencies]
    # atomic-waker = { version = "1.1.2", registry = "Test_Feed" }
    
  5. Open a local command prompt, navigate to the root of your project, and run the following command to build your project and download the crate:

    cargo build
    
  6. Once the build completes, return to Azure DevOps > Artifacts and select your consuming feed (in this example, Test_Feed).

  7. Verify that the package you installed locally now appears in your downstream feed. Azure Artifacts automatically saves a copy of the package when it’s installed from an upstream source.

    A screenshot showing a package saved from an internal upstream in Azure Artifacts.