-
Notifications
You must be signed in to change notification settings - Fork 0
AzDoGroupPermission
The AzDoGroupPermission DSC resource manages permissions for groups in Azure DevOps. It allows you to grant or deny specific permissions to groups at various scopes (organization, project, or namespace level).
AzDoGroupPermission [string] #ResourceName
{
GroupName = [String] $GroupName
PermissionName = [String] $PermissionName
[ ProjectName = [String] $ProjectName ]
[ Ensure = [String] {'Present', 'Absent'} ]
[ Allow = [Boolean] ]
[ Deny = [Boolean] ]
[ DependsOn = [String[]] ]
[ PsDscRunAsCredential = [PSCredential] ]
}-
GroupName [String] - The name of the group to assign permissions to.
-
PermissionName [String] - The name of the permission to manage (e.g., 'Create Project', 'Read', 'Write').
-
ProjectName [String] - The project name for project-level permissions. Omit for organization-level.
-
Ensure [String] - Desired state:
-
'Present'- (default) Permission assignment should exist -
'Absent'- Permission assignment should be removed
-
-
Allow [Boolean] - Grant the permission ($true) or not ($false).
-
Deny [Boolean] - Explicitly deny the permission ($true) or not ($false).
-
DependsOn [String[]] - Dependencies on other resources.
-
PsDscRunAsCredential [PSCredential] - Credentials to run this resource under.
- GroupName - The group name
- PermissionName - The permission name
- ProjectName - The project (if applicable)
- Allow - Whether permission is allowed
- Deny - Whether permission is explicitly denied
Configuration GrantOrgPermission {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoOrganizationGroup 'AdminGroup' {
Ensure = 'Present'
GroupName = 'Administrators'
GroupDescription = 'Organization admins'
}
AzDoGroupPermission 'AdminPermission' {
Ensure = 'Present'
GroupName = 'Administrators'
PermissionName = 'Create Project'
Allow = $true
DependsOn = '[AzDoOrganizationGroup]AdminGroup'
}
}
}
GrantOrgPermission
Start-DscConfiguration -Path ./GrantOrgPermission -Wait -VerboseConfiguration MultiplePermissions {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoOrganizationGroup 'Developers' {
Ensure = 'Present'
GroupName = 'Developers'
}
AzDoGroupPermission 'CreateProject' {
Ensure = 'Present'
GroupName = 'Developers'
PermissionName = 'Create Project'
Allow = $true
DependsOn = '[AzDoOrganizationGroup]Developers'
}
AzDoGroupPermission 'EditProject' {
Ensure = 'Present'
GroupName = 'Developers'
PermissionName = 'Edit Project Properties'
Allow = $true
DependsOn = '[AzDoOrganizationGroup]Developers'
}
}
}
MultiplePermissions
Start-DscConfiguration -Path ./MultiplePermissions -Wait -VerboseConfiguration DenyPermission {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoOrganizationGroup 'Readers' {
Ensure = 'Present'
GroupName = 'Read Only Users'
}
AzDoGroupPermission 'DenyDelete' {
Ensure = 'Present'
GroupName = 'Read Only Users'
PermissionName = 'Delete Project'
Deny = $true
DependsOn = '[AzDoOrganizationGroup]Readers'
}
}
}
DenyPermission
Start-DscConfiguration -Path ./DenyPermission -Wait -VerboseConfiguration ProjectPermission {
Import-DscResource -ModuleName 'AzureDevOpsDscNative'
Node localhost {
AzDoProject 'MyProject' {
Ensure = 'Present'
ProjectName = 'MyProject'
SourceControlType = 'Git'
ProcessTemplate = 'Agile'
}
AzDoProjectGroup 'ProjectAdmins' {
Ensure = 'Present'
ProjectName = 'MyProject'
GroupName = 'Project Admins'
DependsOn = '[AzDoProject]MyProject'
}
AzDoGroupPermission 'ProjectAdminPerms' {
Ensure = 'Present'
GroupName = 'Project Admins'
ProjectName = 'MyProject'
PermissionName = 'Administer'
Allow = $true
DependsOn = '[AzDoProjectGroup]ProjectAdmins'
}
}
}
ProjectPermission
Start-DscConfiguration -Path ./ProjectPermission -Wait -VerboseCommon permission names include:
-
'Create Project'- Create new projects -
'Delete Project'- Delete projects -
'Edit Project Properties'- Modify project settings -
'Administer'- Full administration permissions -
'Read'- Read access -
'Write'- Write access -
'Contribute'- Contribution permissions
- Allow: Explicitly grants the permission
- Deny: Explicitly denies the permission
- Setting both creates explicit deny (deny takes precedence)
- Organization-level: Omit ProjectName for org permissions
- Project-level: Include ProjectName for project permissions
- Namespace-level: For specialized permission management
Cause: The permission name doesn't exist or is misspelled
Solution:
- Verify correct permission name
- Check Azure DevOps documentation for valid permissions
- Use proper capitalization
Cause: The group doesn't exist
Solution:
- Create the group first using AzDoOrganizationGroup or AzDoProjectGroup
- Verify group name matches exactly
- AzDoOrganizationGroup - Create organization groups
- AzDoProjectGroup - Create project groups
- AzDoGroupMember - Add members to groups
- AzDoProjectPermission - Project permissions