Hands-on Demo – Creating, Pushing and Updation Package feed in Azure DevOps


LearnAzureDevOps-O5

Hands-on Demo – Creating, Pushing and Updation Package feed in Azure DevOps

In this demo, we will cover the following actions related to Azure Artifacts:

  1. What are Feeds in Azure Artifacts?

  2. Controlling Access to Feeds

  3. Creating a Package Feed

  4. Pushing a Package to Azure Artifacts

  5. Updating Packages

1. What are Feeds in Azure Artifacts?

Feeds in Azure Artifacts are storage containers for packages within your Azure DevOps organization. You can use these feeds to manage and share dependencies with your team or across multiple teams within your organization.

Feeds can hold different types of packages, including NuGet, npm, Maven, Python (PyPI), and Universal Packages.

  1. Public Feeds: Share packages publicly with the community or within your organization.

  2. Private Feeds: Share packages within your organization and control access using permissions.

2. Controlling Access to Feeds

In Azure Artifacts, you can control access to your package feeds through Azure Active Directory (AAD) and Azure DevOps permissions. You can assign specific permissions to users or groups, like Reader, Contributor, or Administrator.

  1. Reader: Can only download packages.

  2. Contributor: Can upload and download packages.

  3. Administrator: Can manage feed settings and permissions.

Steps to Control Access:

  1. Navigate to the Feed:

  • In Azure DevOps, go to Artifacts from your project dashboard.

  • Select the feed you want to configure.

  • Set Permissions:

    • Click on the Settings gear icon on the top-right corner of the feed page.

    • Under Permissions, add users or groups and assign the appropriate role.

    • For example, assign Reader role for users who only need to consume packages.

3. Creating a Package Feed

Creating a feed in Azure Artifacts allows you to organize and store your packages.

Steps to Create a Feed:

  1. Go to Azure DevOps:

  • Sign in to your Azure DevOps organization.

  • Navigate to the Artifacts section from your project.

  1. Create a New Feed:

  • Click on + New Feed.

  • Name your feed (e.g., MyPackagesFeed).

  • Choose whether it’s a public or private feed (select private for internal packages).

  • Optionally, you can add upstream sources (to fetch external packages) or configure retention policies.

  1. Create Feed:

  • Click on Create to set up the feed.

  • Once created, the feed will be listed in your Artifacts section.

4. Pushing a Package to Azure Artifacts

After creating a feed, you can push packages to it. We’ll go through the steps of pushing a NuGet package and an npm package to your feed.

Push a NuGet Package:

  1. Create or Build Your NuGet Package:

If you have a .NET project, you can create a NuGet package using the nuget pack command or through Visual Studio.

Example:

  1. Authenticate with Azure Artifacts:

Open the Command Prompt or PowerShell and run the following command to authenticate with Azure Artifacts:

  1. Push the Package:

Once the package is built, use the following command to push it to your feed:

This will upload the NuGet package to your Azure Artifacts feed.

Push an npm Package:

  1. Create or Build Your npm Package:

  • Navigate to your project directory and ensure that you have a package.json file.

  • If you don't have one, initialize npm in your project:

  1. Authenticate with Azure Artifacts:

Run the following command to authenticate:

  1. Publish the npm Package:

After building your package and ensuring it's ready for publishing, use the following command:

Your package will now be available in your Azure Artifacts feed.

5. Updating Packages in Azure Artifacts

When you need to update a package, you can follow similar steps as when pushing the initial package, with a focus on updating the version number.

Steps to Update a Package:

  1. Update Your Package Version:

Update the version number in your package.json for npm or csproj for NuGet.

Example for npm:

Example for NuGet:

  1. Publish the Updated Package:

For NuGet, use the same push command to upload the new version:

For npm, use:

  1. Verify the Update:

Go back to Azure DevOps in the Artifacts section.

Open your feed and you will see the new version of the package listed.

  1. Managing Multiple Versions:

Azure Artifacts automatically tracks multiple versions of a package. You can select a specific version to use in your build pipeline or application.

Summary

In this demo, we covered key tasks related to Azure Artifacts, such as:

  1. Understanding feeds and their role in package management.

  2. Controlling access to feeds using Azure DevOps permissions.

  3. Creating a package feed and pushing packages (NuGet and npm) to Azure Artifacts.

  4. Updating packages and managing versions within feeds.

Azure Artifacts simplifies the process of storing, managing, and sharing packages across teams and projects. By using private feeds and versioning, you ensure the integrity of your dependencies while improving your team's productivity and security.

If you're looking to implement package management as part of your CI/CD pipelines, Azure Artifacts integrates smoothly with Azure DevOps Pipelines, making it a powerful tool in modern DevOps workflows.

Related Articles


Rajnish, MCT

Leave a Reply

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


SUBSCRIBE

My newsletter for exclusive content and offers. Type email and hit Enter.

No spam ever. Unsubscribe anytime.
Read the Privacy Policy.