-
Notifications
You must be signed in to change notification settings - Fork 0
AzDoProjectGroup
The AzDoProjectGroup DSC resource is used to create and manage project-level groups within an Azure DevOps project. It allows you to define and enforce the desired state of groups that can be used for permission management and team organization at the project level.
AzDoProjectGroup [string] #ResourceName
{
GroupName = [String] $GroupName
ProjectName = [String] $ProjectName
[ GroupDescription = [String] $GroupDescription ]
[ Ensure = [String] {'Present', 'Absent'} ]
[ DependsOn = [String[]] ]
[ PsDscRunAsCredential = [PSCredential] ]
}-
GroupName [String] - The name of the project group. This is the unique identifier for the group within the project.
-
ProjectName [String] - The name of the Azure DevOps project that contains this group.
-
GroupDescription [String] - A description for the project group. Provides context about the group's purpose and membership.
-
Ensure [String] - Desired state of the resource:
-
'Present'- (default) Group should exist -
'Absent'- Group 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:
- GroupName - The name of the group
- ProjectName - The name of the project
- GroupDescription - The description of the group
- Ensure - Current state ('Present' or 'Absent')
Configuration CreateProjectGroup {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoProjectGroup 'BackendTeam' {
GroupName = 'Backend Team'
ProjectName = 'MyProject'
GroupDescription = 'Group for backend development team members'
Ensure = 'Present'
}
}
}
CreateProjectGroup
Start-DscConfiguration -Path ./CreateProjectGroup -Wait -VerboseConfiguration CreateMultipleProjectGroups {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoProjectGroup 'FrontendTeam' {
GroupName = 'Frontend Team'
ProjectName = 'MyProject'
GroupDescription = 'Group for frontend development team members'
Ensure = 'Present'
}
AzDoProjectGroup 'BackendTeam' {
GroupName = 'Backend Team'
ProjectName = 'MyProject'
GroupDescription = 'Group for backend development team members'
Ensure = 'Present'
}
AzDoProjectGroup 'QATeam' {
GroupName = 'QA Team'
ProjectName = 'MyProject'
GroupDescription = 'Group for quality assurance team members'
Ensure = 'Present'
}
}
}
CreateMultipleProjectGroups
Start-DscConfiguration -Path ./CreateMultipleProjectGroups -Wait -VerboseConfiguration CreateProjectWithGroups {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoProject 'MyProject' {
ProjectName = 'MyProject'
Ensure = 'Present'
SourceControlType = 'Git'
ProcessTemplate = 'Agile'
}
AzDoProjectGroup 'Developers' {
GroupName = 'Developers'
ProjectName = 'MyProject'
GroupDescription = 'Development team group'
Ensure = 'Present'
DependsOn = '[AzDoProject]MyProject'
}
AzDoProjectGroup 'Leads' {
GroupName = 'Technical Leads'
ProjectName = 'MyProject'
GroupDescription = 'Technical leadership group'
Ensure = 'Present'
DependsOn = '[AzDoProject]MyProject'
}
}
}
CreateProjectWithGroups
Start-DscConfiguration -Path ./CreateProjectWithGroups -Wait -Verbose# Get the current state of a project group
$properties = @{
GroupName = 'Backend Team'
ProjectName = 'MyProject'
}
$result = Invoke-DscResource -Name 'AzDoProjectGroup' `
-Method Get `
-Property $properties `
-ModuleName 'AzureDevOpsDscNative'
$result | Select-Object GroupName, ProjectName, GroupDescription, Ensure# Update a project group's description
$properties = @{
GroupName = 'Backend Team'
ProjectName = 'MyProject'
GroupDescription = 'Updated backend team description with new responsibilities'
Ensure = 'Present'
}
Invoke-DscResource -Name 'AzDoProjectGroup' `
-Method Set `
-Property $properties `
-ModuleName 'AzureDevOpsDscNative'Configuration RemoveProjectGroup {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoProjectGroup 'RemoveOldGroup' {
GroupName = 'Old Team'
ProjectName = 'MyProject'
Ensure = 'Absent'
}
}
}
RemoveProjectGroup
Start-DscConfiguration -Path ./RemoveProjectGroup -Wait -Verbose- Group names must be unique within the project
- Group names can include spaces and special characters
- Group names are case-sensitive for identification
- Groups created with this resource are scoped to the project level
- These groups can be used for project-specific permission assignments
- Use this resource in combination with permission resources for access control
- Removing a group also removes associated permissions
- Groups with active members should be migrated before removal
- Consider notifying team members before removing groups
Cause: A group with the same name already exists in the project
Solution:
# Use a unique group name
# Or update the existing group instead of creating a new oneCause: Insufficient permissions for group management
Solution:
- Verify user has Project Administrator permissions
- Check personal access token has "Identity" scope
- Ensure user is in project administration group
Cause: The specified project does not exist
Solution:
# Verify the project name matches exactly
# Ensure the project exists before attempting to create groups
# Use AzDoProject resource to create the project first- AzDoProject - Create and manage Azure DevOps projects
- AzDoGroupPermission - Manage group permissions
- AzDoTeam - Create teams in a project
- AzDoPipelinePermission - Manage pipeline permissions