Azure Artifacts: Private Package Feeds (npm, NuGet, Maven)

Khimananda Oli 8 min read Virtualization
Azure Artifacts: Private Package Feeds (npm, NuGet, Maven)

By Khimananda Oli | Last reviewed: August 2026

Managing internal dependencies securely requires a dedicated registry that isolates proprietary code while caching public packages to prevent supply chain attacks. Azure Artifacts: Private Package Feeds (npm, NuGet, Maven) provides this isolation natively within Azure DevOps, eliminating the need for self-hosted Nexus or Artifactory instances. This guide covers the exact configuration steps, authentication patterns for CI/CD, and retention policies needed to run a production-grade private registry in 2026.

Before configuring feeds, ensure your underlying infrastructure supports secure connectivity. Teams often overlook network prerequisites when adopting managed services, leading to intermittent restore failures during deployment. Reviewing cloud networking fundamentals helps diagnose whether timeouts stem from feed configuration or egress filtering. For teams comparing cloud vendors before committing to Azure's ecosystem, understanding how artifact management differs across providers is critical; my comparison of AWS vs Azure vs Google Cloud details these trade-offs specifically for package management workflows.

CI/CD PipelineBuild AgentPrivate Feed(Internal Scope)Proprietary PkgsCached UpstreamsRetention Policiesnpmjs.orgPublic Upstreamnuget.orgPublic UpstreamMaven CentralPublic Upstream
Azure Artifacts architecture: Private feed caches public upstreams while serving proprietary packages to CI/CD agents

How do you configure Azure Artifacts: Private Package Feeds (npm, NuGet, Maven) with upstream sources?

Upstream sources are the most critical feature for supply chain security. They allow your private feed to proxy public registries, caching packages locally so builds remain reproducible even if public registries go offline or packages are unpublished. Without upstreams enabled, every build agent must reach the public internet directly, increasing attack surface and latency.

Create a feed with correct scoping

  1. Navigate to Artifacts in your Azure DevOps project sidebar.
  2. Select + Create feed. Name it descriptively (e.g., team-npm-prod, shared-nuget-libs).
  3. Set Visibility to Organization for shared libraries or Project for team-specific packages. Avoid "Public" unless intentionally open-sourcing.
  4. Check Include packages from common public feeds. This enables upstream sources automatically.
  5. Click Create.

After creation, verify upstream configuration under Feed settings → Upstream sources. You should see npmjs.org, nuget.org, and Maven Central listed as enabled. For Maven feeds, add custom upstreams like Gradle Plugins Portal if your projects require them. Disable any upstream you don't explicitly need — each enabled upstream expands your dependency resolution path and potential vulnerability surface.

Configure client-side registry mapping

Clients must know to use your private feed instead of public defaults. For npm, generate an .npmrc file from the feed's Connect to feed page. This file contains the scoped registry URL and authentication placeholder. Commit this file to your repository root (not globally) to ensure all developers and CI agents resolve packages consistently. For NuGet, add the feed URL to nuget.config at the solution level:

<configuration>
  <packageSources>
    <clear />
    <add key="MyPrivateFeed" value="https://pkgs.dev.azure.com/{org}/{project}/_packaging/{feed}/nuget/v3/index.json" />
  </packageSources>
</configuration>

The <clear /> directive prevents fallback to nuget.org directly, forcing all resolution through your private feed where upstream caching and policy enforcement occur. Omitting this is a common mistake that bypasses your security controls silently.

How do you authenticate CI/CD pipelines to Azure Artifacts private feeds?

Authentication failures cause more pipeline breakages than any other Artifacts issue. In 2026, never embed Personal Access Tokens (PATs) in pipeline variables or source code. Use service connections or built-in task authentication instead.

Use the native Authenticate task

Azure Pipelines provides a dedicated task that injects temporary credentials into the agent's environment. Place this before any restore/publish step:

- task: NuGetAuthenticate@1
  inputs:
    artifactFeeds: 'MyProject/MyNuGetFeed'

- script: dotnet restore
  displayName: 'Restore NuGet packages'

