AZ-400: Designing and Implementing Microsoft DevOps Solutions
Design and Implement a Package Management Strategy
Exploring Azure Artifacts
In this lesson, we dive into Azure Artifacts, a core component of Azure DevOps that enables enterprise-scale package management. Mastering Azure Artifacts is essential for the AZ-400 exam and for streamlining your CI/CD pipelines with reliable, repeatable package deployments.
Why Choose Azure Artifacts?
Azure Artifacts augments your DevOps workflow with:
Benefit | Description |
---|---|
Tight Azure DevOps Integration | Automate package restore and publishing in Pipelines and Boards. |
Multi-format Support | Host and manage NuGet, npm, Maven, Python, and more. |
Fine-grained Access Control | Assign permissions at feed and individual package levels. |
Note
Azure Artifacts scales from small teams to large enterprises, offering performance and security.
Package Management Workflow
Follow these three core steps to onboard packages:
- Set up a feed
- Push your packages
- Consume packages
1. Creating a Feed
In Azure DevOps:
- Navigate to Artifacts.
- Click Create Feed.
Configure these settings:
Setting | Options | Description |
---|---|---|
Visibility | Private, Organization, Public | Controls who can view and install your packages. |
Upstream Sources | NuGet.org, npmjs.com, Maven Central, other feeds | Automatically proxy or cache packages from external registries. |
Scope | Entire organization or specific projects | Limits feed access to select projects or makes it organization-wide. |
Warning
Public feeds expose your packages to the internet. Ensure no sensitive artifacts are published inadvertently.
2. Consuming a Feed
After feed creation, select Connect to Feed for authentication snippets, or Search Stream Sources to browse upstream packages:
- Connect to Feed: Copy configuration for
NuGet.config
,.npmrc
,settings.xml
, orpip.conf
. - Search Stream Sources: Filter by package name, version, license, or dependencies.
3. CI/CD Integration
Use Azure Pipelines to restore, version, and publish packages automatically:
Pipeline Steps
trigger:
branches:
include:
- main
paths:
include:
- '**/*.csproj'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
command: 'restore'
restoreSolution: '**/*.sln'
feedsToUse: 'select'
vstsFeed: '<YOUR_FEED_ID>'
- task: DotNetCoreCLI@2
inputs:
command: 'publish'
projects: '**/*.csproj'
arguments: '--configuration Release --output $(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
- task: AzureWebApp@1
inputs:
azureSubscription: '<Your Azure Subscription>'
appType: 'webApp'
appName: '<Your App Name>'
package: '$(Build.ArtifactStagingDirectory)/**/*.zip'
Automate version bumps using tools like Dependabot or GitHub’s native versioning bot.
Best Practices
- Adopt semantic versioning to signal breaking changes, features, and fixes.
- Leverage scopes and views to partition packages by team, environment, or lifecycle.
- Implement automated retention policies to purge stale artifacts and optimize storage costs.
Links and References
Watch Video
Watch video content