Search code examples
azureazure-devopsazure-artifacts

Access Azure DevOps Artifact Feed from different organization


We have created a package in our company's Azure DevOps organization; it is uploaded as an artifact and can be used in pipelines in the same organization. This all works perfectly.

We now want to use the same package in a narrow, clearly defined set of other organizations. But when we try to access the package from within a pipeline of another organization, we receive an error message: The package is not found.

How can we give other "organizations" in Azure DevOps access to the package?


Solution

  • How can we give other "organizations" in Azure DevOps access to the package?

    You can use service connections to do that. The service connection type you need to choose depends on the type of your package.

    Here is an example of getting access to a universal package from another organization.

    Step1:

    Go to Project Settings -> Pipelines/Service connections -> New service connection -> Azure Repos/Team Foundation Server -> Next.

    Connect this project to the organization of the package.

    Step2:

    If you are using Classic UI pipeline, add a built-in task 'Universal packages'. Choose 'Another organization/collection' in 'Feed location'. Choose the connection you created in step1 and fill in information of the feed.

    If you are using YAML, add the following task:

    - task: UniversalPackages@0
      displayName: 'Universal download'
      inputs:
        feedsToUse: external
        externalFeedCredentials: {service connection}
        # if you are using project-scoped feed, replace {feed} with {project/feed}
        feedDownloadExternal: {feed}
        packageDownloadExternal: {package}
        versionDownloadExternal: {version number}
    

    If you want to connect to a Npm/Nuget/Maven/... package, you need to create a correspondant service connection and use Feed URL instead of organization URL. Then in pipeline, you need to run an authenticate task (you can find it in built-in task list) before using the package. Click this document for detailed information.