For npm, use npmAuthenticate@0 with the same pattern. This task generates a short-lived token scoped only to the specified feed, valid for the job duration. It eliminates credential rotation overhead and prevents token leakage in logs.

Service connections for cross-organization access

If your pipeline runs in Organization A but consumes feeds from Organization B, create an Azure Artifacts service connection under Project Settings → Service connections. Authenticate with a PAT that has Packaging Read scope only (never full access). Reference this connection in your pipeline tasks. This approach maintains least-privilege principles and survives user account deprovisioning — critical for SOC 2 compliance where automated systems must not depend on individual identities.

Pipeline YAMLDefinitionAuthenticateTask (v1)Injects Temp TokenRestore / Publishdotnet / npmUses Injected CredsPrivate FeedValidates TokenScope: Read/WriteToken Lifetime:Job Duration Only
Secure authentication flow: Authenticate task injects ephemeral tokens for CI/CD access to Azure Artifacts private feeds

What retention policies prevent storage bloat in Azure Artifacts?

Without retention rules, artifact feeds grow indefinitely. I've seen feeds exceed 500 GB within 18 months, driving significant costs and slowing restore operations. Azure Artifacts offers two complementary mechanisms: version retention and permanent delete.

Configure version retention limits

Under Feed settings → Retention policies, set maximum versions per package. For active development feeds, retain 50–100 versions. For release/stable feeds, retain only tagged releases (often 5–10 versions). Unchecked, pre-release packages from CI accumulate fastest — a single active branch can publish dozens of versions daily.

  • Days to keep recently used packages: Set to 30–90 days. Packages not restored within this window become eligible for deletion regardless of version count.
  • Maximum versions per package: Hard cap preventing unbounded growth. Oldest versions beyond this limit are deleted automatically.
  • Exclude protected releases: Tagged versions marked as "Release" bypass retention limits. Use this for production-deployed artifacts that must remain available for hotfix rollbacks.

Permanent deletion for compliance

Soft-deleted packages remain recoverable for 30 days. For GDPR, SOC 2, or ISO 27001 audits requiring verified data destruction, use the Permanently delete option after soft deletion. Document this process in your compliance evidence collection — auditors frequently request proof that deprecated packages containing sensitive logic or credentials were irreversibly removed. Automated retention satisfies operational hygiene; permanent deletion satisfies regulatory requirements.

How does Azure Artifacts compare to self-hosted alternatives for private packages?

Teams evaluating Azure Artifacts: Private Package Feeds (npm, NuGet, Maven) often compare against JFrog Artifactory, Sonatype Nexus, or GitHub Packages. The right choice depends on existing toolchain integration, compliance needs, and operational overhead tolerance.

CriteriaAzure ArtifactsJFrog ArtifactoryGitHub Packages
Azure DevOps IntegrationNative (zero config)Requires service connectionRequires PAT + config
Upstream CachingBuilt-in (npm/NuGet/Maven/PyPI)Advanced (all ecosystems)Limited (npm/Docker only)
RBAC GranularityFeed-level (Reader/Contributor/Owner)Repository + path-level permissionsRepo/org-level only
Compliance EvidenceAudit logs + retention policiesFull audit trail + signingBasic audit log
Operational OverheadZero (fully managed)High (self-host or SaaS mgmt)Low (managed)
Cost ModelPer-user + storage tierLicense + infrastructureIncluded with GH plan
Best ForAzure DevOps-native teamsMulti-cloud, complex governanceGitHub-centric workflows

If your organization already uses Azure DevOps for CI/CD and source control, Azure Artifacts eliminates integration friction entirely. Self-hosted alternatives justify their complexity only when you need multi-cloud neutrality, advanced promotion workflows (dev → staging → prod feeds), or support for ecosystems Azure doesn't cover (Go modules, Conan, Helm charts beyond basic OCI). For pure npm/NuGet/Maven workloads within Azure, the managed service wins on total cost of ownership and audit readiness.

