In Azure Artifacts, what does an upstream source on a feed do the first time a build restores a package the feed does not already hold?
answer
- feed is a caching proxy, not a mirror
- local contents checked before upstream
- first request saves a copy
- role gates who may save
- survives an upstream unpublish
basics
~20 sThe feed fetches that package version from the upstream registry, saves a copy into the feed itself, and serves the saved copy on every later request. Public packages and internal ones then come from one URL, and the copy survives if upstream removes the original.
solid answer
~50 sAn upstream source makes the feed a caching proxy in front of a public registry — nuget.org, npmjs.com, Maven Central, PyPI — or in front of another Azure Artifacts feed. Resolution order is feed-first: Azure Artifacts looks in the feed's own `@local` contents, and only if the requested version is not there does it consult the upstream sources in the order you configured them. When it finds the version upstream it downloads it and *saves a copy into the feed*, so subsequent restores are served locally. That save requires the requesting identity to hold at least the Collaborator role; a plain Reader can consume already-saved packages but cannot pull new ones through. The payoff is a single URL in `nuget.config` or `.npmrc` for internal and public packages alike, one audit point for everything the build consumes, and continuity if a package is unpublished or yanked upstream — your saved copy remains.
go deeper
Know that an upstream source lets one feed URL serve both internal and public packages, and that the public package is copied into the feed the first time someone asks for it.
Explain the resolution order — feed contents first, then upstreams in configured order — and that the save is permanent rather than an expiring cache, plus which role is needed to trigger it.
Be ready to reason about the operational consequences: continuity after an upstream unpublish, egress restrictions on agents, upstream ordering as a trust decision, and why upstream is not a vetting mechanism.
Own the topology question — a curated feed consumed by teams with a permissive feed behind it, versus every team pointing straight at a public upstream — and defend the review cost that curation adds.
## The problem upstreams solve Without upstream sources a build has two package sources configured: your private feed for internal libraries and the public registry for everything else. That is two URLs to keep in sync across every repo and agent, two sets of network egress rules, and — critically — a client that is free to choose between them by version number rather than by trust. Upstream sources collapse that into one endpoint. ## What happens on a miss Configure `nuget.org` (or `npmjs.com`, Maven Central, PyPI) as an upstream on your feed, point the client only at the feed, and then: 1. The client asks the feed for `Newtonsoft.Json 13.0.3`. 2. Azure Artifacts checks the feed's own contents first — the `@local` view, which holds everything published to the feed plus everything previously saved from upstream. 3. Not found locally, so it walks the configured upstream sources **in order**. 4. The first upstream that has that exact version supplies it. Azure Artifacts streams it to the client **and saves a copy into the feed**. 5. Every later request for that version is answered from the feed. Upstream is not contacted again for it. This is a save, not a transient cache with an expiry you have to reason about. Once the version is in the feed it is a first-class package there: it appears in the feed's package list, it is covered by feed permissions, and it is subject to the feed's retention policy. ## Who is allowed to trigger a save Saving from upstream is a privileged act, because it puts new bytes into a registry your whole organization consumes. The feed roles gate it: - **Reader** — can download packages already in the feed, but a request for a version that is not there will not be saved on their behalf. - **Collaborator** — can cause packages to be saved from upstream, but cannot publish packages of their own. - **Contributor** and **Owner** — can do both. Collaborator exists precisely so you can let CI (or most engineers) hydrate the feed from public registries without granting the right to publish under an internal package name. In CI this matters because the build identity's role decides whether a fresh dependency restores or fails. ## What upstreams can point at Beyond the big public registries, an upstream can be **another Azure Artifacts feed**. That is how a layered setup works: a curated "golden" feed with vetted packages, and team feeds that take the golden feed as their upstream. Consuming a feed that lives in a *different organization* is done through one of its **views** rather than the raw feed, which is one of the main practical reasons views exist at all. ## What it buys you - **One URL.** Client config names the feed and nothing else. There is no second source for a client to prefer. - **Continuity.** If a package is unpublished, yanked, or the upstream registry has an outage, the versions you already consumed are still in your feed. Teams that lived through a popular package being unpublished remember this one. - **An audit point.** Everything the organization has ever pulled from a public registry is enumerable in one place, which is what a supply-chain review actually needs. - **Fewer egress paths.** Build agents talk to one host, which simplifies proxy and firewall rules on locked-down networks. ## What it does not buy you An upstream source is not a scanner and not an approval gate. Azure Artifacts saves what the build asked for; it does not judge whether the package is safe. If you want vetting, you need a curated feed that engineers consume and a separate, more permissive feed where new packages arrive — or a scanning step in the pipeline. Nor is it a mirror: nothing is pre-fetched. The feed only ever holds versions someone actually asked for, which is usually what you want but does mean a brand-new dependency still needs a live upstream at first restore. ## The failure modes worth naming - A pipeline restoring a *new* dependency fails while the same restore works locally: the build identity has Reader, not Collaborator, so nothing can be saved on its behalf. - An air-gapped or proxy-restricted agent fails on first restore of a package but succeeds afterwards, because only the miss path needs upstream connectivity. - Upstream ordering surprises: with two upstreams that both carry a name, the first one in the list that has the requested version wins, so the order in feed settings is a trust decision, not cosmetics.
- If a package is removed from the public registry after your feed already saved it, what happens to your builds?They keep working. The saved copy lives in the feed and is served from `@local`, so restores never touch upstream for that version again. Only a version the feed has never seen would fail, because the miss path is the only one that needs upstream to be reachable.
- Why would you give a build identity Collaborator rather than Contributor on a feed?Collaborator lets the build hydrate the feed from upstream sources — so new public dependencies restore — without granting the right to publish packages into the feed. That keeps the ability to create an internal package name confined to the pipelines that are supposed to publish.
- What happens when two upstream sources on the same feed both offer the requested package version?The feed walks the upstream list in configured order and takes the first one that has that version. The order is therefore a trust ranking: put your curated internal feed above the public registry so vetted copies win, rather than treating the list as unordered.
- Does adding an upstream source pre-populate the feed with the public registry?No. Nothing is copied until a client actually requests a version that the feed lacks. The feed only ever accumulates what your builds and developers really consumed, which keeps it small and makes the package list a genuine inventory of your dependency surface.
saying these in an interview costs you the question
- Claiming the whole public registry gets mirrored into the feed
- Thinking the cached copy expires and re-downloads on a schedule
- Believing upstream sources scan or approve packages
- Saying upstream is checked before the feed's own packages
- Assuming any Reader can pull a brand-new package through upstream