Publish and download universal packages with Azure CLI
With universal packages, you can store different types of packages other than the widely used ones such as NuGet, npm, Maven, or Python packages. Using Azure CLI, you can publish and download universal packages from the command line. Uploaded packages can vary in size (up to 4 TB), but should always have a name and a version number. This article will walk you through the steps to publish and download your universal packages to Azure Artifacts feeds.
- Install Azure CLI.
- If you're using Linux, make sure you install the .NET on Linux version.
- Azure DevOps Services account.
- Azure Artifacts feed.
To check the version of Azure CLI modules and extensions that you currently have, run the following command:
Install the Azure DevOps extension.
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
Log in to Azure.
To access tenants without subscriptions, run
az login --allow-no-subscription.
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>
Publish universal 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 non-consecutive dashes, underscores, and periods. Package versions must be lowercase without build metadata (+ suffix). See SemVer to learn more about semantic versioning.
The following command will publish a universal package to an organization-scoped feed:
az artifacts universal publish --organization https://dev.azure.com/<YOUR_ORGANIZATION> --feed <FEED_NAME> --name <PACKAGE_NAME> --version <PACKAGE_VERSION> --description <PACKAGE_DESCRIPTION> --path <PACKAGE_DIRECTORY>
View published packages
Navigate to your Azure DevOps organization.
Select your project, and then select Artifacts.
Select your feed from the drop-down menu.
Download universal packages
To download a universal package using Azure CLI, run the following command in an elevated command prompt.
az artifacts universal download --organization https://dev.azure.com/<YOUR_ORGANIZATION> --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.
--file-filter *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/<YOUR_ORGANIZATION> --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.
--version '*': the latest version.
--version '1.*': the latest version with major 1.
--version '1.2.*': the latest patch release with major 1 and minor 2.
Wildcard patterns are not supported with pre-release versions (packages with a dash in their version number).