-
Notifications
You must be signed in to change notification settings - Fork 0
AzDoBranchPolicy
github-actions[bot] edited this page Aug 19, 2026
·
4 revisions
| Parameter | Attribute | DataType | Description | Allowed Values |
|---|---|---|---|---|
| ProjectName | Key | System.String | The Azure DevOps project name. | |
| BranchName | Required | System.String | The branch ref name (e.g. 'refs/heads/main'). | |
| PolicyType | Required | System.String | The policy type display name (e.g. 'MinimumReviewerCount'). | |
| RepositoryName | Required | System.String | The Git repository name. | |
| Ensure | Write | Ensure |
Present, Absent
|
|
| isBlocking | Write | System.Boolean | Whether the policy is blocking. Default is $true. | |
| isEnabled | Write | System.Boolean | Whether the policy is enabled. Default is $true. | |
| PolicySettings | Write | System.Collections.Hashtable | Policy-type-specific settings hashtable. | |
| LookupResult | Read | System.Collections.Hashtable |
The AzDoBranchPolicy class manages branch policy configurations on a Git repository branch within an Azure DevOps project.
This example shows how to ensure that a minimum reviewer count branch policy exists on the 'main' branch of the 'MyRepository' repository.
Configuration Example
{
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
node localhost
{
AzDoBranchPolicy 'AddBranchPolicy'
{
Ensure = 'Present'
ProjectName = 'MyProject'
RepositoryName = 'MyRepository'
BranchName = 'refs/heads/main'
PolicyType = 'MinimumReviewerCount'
isEnabled = $true
isBlocking = $true
PolicySettings = @{
minimumApproverCount = 2
creatorVoteCounts = $false
}
}
}
}This example shows how to update an existing branch policy, changing the minimum reviewer count and making it non-blocking.
Configuration Example
{
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
node localhost
{
AzDoBranchPolicy 'UpdateBranchPolicy'
{
Ensure = 'Present'
ProjectName = 'MyProject'
RepositoryName = 'MyRepository'
BranchName = 'refs/heads/main'
PolicyType = 'MinimumReviewerCount'
isEnabled = $true
isBlocking = $false
PolicySettings = @{
minimumApproverCount = 1
creatorVoteCounts = $true
}
}
}
}- Assert-BoundParameter
- Assert-ElevatedUser
- Assert-IPAddress
- Assert-Module
- AzDoAPI_0_ProjectCache
- AzDoAPI_1_GroupCache
- AzDoAPI_2_UserCache
- AzDoAPI_3_GroupMemberCache
- AzDoAPI_4_GitRepositoryCache
- AzDoAPI_5_PermissionsCache
- AzDoAPI_6_ServicePrinciple
- AzDoAPI_7_IdentitySubjectDescriptors
- AzDoAPI_8_ProjectProcessTemplates
- AzDoAPI_9_DevOpsClassificationNodes
- Compare-DscParameterState
- Compare-ResourcePropertyState
- ConvertFrom-DscResourceInstance
- ConvertTo-Base64String
- ConvertTo-CimInstance
- ConvertTo-HashTable
- Find-Certificate
- Format-Path
- Get-AzDevOpsOperation
- Get-AzDevOpsServicesApiUri
- Get-AzDevOpsServicesUri
- AzDoAgentPool
- AzDoAgentPoolPermission
- AzDoAgentQueue
- AzDoAreaNodes
- AzDoAreaPermission
- AzDoArtifactFeed
- AzDoArtifactFeedPermission
- AzDoArtifactFeedSettings
- AzDoArtifactFeedView
- AzDoAuditStream
- AzDoBranchPolicy
- AzDoCheckConfiguration
- AzDoDeploymentGroup
- AzDoEnvironmentApproval
- AzDoEnvironmentPermission
- AzDoExtension
- AzDoGitPermission
- AzDoGitRepository
- AzDoGroupMember
- AzDoGroupPermission
- AzDoIterationNodes
- AzDoIterationPermission
- AzDoNotificationSubscription
- AzDoOrganizationGroup
- AzDoOrganizationSettings
- AzDoPipeline
- AzDoPipelineEnvironment
- AzDoPipelinePermission
- AzDoPipelineSettings
- AzDoProcess
- AzDoProcessPermission
- AzDoProject
- AzDoProjectGroup
- AzDoProjectPermission
- AzDoProjectServices
- AzDoRepositorySettings
- AzDoSecurityNamespacePermission
- AzDoServiceConnection
- AzDoServiceConnectionPermission
- AzDoServiceHook
- AzDoTaskGroup
- AzDoTeam
- AzDoTeamMember
- AzDoTeamSettings
- AzDoUserEntitlement
- AzDoVariableGroup
- AzDoVariableGroupPermission
- AzDoWiki
- AzDoWIPTags