Getty Images/iStockphoto

Ease package management with this Azure Artifacts tutorial

An extension of the Azure DevOps service, Azure Artifacts can help developers manage and share packages to streamline the overall development process.

Configuration data controls how a cloud application is deployed and used. Typically, developers create a temporary environment to integrate server code and configuration data. In Azure, these environments are called Artifacts.

With Azure Artifacts, developers can publish and share software packages across their teams and companies, as well as make those packages public.

What is Azure Artifacts?

Azure Artifacts is part of the Azure DevOps suite of tools. It serves as a centralized environment for developers to share and manage code, packages and artifacts.

The service helps developers locate, install and publish NPM, NuGet, Python and Maven package types.

When should I use Azure Artifacts?

The Azure Artifacts service automates the process of building and deploying software artifacts such as libraries, executables and documents. It supports a variety of popular languages and frameworks.

Because it is hosted in the cloud, Azure Artifacts comes with built-in security features and enables developers to build projects on top of what others created before them. It is encrypted at rest, high performant and reliable.

What's included in Azure Artifacts?

Azure Artifacts includes several features to manage software development artifacts. These include:

  • a package management system that lets you host and share NuGet, NPM, Python and Apache Maven packages within your team or organization;
  • an integrated build system that lets you automatically publish packages to Azure Artifacts as part of the build process;
  • a dependency manager that simplifies how you keep track of dependencies between versions of your packages; and
  • a user interface that makes it easy to browse and search for packages, view package details and manage account settings.

Azure Artifacts tutorial: Get started

To use Azure Artifacts, you need an Azure DevOps account.

If you already have an account, log in using that account. If not, create an account via Microsoft's DevOps portal or the GitHub sign-up page.

Then, follow these steps to publish a NuGet package:

1. Create an Azure DevOps organization

In Azure DevOps, an organization helps you work with several related projects. To create an organization in Azure DevOps, follow these steps:

    1. Once you've signed into Azure DevOps, click New Organization
    2. Specify the name of the organization
    3. Specify where you want the organization to be hosted
    4. Click Continue

You can view your artifacts and their usage limits from Organization Settings.

2. Create a project

A project in Azure DevOps is used to set up a repository that contains source code and to plan, track and manage the work. To create a new project in Azure DevOps, follow these steps:

    1. On the Azure DevOps page, select your desired Organization
    2. Click New Project
    3. Specify a name and description for your project
      A screen to write your project name and option to select visibility preference
      Specify a project name and visibility preference
    4. Specify visibility (Public or Private) for your project
    5. Select your preferred version control system
    6. Select the work item process template
    7. Click Create to complete the process

Figure 2 shows the new project we've created in Azure DevOps:

Your project screen has been created, select your desired services
A new Azure DevOps project

3. Connect to a feed

Next, we connect to an Azure Artifacts feed, which is where developers store and share packages. To connect to a particular feed, follow these the steps:

    1. Select Artifacts
    2. Click Connect to Feed
      Select the connect to a feed button
      Connect to a feed
    3. Select the feed you want to connect to. In this Azure Artifacts tutorial, we'll connect to the NuGet feed, as shown in Figure 4
      Connect to the NuGet feed
      A NuGet feed in Azure Artifacts
    4. Follow the instructions provided in the nuget.config.file to set up your project

4. Publish the package(s)

To publish the NuGet package to your feed, type the command below at an elevated command prompt:

nuget push <PACKAGE_PATH> -src https://pkgs.dev.azure.com/<ORGANIZATION>/<PROJECT>/_packaging/<FEED>/nuget/v3/index.json -ApiKey <STRING_VALUE>

Best practices for Azure Artifacts

Always use the latest version of the tool, SDK, runtime and language SDK. This ensures access to all available capabilities and fixes to problems in earlier releases. It also ensures your code is compatible with newer versions of Azure Artifacts.

Second, when configuring an Azure DevOps pipeline, include a restore step for NuGet or NPM packages. This ensures packages are restored before your build begins.

Finally, if you're using multiple package feeds, be sure to configure your pipeline so that it uses the correct feed for each package.

Dig Deeper on Cloud provider platforms and tools