Publish and download universal packages

With universal packages, users are able to store different types of packages other than the widely used ones like NuGet, npm, Maven, or Python packages. Uploaded packages can vary in size (tested up to 4 TB) but should always have a name and a version number. You can publish and download universal packages from the command line using the Azure CLI.

This quickstart will walk you through the steps to publish and download your first universal package to/from your feed using the command line.

Prerequisites

  1. Download and install the latest Azure CLI version.
  2. If you're using Linux, make sure you have the appropriate .NET on Linux version.

To check the version of Azure CLI modules and extensions that you currently have, run the following command:

az --version

You can install the Azure DevOps extension using the following command:

az extension add --name azure-devops

If you already have the Azure DevOps extension but you want to update to the latest version, run the following command:

az extension update --name azure-devops

Create a feed

A feed is an organizational construct that allows you to store and manage your packages and control who can access them.

With Azure Artifacts, you can create two types of feeds: project-scoped and organization-scoped feeds. All public feeds are project-scoped and they inherit the hosting project's visibility settings. By default, any feed that's created by using the web UI is a project-scoped feed, as follows.

  1. From within your project, navigate to Azure Artifacts.

    Go to Azure Artifacts

  2. Select Create Feed.

    New feed button

  3. Give your feed a Name and choose its visibility, upstream sources, and scope settings.

    New feed dialog box

  4. When you are done, select Create.

Note

Enabling upstream sources allows you to consume packages from public registries and gives you more protection against outages and corrupted packages.

Azure Artifacts is installed by default for TFS 2017 customers. You must upgrade to TFS 2017 in order to use Azure Artifacts. If this is the first time using your feed, you might be asked to assign a license

  1. Go to Build & Release and select Packages.

    Go to Azure Artifacts TFS

  2. Select + New feed.

    New feed button TFS

  3. Give your feed a Name, a Description, and set up who can read, who can contribute and if you want to Include external packages.

    New feed dialog box TFS

Note

Enabling upstream sources allows you to consume packages from public registries and gives you more protection against outages and corrupted packages.

Log in to Azure DevOps

After you've installed the Azure CLI, run the following command in an elevated command prompt window to log in to Azure. Replace the text in the square brackets [] with the appropriate names.

az login

Tip

To access tenants without subscriptions, run az login --allow-no-subscription.

Next, set your project and organization as the CLI's default.

az devops configure --defaults organization=https://dev.azure.com/[your-organization] project=[your-project-name]

Publish a universal package

Now we can use the az artifacts universal command to manage our universal packages. In the following example we will publish my-first-package, version 1.0.0 to FabrikamFiber feed in the Fabrikam organization. FibrikamFiber is an organization-scoped feed.

Package names must be lowercase and can only use letters, numbers, and dashes. Package versions must be lowercase without build metadata (+ suffix). See SemVer to learn more about semantic versioning.

az artifacts universal publish --organization https://dev.azure.com/Fabrikam --feed FabrikamFiber --name my-first-package --version 1.0.0 --description "My first universal package" --path .

View the package in your feed

To view the package that you just published, go to your organization, select your project, select Artifacts, then select your feed from the drop-down menu.

View published universal package

Download a universal package

Now that you've published your first universal package, let's try to download it using Azure CLI. The following example will download the package that we published earlier.

az artifacts universal download --organization https://dev.azure.com/Fabrikam --feed FabrikamFiber --name my-first-package --version 1.0.0 --path .

Note

Azure DevOps doesn't support direct HTTP/HTTPS download links.

Download specific files

If you don't need the entire Universal Package and only need specific files, you can use the --file-filter parameter to download a subset of files.

The following example *logs/*.log would match any file ending with logs and with the extension .log. Example: build123_logs.log

See File matching patterns reference for more details.

az artifacts universal download --organization https://dev.azure.com/fabrikam --feed FabrikamFiber --name my-first-package --version 1.0.0 --path .  --file-filter *logs/*.log

Downloading the latest version

To download the latest version of a universal package, you can use wildcards in the string you pass to the version argument.

--version *: latest version. --version 1.*: latest version with major version 1. --version 1.2.*: latest patch release with major version 1 and minor version 2.

Note

pre-release versions does not support wildcards.

Next steps