-
Notifications
You must be signed in to change notification settings - Fork 0
AzDoIterationPermission
The AzDoIterationPermission DSC resource is used to manage permissions for specific iterations (sprints) within an Azure DevOps project. It allows you to configure which groups or users have access to work items in specific iterations and control their ability to edit, view, or manage iteration-related operations.
AzDoIterationPermission [string] #ResourceName
{
ProjectName = [String] $ProjectName
[ IterationPath = [String] $IterationPath ]
[ isInherited = [Boolean] $isInherited ]
[ Permissions = [HashTable[]] $Permissions ]
[ Ensure = [String] {'Present', 'Absent'} ]
[ DependsOn = [String[]] ]
[ PsDscRunAsCredential = [PSCredential] ]
}- ProjectName [String] - The name of the Azure DevOps project.
-
IterationPath [String] - The path of the iteration within the project (e.g., 'MyProject\Sprint 1'). If not specified, applies to project root iteration.
-
isInherited [Boolean] - Whether the permissions are inherited from the parent iteration. Default is
$true. -
Permissions [HashTable[]] - An array of permission hashtables, each containing:
-
Identity- The group or user identity -
Permission- The permission type (e.g., 'Edit', 'View', 'Delete') -
Allow- Boolean indicating if permission is allowed -
Deny- Boolean indicating if permission is denied
-
-
Ensure [String] - Desired state of the resource:
-
'Present'- (default) Permissions should be configured -
'Absent'- Permissions 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:
- ProjectName - The name of the project
- IterationPath - The iteration path
- isInherited - Whether permissions are inherited
- Permissions - The configured permissions
- Ensure - Current state ('Present' or 'Absent')
Configuration GrantIterationPermissions {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoIterationPermission 'SprintPermissions' {
ProjectName = 'MyProject'
IterationPath = 'MyProject\Sprint 1'
isInherited = $false
Permissions = @(
@{
Identity = 'Development Team'
Permission = 'Edit'
Allow = $true
},
@{
Identity = 'QA Team'
Permission = 'View'
Allow = $true
},
@{
Identity = 'Contractors'
Permission = 'Edit'
Allow = $false
Deny = $true
}
)
Ensure = 'Present'
}
}
}
GrantIterationPermissions
Start-DscConfiguration -Path ./GrantIterationPermissions -Wait -VerboseConfiguration ConfigureSprintPermissions {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoIterationPermission 'Sprint1' {
ProjectName = 'MyProject'
IterationPath = 'MyProject\Sprint 1'
isInherited = $false
Permissions = @(
@{
Identity = 'Sprint 1 Team'
Permission = 'Edit'
Allow = $true
}
)
Ensure = 'Present'
}
AzDoIterationPermission 'Sprint2' {
ProjectName = 'MyProject'
IterationPath = 'MyProject\Sprint 2'
isInherited = $false
Permissions = @(
@{
Identity = 'Sprint 2 Team'
Permission = 'Edit'
Allow = $true
}
)
Ensure = 'Present'
}
}
}
ConfigureSprintPermissions
Start-DscConfiguration -Path ./ConfigureSprintPermissions -Wait -VerboseConfiguration DisableIterationInheritance {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoIterationPermission 'RestrictedSprint' {
ProjectName = 'MyProject'
IterationPath = 'MyProject\Restricted Sprint'
isInherited = $false
Permissions = @(
@{
Identity = 'Project Admins'
Permission = 'Edit'
Allow = $true
},
@{
Identity = 'Developers'
Permission = 'View'
Allow = $true
}
)
Ensure = 'Present'
}
}
}
DisableIterationInheritance
Start-DscConfiguration -Path ./DisableIterationInheritance -Wait -Verbose# Get the current state of iteration permissions
$properties = @{
ProjectName = 'MyProject'
IterationPath = 'MyProject\Sprint 1'
}
$result = Invoke-DscResource -Name 'AzDoIterationPermission' `
-Method Get `
-Property $properties `
-ModuleName 'AzureDevOpsDscNative'
$result | Select-Object ProjectName, IterationPath, isInherited, PermissionsConfiguration RestrictArchivedSprint {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoIterationPermission 'ArchivedSprintRead' {
ProjectName = 'MyProject'
IterationPath = 'MyProject\Archived\Sprint 2024-Q1'
isInherited = $false
Permissions = @(
@{
Identity = 'Team Leads'
Permission = 'View'
Allow = $true
},
@{
Identity = 'Developers'
Permission = 'Edit'
Allow = $false
Deny = $true
}
)
Ensure = 'Present'
}
}
}
RestrictArchivedSprint
Start-DscConfiguration -Path ./RestrictArchivedSprint -Wait -VerboseConfiguration RemoveIterationPermissions {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoIterationPermission 'RemovePermissions' {
ProjectName = 'MyProject'
IterationPath = 'MyProject\OldSprint'
Ensure = 'Absent'
}
}
}
RemoveIterationPermissions
Start-DscConfiguration -Path ./RemoveIterationPermissions -Wait -Verbose- Edit - Ability to edit work items in the iteration
- View - Ability to view work items in the iteration
- Delete - Ability to delete work items from the iteration
- Create Child Items - Ability to create child work items
- Manage Test Plans - Ability to manage test plans for the iteration
- Iterations are organized in a hierarchy (parent/child relationships)
- Permissions cascade from parent to child iterations
- Setting
isInheritedto$falseallows custom permissions per iteration
- Use backslash as separator (e.g., 'Project\Iteration1\Sprint1')
- Project name is typically the root
- Paths are case-sensitive
Cause: The specified iteration does not exist
Solution:
# Verify the iteration exists in the project
# Use AzDoIterationNodes resource to create iterations first
# Check the exact spelling and case of the iteration pathCause: Insufficient permissions or group does not exist
Solution:
- Verify user has project administrator permissions
- Check that the group exists in the organization or project
- Ensure the personal access token has sufficient scope
Cause: Inheritance conflicts or parent permissions override
Solution:
# Set isInherited to $false to override parent permissions
# Explicitly configure all required permissions
# Check for conflicting permission rules- AzDoIterationNodes - Manage iteration nodes in a project
- AzDoAreaPermission - Manage area permissions
- AzDoProjectPermission - Manage project-level permissions
- AzDoGroupPermission - Manage group permissions