-
Notifications
You must be signed in to change notification settings - Fork 0
AzDoArtifactFeed
The AzDoArtifactFeed DSC resource is used to create and manage artifact feeds in Azure Artifacts. Artifact feeds are package repositories that store and distribute software packages (NuGet, npm, Python, etc.). This resource allows you to define and enforce the desired state of feeds, including whether they are project-scoped or organization-scoped, and to configure their features like upstream sources and package version visibility.
AzDoArtifactFeed [string] #ResourceName
{
FeedName = [String] $FeedName
[ ProjectName = [String] $ProjectName ]
[ Description = [String] $Description ]
[ BadgesEnabled = [Boolean] $BadgesEnabled ]
[ HideDeletedPackageVersions = [Boolean] $HideDeletedPackageVersions ]
[ UpstreamEnabled = [Boolean] $UpstreamEnabled ]
[ Ensure = [String] {'Present', 'Absent'} ]
[ DependsOn = [String[]] ]
[ PsDscRunAsCredential = [PSCredential] ]
}- FeedName [String] - The name of the artifact feed. This must be unique within the project (if project-scoped) or organization (if organization-scoped).
-
ProjectName [String] - The name of the project if this is a project-scoped feed. When omitted, the feed is organization-scoped. Default is
$null. -
Description [String] - A description of the feed explaining its purpose, package types, or intended users. Default is empty string.
-
BadgesEnabled [Boolean] - If
$true, allows the feed to display public badges for package status and metadata. Default is$false. -
HideDeletedPackageVersions [Boolean] - If
$true, deleted package versions are hidden from search results and package listings. Default is$true. -
UpstreamEnabled [Boolean] - If
$true, enables upstream sources which allow the feed to proxy packages from external feeds (NuGet.org, npm registry, etc.). Default is$true. -
Ensure [String] - Desired state of the resource:
-
'Present'- (default) Artifact feed should exist -
'Absent'- Artifact feed should be removed
-
-
DependsOn [String[]] - Dependencies on other resources. Use this to control the order of resource execution.
-
PsDscRunAsCredential [PSCredential] - Credentials to run this resource under.
The resource returns the following properties:
- FeedName - The name of the feed
- ProjectName - The project name (if project-scoped)
- Description - The feed description
- BadgesEnabled - Whether badges are enabled
- HideDeletedPackageVersions - Whether deleted versions are hidden
- UpstreamEnabled - Whether upstream sources are enabled
- Ensure - Current state ('Present' or 'Absent')
Configuration CreateOrgScopedFeed {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoArtifactFeed 'CompanyNuGetFeed' {
FeedName = 'CompanyNuGet'
Description = 'Organization-wide NuGet package repository'
BadgesEnabled = $true
HideDeletedPackageVersions = $true
UpstreamEnabled = $true
Ensure = 'Present'
}
}
}
CreateOrgScopedFeed
Start-DscConfiguration -Path ./CreateOrgScopedFeed -Wait -VerboseConfiguration CreateProjectScopedFeed {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoArtifactFeed 'ProjectSpecificFeed' {
FeedName = 'ProjectPackages'
ProjectName = 'MyProject'
Description = 'Project-specific internal packages'
BadgesEnabled = $false
HideDeletedPackageVersions = $true
UpstreamEnabled = $true
Ensure = 'Present'
}
}
}
CreateProjectScopedFeed
Start-DscConfiguration -Path ./CreateProjectScopedFeed -Wait -VerboseConfiguration CreateMultipleFeeds {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
# Public NuGet feed with upstream enabled
AzDoArtifactFeed 'PublicNuGetFeed' {
FeedName = 'PublicPackages'
Description = 'Public NuGet packages with upstream proxy'
BadgesEnabled = $true
HideDeletedPackageVersions = $false
UpstreamEnabled = $true
Ensure = 'Present'
}
# npm feed for JavaScript packages
AzDoArtifactFeed 'CompanyNpmFeed' {
FeedName = 'CompanyNpm'
Description = 'Internal npm packages'
BadgesEnabled = $true
HideDeletedPackageVersions = $true
UpstreamEnabled = $true
Ensure = 'Present'
}
# Project-specific Python packages
AzDoArtifactFeed 'ProjectPythonFeed' {
FeedName = 'ProjectPython'
ProjectName = 'DataScience'
Description = 'Project Python dependencies and packages'
BadgesEnabled = $false
HideDeletedPackageVersions = $true
UpstreamEnabled = $false
Ensure = 'Present'
}
}
}
CreateMultipleFeeds
Start-DscConfiguration -Path ./CreateMultipleFeeds -Wait -VerboseConfiguration CreateInternalOnlyFeed {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoArtifactFeed 'InternalOnlyFeed' {
FeedName = 'InternalPackagesOnly'
Description = 'Internal packages only - no upstream proxy'
BadgesEnabled = $false
HideDeletedPackageVersions = $true
UpstreamEnabled = $false
Ensure = 'Present'
}
}
}
CreateInternalOnlyFeed
Start-DscConfiguration -Path ./CreateInternalOnlyFeed -Wait -Verbose# Get current feed state
$properties = @{
FeedName = 'CompanyNuGet'
}
$result = Invoke-DscResource -Name 'AzDoArtifactFeed' `
-Method Get `
-Property $properties `
-ModuleName 'AzureDevOpsDscNative'
$result | Select-Object FeedName, Description, BadgesEnabled, UpstreamEnabled
# Create a new feed
$setProperties = @{
FeedName = 'NewFeed'
Description = 'New artifact feed'
BadgesEnabled = $true
HideDeletedPackageVersions = $true
UpstreamEnabled = $true
Ensure = 'Present'
}
Invoke-DscResource -Name 'AzDoArtifactFeed' `
-Method Set `
-Property $setProperties `
-ModuleName 'AzureDevOpsDscNative'-
Organization-Scoped: When
ProjectNameis omitted, the feed is available organization-wide -
Project-Scoped: When
ProjectNameis specified, the feed is only available within that project - Scope affects visibility, permissions, and feed lifecycle management
- Organization feeds provide centralized package management; project feeds provide isolation
- Feeds can contain multiple package types: NuGet, npm, Python, Maven, etc.
- Type restrictions can be configured separately through feed settings
- Upstream sources vary by package type (NuGet.org for NuGet, npm registry for npm, etc.)
- When
UpstreamEnabled = $true, the feed can proxy packages from external sources - Reduces bandwidth by caching external packages internally
- Requires separate configuration of upstream sources using
AzDoArtifactFeedSettings - Useful for both public (NuGet.org) and private upstream feeds
-
HideDeletedPackageVersions = $trueimproves user experience by hiding obsolete versions - Deleted packages still exist; they're just hidden from searches
- Can be reverted if specific old versions need to be restored
- Recommended for reducing clutter in package listings
- Badges provide package status information for external documentation
- Requires authentication when
BadgesEnabled = $false - Useful for publishing package availability to internal documentation
- Can expose package version information if public
Cause: A feed with the same name already exists in the scope (organization or project).
Solution:
# Use a different feed name
# Or use Ensure = 'Present' which is idempotent if the feed exists
# Check existing feeds in Azure ArtifactsCause: Authentication account lacks permission to create feeds.
Solution:
# Verify account has feed creation permissions
# Check project or organization administrator roles
# Ensure Personal Access Token has appropriate scopesCause: Specified project does not exist when creating project-scoped feed.
Solution:
# Create the project first using AzDoProject resource
# Verify the project name is correct
# Ensure the project scope is correct- AzDoArtifactFeedPermission - Manage feed permissions
- AzDoArtifactFeedSettings - Configure feed settings and retention
- AzDoArtifactFeedView - Create views within feeds
- AzDoProject - Create projects that host feeds