-
Notifications
You must be signed in to change notification settings - Fork 0
AzDoPipelineSettings
The AzDoPipelineSettings DSC resource is used to manage project-level pipeline security and configuration settings in Azure DevOps. These settings, found in Project Settings > Pipelines > Settings, control security policies, badge access, and CI/CD behavior across all pipelines in a project. This resource allows you to configure and enforce organizational security policies for pipeline execution and access controls.
AzDoPipelineSettings [string] #ResourceName
{
ProjectName = [String] $ProjectName
[ EnforceJobAuthScope = [String] {'', 'true', 'false'} ]
[ EnforceJobAuthScopeForReleases = [String] {'', 'true', 'false'} ]
[ EnforceReferencedRepoScopedToken = [String] {'', 'true', 'false'} ]
[ EnforceSettableVar = [String] {'', 'true', 'false'} ]
[ PublishPipelineMetadata = [String] {'', 'true', 'false'} ]
[ StatusBadgesArePrivate = [String] {'', 'true', 'false'} ]
[ DisableClassicPipelineCreation = [String] {'', 'true', 'false'} ]
[ DisableImpliedYAMLCiTrigger = [String] {'', 'true', 'false'} ]
[ Ensure = [String] {'Present', 'Absent'} ]
[ DependsOn = [String[]] ]
[ PsDscRunAsCredential = [PSCredential] ]
}- ProjectName [String] - The name of the Azure DevOps project. This is the unique identifier for the project whose pipeline settings will be managed.
All settings use a tri-state string value: empty string '' (default, not managed), 'true' (enabled), or 'false' (disabled). This allows the resource to manage only specified settings while leaving others untouched.
-
EnforceJobAuthScope [String] - Limit job authorization scope to the current project for non-release pipelines:
-
''- Not managed by this resource -
'true'- Restrict job token to project scope -
'false'- Allow job token to access organization resources
-
-
EnforceJobAuthScopeForReleases [String] - Limit job authorization scope to the current project for release pipelines:
-
''- Not managed by this resource -
'true'- Restrict release job token to project scope -
'false'- Allow release job token to access organization resources
-
-
EnforceReferencedRepoScopedToken [String] - Protect access to repositories in YAML pipelines by requiring scoped tokens:
-
''- Not managed by this resource -
'true'- Require scoped tokens for repo access -
'false'- Allow broader token access
-
-
EnforceSettableVar [String] - Limit variables that can be set at queue time (prevents pipeline variables from being overridden):
-
''- Not managed by this resource -
'true'- Restrict settable variables at queue time -
'false'- Allow all variables to be overridden at queue time
-
-
PublishPipelineMetadata [String] - Publish pipeline metadata to enable integration scenarios:
-
''- Not managed by this resource -
'true'- Enable metadata publishing -
'false'- Disable metadata publishing
-
-
StatusBadgesArePrivate [String] - Disable anonymous access to pipeline status badges:
-
''- Not managed by this resource -
'true'- Make status badges private (authentication required) -
'false'- Allow anonymous badge access
-
-
DisableClassicPipelineCreation [String] - Disable creation of classic (non-YAML) build and release pipelines:
-
''- Not managed by this resource -
'true'- Prevent new classic pipeline creation -
'false'- Allow classic pipeline creation
-
-
DisableImpliedYAMLCiTrigger [String] - Disable implied CI triggers on YAML pipelines:
-
''- Not managed by this resource -
'true'- Require explicit CI trigger configuration -
'false'- Enable implicit CI triggers by default
-
-
Ensure [String] - Desired state of the resource:
-
'Present'- (default) Settings should be configured -
'Absent'- No-op for this resource (settings cannot 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:
- ProjectName - The name of the project
- EnforceJobAuthScope - Current value of the job auth scope setting
- EnforceJobAuthScopeForReleases - Current value of the release job auth scope setting
- EnforceReferencedRepoScopedToken - Current value of the repo scoped token setting
- EnforceSettableVar - Current value of the settable variable setting
- PublishPipelineMetadata - Current value of the metadata publishing setting
- StatusBadgesArePrivate - Current value of the badge privacy setting
- DisableClassicPipelineCreation - Current value of the classic pipeline creation setting
- DisableImpliedYAMLCiTrigger - Current value of the implied CI trigger setting
- Ensure - Current state ('Present' or 'Absent')
Configuration HardenPipelineSettings {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoPipelineSettings 'HardenedPipelines' {
ProjectName = 'MyProject'
EnforceJobAuthScope = 'true'
EnforceJobAuthScopeForReleases = 'true'
EnforceReferencedRepoScopedToken = 'true'
StatusBadgesArePrivate = 'true'
DisableClassicPipelineCreation = 'true'
Ensure = 'Present'
}
}
}
HardenPipelineSettings
Start-DscConfiguration -Path ./HardenPipelineSettings -Wait -VerboseConfiguration SelectiveSecuritySettings {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoPipelineSettings 'ProjectSecurityPolicy' {
ProjectName = 'MyProject'
# Enforce job auth scope for regular pipelines
EnforceJobAuthScope = 'true'
# Do NOT change release pipeline auth scope setting
EnforceJobAuthScopeForReleases = ''
# Protect repository access
EnforceReferencedRepoScopedToken = 'true'
# Allow variable override at queue time
EnforceSettableVar = 'false'
# Enable metadata for integrations
PublishPipelineMetadata = 'true'
# Don't manage badge privacy setting
StatusBadgesArePrivate = ''
# Require YAML pipelines for new builds
DisableClassicPipelineCreation = 'true'
# Don't manage CI trigger setting
DisableImpliedYAMLCiTrigger = ''
Ensure = 'Present'
}
}
}
SelectiveSecuritySettings
Start-DscConfiguration -Path ./SelectiveSecuritySettings -Wait -VerboseConfiguration StrictSecurityPolicies {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoPipelineSettings 'StrictSecurity' {
ProjectName = 'MyProject'
EnforceJobAuthScope = 'true'
EnforceJobAuthScopeForReleases = 'true'
EnforceReferencedRepoScopedToken = 'true'
EnforceSettableVar = 'true'
PublishPipelineMetadata = 'false'
StatusBadgesArePrivate = 'true'
DisableClassicPipelineCreation = 'true'
DisableImpliedYAMLCiTrigger = 'true'
Ensure = 'Present'
}
}
}
StrictSecurityPolicies
Start-DscConfiguration -Path ./StrictSecurityPolicies -Wait -VerboseConfiguration PermissiveDevSettings {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoPipelineSettings 'DevelopmentPipelines' {
ProjectName = 'Development'
# Allow broader scope access
EnforceJobAuthScope = 'false'
EnforceJobAuthScopeForReleases = 'false'
# Allow variable override for debugging
EnforceSettableVar = 'false'
# Enable classic pipelines for flexibility
DisableClassicPipelineCreation = 'false'
# Don't enforce strict CI trigger configuration
DisableImpliedYAMLCiTrigger = 'false'
# Don't manage other settings
EnforceReferencedRepoScopedToken = ''
PublishPipelineMetadata = ''
StatusBadgesArePrivate = ''
Ensure = 'Present'
}
}
}
PermissiveDevSettings
Start-DscConfiguration -Path ./PermissiveDevSettings -Wait -Verbose# Get current pipeline settings
$properties = @{
ProjectName = 'MyProject'
}
$result = Invoke-DscResource -Name 'AzDoPipelineSettings' `
-Method Get `
-Property $properties `
-ModuleName 'AzureDevOpsDscNative'
$result | Select-Object ProjectName, EnforceJobAuthScope, EnforceReferencedRepoScopedToken, `
StatusBadgesArePrivate, DisableClassicPipelineCreation
# Update specific pipeline settings
$setProperties = @{
ProjectName = 'MyProject'
EnforceJobAuthScope = 'true'
EnforceReferencedRepoScopedToken = 'true'
StatusBadgesArePrivate = 'true'
Ensure = 'Present'
}
Invoke-DscResource -Name 'AzDoPipelineSettings' `
-Method Set `
-Property $setProperties `
-ModuleName 'AzureDevOpsDscNative'- Empty string
''means "don't manage this setting" - the current value is preserved -
'true'and'false'are strings (not boolean) to support the "unmanaged" state - Only explicitly set settings are reconciled; others remain unchanged
- This prevents accidentally disabling security policies when only updating one setting
- EnforceJobAuthScope controls token scope for standard build pipelines
- EnforceJobAuthScopeForReleases controls token scope for release pipelines
- Restricting to project scope prevents pipelines from accessing organization-level resources
- Recommended for most organizations for security hardening
- EnforceReferencedRepoScopedToken requires scoped tokens for repo access in YAML
- Provides fine-grained access control for repository operations
- Recommended for organizations with strict security requirements
- Works with multi-repo pipelines
- EnforceSettableVar prevents variables from being overridden at pipeline queue time
- Useful for controlling production deployments and sensitive configurations
- Can be too restrictive for development environments
- Useful for protecting build/release parameters
- StatusBadgesArePrivate controls who can view pipeline status badges (read-only)
- PublishPipelineMetadata enables integration scenarios and external tools
- Badge URLs contain sensitive project information; making private is recommended
- Metadata publishing enables audit scenarios and external integrations
- DisableClassicPipelineCreation forces use of YAML pipelines for new pipelines
- Recommended for organizations standardizing on YAML/infrastructure-as-code
- Existing classic pipelines continue to run; this only prevents new ones
- Useful for enforcing consistent pipeline management practices
Behavior: Some settings not specified in configuration remain unchanged.
Explanation: This is intentional. Empty string means "don't manage this setting." This design prevents accidentally overriding unmanaged settings.
Solution:
# Explicitly set all settings you want to manage
# Leave unmanaged settings as empty string ''
# Or query current settings with Get method firstCause: Pipelines cache settings or browser caching.
Solution:
# Refresh the browser after making changes
# Restart pipeline agents if they cache settings
# Run a new pipeline build to test new settings
# Check Azure Pipelines documentation for setting propagation timeCause: Trying to set to a value not allowed by organization policy.
Solution:
# Check organization-level policy overrides
# Organization-level settings may enforce stricter rules
# Contact organization administrator if policy blocks change- AzDoPipeline - Create and manage YAML pipelines
- AzDoProject - Create and manage projects
- AzDoPipelineEnvironment - Create deployment environments
- AzDoServiceConnection - Create service connections for pipelines