Publish npm packages (YAML/Classic)

Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019 | TFS 2018

Using Azure Pipelines, you can publish your npm packages to Azure Artifacts feeds or to public registries such as In this article, you will learn how to publish your npm packages using YAML and Classic pipelines.

Publish to Azure Artifacts feeds


The Project Collection Build Service and your project's Build Service identity must be set to Contributor to publish your packages to a feed using Azure Pipelines. See Add new users/groups for more details.

- task: Npm@1
    command: publish
    publishRegistry: useFeed
    publishFeed: <FEED_NAME>        ## For project-scoped feeds, use: <PROJECT_NAME>/<FEED_NAME> 
  • publishRegistry: Options: useExternalRegistry, useFeed. Select useFeed to use a feed within your organization.
  • publishFeed: Required when publishRegistry = useFeed. The feed you want to publish to.


Using the YAML editor to add the npm publish task will generate the project and feed IDs for your publishFeed.

YAML is not supported in TFS.

Publish to a public registry

To publish your packages to a public npm registry such as, you must first create a service connection to connect to the desired external service.

  1. Select Project settings, and then select Service connections.

  2. Select Create service connection to create a new service connection.

    Screenshot showing how to create a new service connection

  3. Select npm and then select Next. Fill out the required fields, and then select Save when you are done.

- task: Npm@1
    command: publish
    publishRegistry: useExternalRegistry
    publishEndpoint: '<NAME_OF_YOUR_SERVICE_CONNECTION>'
  • publishRegistry: Select useExternalRegistry to publish to a public registry. Options: useExternalRegistry | useFeed.
  • publishEndpoint: required when publishRegistry == useExternalRegistry. Replace the placeholder with the name of the service connection you created earlier.

YAML is not supported in TFS.