Designing Feeds, Views and Upstream Sources
This lesson explains how packages enter a feed, and how they reach consumers at chosen quality levels.
Learning outcomes
After completing this lesson, you will be able to:
- Describe the upstream search order.
- Explain how saved packages protect builds.
- Explain dependency confusion and its defence.
- Use views to promote packages.
Feed scope and structure
A feed can be project-scoped or organization-scoped. New feeds are project-scoped by default, and they inherit the visibility of the project. Most organizations do best with few feeds. Too many feeds force consumers to configure several sources, which also introduces a security risk known as dependency confusion, explained below.
A common design has one feed for a product group. All internal packages are published to it, and it has upstream sources for the public registries. Developers and pipelines point only at this feed, and they receive internal and public packages from a single URL.
Upstream sources
An upstream source lets a feed serve packages stored elsewhere. It may be a public registry, such as NuGet.org, npmjs.com, PyPI or Maven Central, or another Azure Artifacts feed. When a package is requested, Azure Artifacts looks in the following order.
-
Packages published directly
Versions published to this feed are returned first.
-
Packages saved from upstreams
Versions previously saved to this feed come next.
-
Upstream sources
Upstream sources are searched in the order that they are configured.
When a user with Feed and Upstream Reader (Collaborator) rights or higher installs a package through the feed, that version is saved to the feed. The saved copy stays even if the original is removed from the public registry or the registry suffers an outage, which is a major reason to use this design. A reader without that right can consume saved packages, but cannot cause new ones to be saved, so this right should be assigned carefully, as pipelines often need it.
Public sources can lag behind: Microsoft notes a delay of typically 3 to 6 hours for NuGet.org, and usually a few minutes for Azure Artifacts upstreams. Package versions are immutable. If an upstream version must be overridden, the upstream is disabled, the replacement is published, and the upstream is enabled again. Custom upstream sources, which are registries other than the well-known public ones, are supported only for npm.
How upstream sources behave
Dependency confusion
Dependency confusion is an attack in which someone publishes a public package with the same name as an internal package, and with a higher version. If a build searches both a private and a public source, it may install the attacker's package. Azure Artifacts defends against this: once a package name exists as an internal package in a feed, the feed blocks externally sourced versions of that name by default. Using a single feed with upstreams, rather than several sources on the client, keeps that protection in force. Package scopes or prefixes, such as npm scopes, add a further safeguard.
Defending against dependency confusion
Views
A view filters a feed so that consumers see only versions that have reached a certain quality level. Every feed has three by default: @local, @prerelease and @release. @local is the default view, and it shows packages that were published to the feed or saved from upstreams. The other two are suggested views, which may be renamed or deleted.
Views are read-only, and packages are published only to @local. A version is then promoted by adding it to a view, which does not change or copy the package. Promotion can be done in the web interface or by a pipeline through the REST API or a task, and a typical flow promotes to @prerelease after integration tests pass, and to @release after production validation.
Consumers select a quality level by using the view in the feed URL, for example https://pkgs.dev.azure.com/contoso/_packaging/shared@Release/nuget/v3/index.json. A team that wants only stable packages uses the @release view, and a team testing the newest versions uses @prerelease. This prevents an unverified package from reaching a production build, with no separate feeds.
The following diagram shows an Azure Artifacts feed, its views and who consumes each.

A package's journey through views
Publishing from a pipeline
The following Azure Pipelines excerpt packs and publishes a NuGet package to a feed. The Build Service identity needs Feed Publisher rights on that feed.
steps:
- task: NuGetAuthenticate@1
- script: dotnet pack src/Contoso.Core --configuration Release --output $(Build.ArtifactStagingDirectory)
displayName: Create the package
- script: >
dotnet nuget push $(Build.ArtifactStagingDirectory)/*.nupkg
--source https://pkgs.dev.azure.com/contoso/_packaging/shared/nuget/v3/index.json
--api-key AzureArtifacts
displayName: Publish to the feedWith dotnet nuget push, the API key value is required but ignored, and NuGetAuthenticate@1 provides the real credentials.
Publishing a NuGet package from Azure Pipelines
A safe consumption design
Production builds must never consume a package that has not passed integration tests. Test teams must be able to try new internal packages immediately. Builds must keep working if npmjs.com is unavailable. What should you design in Azure Artifacts?
Use one feed with npmjs as an upstream source, so that public packages are saved and remain available during an outage. Publish internal packages to @local, and promote them to @prerelease and then to @release. Production builds use the @release view, and test teams use @local or @prerelease. Three separate feeds would need packages to be copied, and direct configuration of npmjs.com in each project would lose the outage protection.
A feed has packages in @local. Can a pipeline publish directly to @release?
Show answer
No. Packages are published to @local and then promoted, because views are read-only.
Exam Tips
Remember for the exam
- Search order: published packages, saved packages, then upstreams in order.
- Saved upstream packages stay available during a public outage.
- Publish to @local; promote to @prerelease and @release.
- Consumers select a quality level through the view in the feed URL.
- One feed with upstreams helps to prevent dependency confusion.