Universal Package in Azure DevOps - Hemant Kabra

Universal Packages in Azure DevOps: A Complete Guide


In the world of DevOps, managing and distributing artifacts efficiently is crucial. Azure DevOps offers a powerful feature called Universal Packages that simplifies the storage and sharing of non-code artifacts across your organization. In this blog, we’ll explore what Universal Packages are, their benefits, use cases, how to publish and download them, best practices, and key considerations.

📦 What is a Universal Package?

A Universal Package is a type of artifact in Azure Artifacts that allows you to store virtually any file or set of files. Unlike NuGet, npm, or Maven packages, Universal Packages are format-agnostic, making them ideal for storing tools, binaries, configuration files, scripts, or any other assets that don’t fit into traditional package types.

✅ Benefits of Using Universal Packages

  • Format Flexibility: Store any file type—no need to conform to a specific package format.
  • Versioning: Track changes and maintain multiple versions of your artifacts.
  • Access Control: Use Azure DevOps security to manage who can publish or consume packages.
  • Integration: Seamlessly integrate with CI/CD pipelines in Azure DevOps.
  • Centralized Storage: Keep all your artifacts in one place, improving discoverability and reuse.

📂 What Can You Store in a Universal Package?

You can store any kind of data, but here are some recommended use cases:

  • Internal CLI tools or utilities
  • Configuration files or templates
  • Machine learning models
  • Static website assets
  • Deployment scripts
  • Precompiled binaries or libraries

🛠️ Prerequisites

Before using Universal Packages, ensure:

  • You have an Azure DevOps organization and project.
  • Azure Artifacts is enabled.
  • You have installed the Azure CLI and the Azure DevOps extension:
  az extension add --name azure-devops
  • You are signed in and have set the default organization/project:
  az login

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

📤 How to Publish a Universal Package

az artifacts universal publish \
  --organization https://dev.azure.com/your-org \
  --feed your-feed-name \
  --name your-package-name \
  --version 1.0.0 \
  --description "My universal package" \
  --path ./path-to-your-files

📥 How to Download a Universal Package

🔹 Using Azure CLI

az artifacts universal download \
  --organization https://dev.azure.com/your-org \
  --feed your-feed-name \
  --name your-package-name \
  --version 1.0.0 \
  --path ./download-location

🔹 Using Azure DevOps Release Pipeline

To use a Universal Package in a Release Pipeline, follow these steps:

🧱 Classic Release Pipeline

  1. Add an Agent Job to your release stage.
  2. Add a task: Download Universal Package.
  3. Configure:
    • Feed: Your Azure Artifacts feed.
    • Package Name: The name of your package.
    • Version: Specific version or latest.
    • Download Path: Directory where the package should be extracted.

🧱 YAML Pipeline

- task: UniversalPackages@0
  inputs:
    command: 'download'
    feed: 'your-feed-name'
    packageName: 'your-package-name'
    packageVersion: '1.0.0'
    downloadDirectory: '$(Build.ArtifactStagingDirectory)/your-package'

💡 You can then reference the downloaded files in subsequent tasks using the path $(Build.ArtifactStagingDirectory)/your-package.


🧠 Best Practices

  • Semantic Versioning: Use semantic versioning (e.g., 1.0.0) to manage updates and compatibility.
  • Automation: Integrate publishing and downloading into your CI/CD pipelines.
  • Access Policies: Use Azure DevOps permissions to control access to feeds.
  • Documentation: Include README or metadata files in your packages for clarity.
  • Retention Policies: Set up retention rules to clean up old or unused packages.

⚠️ Limitations & Considerations

  • Size Limits: There may be size limits per package or feed depending on your Azure DevOps plan.
  • No Native Format Validation: Since it’s format-agnostic, you must ensure consistency and structure yourself.
  • CLI Dependency: Requires Azure CLI and DevOps extension for interaction.
  • Not Ideal for Public Sharing: Best suited for internal use within an organization.

🧩 Conclusion

Universal Packages in Azure DevOps are a versatile and powerful way to manage and distribute non-code artifacts. Whether you’re storing internal tools, configuration files, or machine learning models, they provide a centralized, secure, and versioned solution that integrates seamlessly with your DevOps workflows.

Leave a Reply

Your email address will not be published. Required fields are marked *