Search code examples
azure-devopsazure-pipelinescicd

Install npm Azure Artifacts package from one organization in the pipeline of another organization without PAT


I have created an npm package in Azure Artifacts in Organization1 and want to be able for the pipelines to install it when running in Organization2. Both organizations are in the same tenant. I have managed to achieve this with a service connection using a PAT. However, this requires a refresh of the PAT every few months and it is connected to a specific person. We do not want this dependency. Is there another way?


Solution

  • However, this requires a refresh of the PAT every few months and it is connected to a specific person. We do not want this dependency. Is there another way?

    As both organizations are in the same tenant, you can setup upstream source on organization2 feed to install the package from organization1.

    You can follow the doc Add a feed in a different organization as an upstream source to setup upstream source on organization2 feed.

    enter image description here

    My NPM upstream resource for your reference:

    enter image description here

    To install pacakge1 from organization1, i used below task on organziation2 pipeline:

    enter image description here

    Package installed successfully, and the package will be download to the organziation2 feed. You can check the doc the doc for the upstream behavior.

    enter image description here

    PS: when you configure upstream source on organization2 feed and save, but encounter permission error like below:

    enter image description here

    please make sure the source feed on organziation1 was created with Microsoft Entra visibility.

    enter image description here