-
Notifications
You must be signed in to change notification settings - Fork 0
AzDoAreaPermission
The AzDoAreaPermission DSC resource is used to manage permissions for specific areas within an Azure DevOps project. It allows you to configure which groups or users have access to work items in specific project areas and whether they can edit, delete, or perform other area-related operations.
AzDoAreaPermission [string] #ResourceName
{
ProjectName = [String] $ProjectName
[ AreaPath = [String] $AreaPath ]
[ isInherited = [Boolean] $isInherited ]
[ Permissions = [HashTable[]] $Permissions ]
[ Ensure = [String] {'Present', 'Absent'} ]
[ DependsOn = [String[]] ]
[ PsDscRunAsCredential = [PSCredential] ]
}- ProjectName [String] - The name of the Azure DevOps project.
-
AreaPath [String] - The path of the area within the project (e.g., 'MyProject\Area1\SubArea'). If not specified, applies to project root area.
-
isInherited [Boolean] - Whether the permissions are inherited from the parent area. 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', 'Manage') -
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
- AreaPath - The area path
- isInherited - Whether permissions are inherited
- Permissions - The configured permissions
- Ensure - Current state ('Present' or 'Absent')
Configuration GrantAreaPermissions {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoAreaPermission 'FrontendAreaPermission' {
ProjectName = 'MyProject'
AreaPath = 'MyProject\Frontend'
isInherited = $false
Permissions = @(
@{
Identity = 'Frontend Team'
Permission = 'Edit'
Allow = $true
},
@{
Identity = 'Frontend Team'
Permission = 'View'
Allow = $true
},
@{
Identity = 'Backend Team'
Permission = 'View'
Allow = $true
},
@{
Identity = 'Backend Team'
Permission = 'Edit'
Allow = $false
Deny = $true
}
)
Ensure = 'Present'
}
}
}
GrantAreaPermissions
Start-DscConfiguration -Path ./GrantAreaPermissions -Wait -VerboseConfiguration AreaHierarchyPermissions {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoAreaPermission 'RootArea' {
ProjectName = 'MyProject'
AreaPath = 'MyProject'
isInherited = $false
Permissions = @(
@{
Identity = 'Project Admins'
Permission = 'Edit'
Allow = $true
}
)
Ensure = 'Present'
}
AzDoAreaPermission 'SubArea1' {
ProjectName = 'MyProject'
AreaPath = 'MyProject\Team1'
isInherited = $true
Permissions = @(
@{
Identity = 'Team 1'
Permission = 'Edit'
Allow = $true
}
)
Ensure = 'Present'
DependsOn = '[AzDoAreaPermission]RootArea'
}
}
}
AreaHierarchyPermissions
Start-DscConfiguration -Path ./AreaHierarchyPermissions -Wait -Verbose# Get the current state of area permissions
$properties = @{
ProjectName = 'MyProject'
AreaPath = 'MyProject\Frontend'
}
$result = Invoke-DscResource -Name 'AzDoAreaPermission' `
-Method Get `
-Property $properties `
-ModuleName 'AzureDevOpsDscNative'
$result | Select-Object ProjectName, AreaPath, isInherited, PermissionsConfiguration DisableInheritance {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoAreaPermission 'ExclusiveArea' {
ProjectName = 'MyProject'
AreaPath = 'MyProject\ExclusiveWork'
isInherited = $false
Permissions = @(
@{
Identity = 'Special Team'
Permission = 'Edit'
Allow = $true
},
@{
Identity = 'Everyone'
Permission = 'Edit'
Allow = $false
Deny = $true
}
)
Ensure = 'Present'
}
}
}
DisableInheritance
Start-DscConfiguration -Path ./DisableInheritance -Wait -VerboseConfiguration RemoveAreaPermissions {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoAreaPermission 'RemovePermissions' {
ProjectName = 'MyProject'
AreaPath = 'MyProject\OldArea'
Ensure = 'Absent'
}
}
}
RemoveAreaPermissions
Start-DscConfiguration -Path ./RemoveAreaPermissions -Wait -Verbose- Edit - Ability to create and modify work items
- View - Ability to view work items
- Delete - Ability to delete work items
- Manage - Ability to manage area-level settings
- When
isInheritedis$true, permissions flow from parent to child areas - Setting
isInheritedto$falsebreaks inheritance and allows custom permissions - Child areas without explicit permissions inherit from parents
- Use backslash as separator (e.g., 'Project\Area1\SubArea')
- Project name should be included in the path
- Paths are case-sensitive
Cause: The specified area path does not exist
Solution:
# Verify the area exists in the project
# Use AzDoAreaNodes resource to create areas first
# Check the exact spelling and case of the area pathCause: Insufficient permissions or invalid group identity
Solution:
- Verify user has project-level administrator permissions
- Check that the group exists in the organization or project
- Ensure the personal access token has sufficient scope
Cause: Inheritance is preventing changes or conflicts exist
Solution:
# Set isInherited to $false to override parent permissions
# Explicitly set all required permissions
# Check for conflicting Allow/Deny rules- AzDoAreaNodes - Manage area nodes in a project
- AzDoIterationPermission - Manage iteration permissions
- AzDoProjectPermission - Manage project-level permissions
- AzDoGroupPermission - Manage group permissions