Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
title description ms.assetid ms.service ms.topic ms.date monikerRange recommendations
Publish and download universal packages in Azure Artifacts
How to publish and download universal packages to and from Artifacts feeds.
f47b858c-138d-426d-894c-a5fe1d5aa08e
azure-devops-artifacts
conceptual
05/19/2023
azure-devops
true

Publish and download universal packages in Azure Artifacts

Universal Packages offer developers the capability to store an extensive array of package types that extend beyond the conventional ones, such as NuGet, npm, Maven, or Python packages. Using Azure CLI, you can conveniently publish and download universal packages directly from the command line. The size of published packages can vary, reaching up to 4 TB, but must always maintain the essential requirement of including a name and version number. This article will walk you through the steps to publish and download your universal packages to your Azure Artifacts feed.

Prerequisites

Project setup

Windows

  1. Run the following command to install the Azure DevOps extension.

    az extension add --name azure-devops
    
  2. If you already have the Azure DevOps extension installed and wish to update it to the latest version, run the following command::

    az extension update --name azure-devops
    
  3. Log in to Azure.

    az login
    

[!TIP] To access tenants without subscriptions, run az login --allow-no-subscription.

  1. Set your project and organization as the CLI's default.

    az devops configure --defaults project=<YOUR_PROJECT_NAME> organization=https://dev.azure.com/<YOUR_ORGANIZATION_NAME> 
    

Other

  1. Create a Personal Access Token with Packaging Read & write scope, and then copy it to your clipboard.

  2. Run the following command to log in. When prompted, enter the personal access token you created in the previous step.

    az devops login --organization https://dev.azure.com/<YOUR_ORGANIZATION_NAME> 
    

Publish packages

To publish a universal package, run the following command in an elevated command prompt. Package names must be lowercase, start and end with letters or numbers, and contain only letters, numbers, and nonconsecutive dashes, underscores, and periods. Package versions must be lowercase without build metadata (+ suffix). See SemVer to learn more about semantic versioning.

  • Organization-scoped feed:

    az artifacts universal publish --organization https://dev.azure.com/<YOUR_ORGANIZATION> --feed <FEED_NAME> --name <PACKAGE_NAME> --version <PACKAGE_VERSION> --path <PACKAGE_DIRECTORY> --description <PACKAGE_DESCRIPTION>
    
  • Project-scoped feed:

    az artifacts universal publish --organization https://dev.azure.com/<YOUR_ORGANIZATION> --project <PROJECT_NAME> --scope project --feed <FEED_NAME> --name <PACKAGE_NAME> --version <PACKAGE_VERSION> --path <PACKAGE_DIRECTORY> --description <PACKAGE_DESCRIPTION>
    

View published packages

  1. Sign in to your Azure DevOps organization, and then navigate to your project.

  2. Select Artifacts, and then select your feed from the drop-down menu. Once publishing is completed successfully, your package should be available in your feed.

    :::image type="content" source="media/universal-package-published.png" alt-text="A screenshot showing the newly published universal package.":::

Download packages

To download a universal package using Azure CLI, run the following command in an elevated command prompt.

  • Organization-scoped feed:

    az artifacts universal download --organization https://dev.azure.com/<YOUR_ORGANIZATION> --feed <FEED_NAME> --name <PACKAGE_NAME> --version <PACKAGE_VERSION> --path <DOWNLOAD_PATH>
    
  • Project-scoped feed:

    az artifacts universal download --organization https://dev.azure.com/<YOUR_ORGANIZATION> --project <PROJECT_NAME> --scope project --feed <FEED_NAME> --name <PACKAGE_NAME> --version <PACKAGE_VERSION> --path <DOWNLOAD_PATH>
    

Download specific files

If you only want to download specific files, you can use the --file-filter parameter to download a subset of files. See File matching patterns reference for more details.

Example: --file-filter logs/.log would match any file ending with logs and with the extension .log (Example: build123_logs.log).

  • Organization-scoped feed:

    az artifacts universal download --organization https://dev.azure.com/<YOUR_ORGANIZATION> --feed <FEED_NAME> --name <PACKAGE_NAME> --version <PACKAGE_VERSION> --path <DOWNLOAD_PATH> --file-filter <MATCH_PATTERN>
    
  • Project-scoped feed:

    az artifacts universal download --organization https://dev.azure.com/<YOUR_ORGANIZATION> --project <PROJECT_NAME> --scope project --feed <FEED_NAME> --name <PACKAGE_NAME> --version <PACKAGE_VERSION> --path <DOWNLOAD_PATH> --file-filter <MATCH_PATTERN>
    

Download the latest version

You can use wildcards * to download the latest version of your Universal Packages.

Examples:

  • --version '*': download the latest version.

  • --version '1.*': download the latest version with major 1.

  • --version '1.2.*': download the latest patch release with major 1 and minor 2.

[!NOTE] Wildcard patterns are not supported with pre-release versions (packages with a dash in their version number).

Related articles