Start: Need Private Feed?Evaluate RequirementsAzure DevOps Native?CI/CD + Repos in AzureMulti-Cloud / Advanced?Promotion, Signing, Go/HelmGitHub-Centric?Actions + Packages BundleAzure ArtifactsManaged + IntegratedArtifactory / NexusSelf-Hosted or SaaSGitHub PackagesBundled with PlanYesComplex NeedsGH Ecosystem
Decision framework: When to choose Azure Artifacts vs Artifactory vs GitHub Packages for private package feeds

Implement Azure Artifacts: Private Package Feeds (npm, NuGet, Maven) Securely Today

Adopting Azure Artifacts: Private Package Feeds (npm, NuGet, Maven) correctly means treating your package registry as a security boundary, not just a storage location. Enable upstream sources immediately to isolate builds from public registry volatility. Authenticate pipelines with ephemeral tokens via native tasks, never static PATs. Enforce retention policies before storage costs surprise you. These four practices separate teams that treat artifacts as an afterthought from those that build audit-ready, resilient supply chains.

If your team needs help designing compliant artifact workflows, integrating feeds with existing CI/CD pipelines, or preparing for SOC 2 evidence collection around dependency management, reach out for a consultation. I help organizations implement secure, automated package management that passes audits and scales without manual intervention.

Frequently Asked Questions

Navigate to Artifacts in Azure DevOps, click Create Feed, select npm as the format, and configure visibility settings. Generate a .npmrc file using the Connect to feed button to authenticate your local environment or CI pipeline immediately.

Azure Artifacts includes 2 GiB free per organization monthly. Beyond that, storage costs $1.95 per GiB. Data transfer out is charged separately. Check current 2026 pricing on the Azure calculator before scaling large monorepo dependencies.

Yes. Enable upstream sources during feed creation to cache public npm, NuGet, or Maven packages. This protects builds from registry outages and ensures consistent dependency resolution across development and production environments without manual intervention.

Use the NuGetAuthenticate@1 task before push commands. It automatically configures credentials for the target feed. Avoid storing personal access tokens in variables; let the service connection handle authentication securely within the pipeline context.

Yes. Azure Artifacts fully supports Maven Bill of Materials (BOM) imports for dependency management. Ensure your pom.xml references the correct feed URL and that upstream sources include Maven Central if external transitive dependencies are required.

Contributors role allows publishing. Readers can only download. Owners manage feed settings and retention policies. Assign permissions at the feed level rather than project level to maintain least-privilege access control across teams.

Azure Artifacts offers superior upstream caching and universal package support. GitHub Packages integrates tighter with GitHub Actions but lacks native Maven upstreams. Choose Azure Artifacts for enterprise multi-format needs and GitHub Packages for pure GitHub-centric workflows.

Expired or misconfigured PAT tokens cause most 401 errors. Regenerate your token with Packaging Read scope, update your .npmrc file, and verify the feed URL matches exactly. Clear npm cache if issues persist after credential rotation.

Yes. Self-hosted agents require explicit PAT configuration or managed identity setup. Use the npmAuthenticate or NuGetAuthenticate tasks to inject temporary credentials. Never store long-lived tokens directly on agent machines to prevent credential leakage.

Configure retention in feed settings to delete older versions automatically. Set minimum version counts and age limits per package type. Retention runs daily and cannot be undone, so test policies on non-critical feeds first.

Universal packages suit binary artifacts and non-standard formats. For JavaScript libraries, stick with npm format for ecosystem compatibility. Universal packages lack semantic versioning intelligence and tooling integration that npm registries provide natively.

Use nuget push with the feed endpoint as source. Batch uploads via Azure CLI az artifacts universal publish for large migrations. Verify all dependencies resolve through upstream sources before decommissioning legacy file shares or servers.

Yes. Add them as Stakeholders or Basic users with explicit feed permissions. Use Azure AD B2B guest accounts for secure external collaboration. Revoke access immediately upon contract completion to maintain supply chain security compliance.

Cached packages remain available indefinitely. New uncached dependencies fail until upstream recovers. Monitor upstream health dashboards and configure multiple upstream sources where possible to reduce single-point-of-failure risks in critical build pipelines.

No. Use views like Release and Prerelease within a single feed. Promote validated packages between views instead of duplicating feeds. This simplifies permission management and reduces storage costs while maintaining clear deployment stage boundaries.