Search code examples
azure-devopsazure-pipelinesazure-artifacts

How to manually publish a file to Azure Artifacts?


I have a file which I have created manually on my local computer. I need it in several Azure DevOps pipelines.

I want to use it as an "Artifact".

I know how to publish artifacts from within an Azure DevOps Pipeline, but this specific file I just want to upload from my computer. How can I do it?


Solution

  • How to manually publish a file to Azure Artifacts?

    As we know, the essence of Artifact is the storage of a shared file. We can roughly get this information from the Publish build artifacts task:

    enter image description here

    But the default value of Artifact publish location is Azure Pipelines:

    enter image description here

    This is a shared place set up on Azure.

    Update:

    Thanks hey sharing:

    We could upload from local to the shared place with AZ command line, like:

    az artifacts universal publish --organization https://dev.azure.com/example/ --feed my_feed --name my-artifact-name --version 0.0.1 --description "Test Description" --path

    Now let us return to the first sentence we started with "the essence of Artifact is the storage of a shared file", so we could create a shared place/folder to save the file. It is now seen as "Artifact". Then we just need make sure other pipelines could access this shared place/folder.

    For example, we could create a folder on the server where our private agent is located, then we just need to copy your file to that folder. Now, we could use it when we build the pipeline with private agent. Obviously this is not limited to local folders, we can also create a network folder, only need to ensure that other pipelines can access it.

    Hope this helps.