Skip to content

AzDoGitPermission

github-actions[bot] edited this page Aug 19, 2026 · 4 revisions

Parameters

Parameter Attribute DataType Description Allowed Values
ProjectName Key System.String Specifies the name of the Azure DevOps project.
Ensure Write Ensure Present, Absent
isInherited Write System.Boolean Specifies whether the permissions are inherited from the parent repository. Default value is $true.
Permissions Write System.Collections.Hashtable[]
RepositoryName Write System.String Specifies the name of the Git repository.
LookupResult Read System.Collections.Hashtable

Description

The AzDoGitPermission class is a DSC resource that allows you to manage Git permissions in Azure DevOps. It inherits from the AzDevOpsDscResourceBase class and provides properties and methods for managing Git permissions.

Examples

Example 1

This example shows how to ensure that the Git repository permissions.

Configuration Example
{

    Import-DscResource -ModuleName 'AzureDevOpsDscNative'

    node localhost
    {
        AzDoGitPermission 'AddGitPermission'
        {
            Ensure               = 'Present'
            ProjectName          = 'Test Project'
            RepositoryName       = 'Test Repository'
            isInherited          = $true
            Permissions          = @(
                @{
                    Identity = '[Project]\Contributors'
                    Permission = @{
                        read        = 'allow'
                        contribute  = 'allow'
                    }
                },
                @{
                    Identity = '[Project]\Readers'
                    Permission = @{
                        read       = 'allow'
                    }
                }
            )
        }
    }
}

Example 2

This example shows how to update the Git repository permissions.

Configuration Example
{

    Import-DscResource -ModuleName 'AzureDevOpsDscNative'

    node localhost
    {
        AzDoGitPermission 'UpdateGitPermission'
        {
            Ensure               = 'Present'
            ProjectName          = 'Test Project'
            RepositoryName       = 'Test Repository'
            isInherited          = $true
            Permissions          = @(
                @{
                    Identity = '[Project]\Contributors'
                    Permission = @{
                        read        = 'allow'
                        contribute  = 'deny'
                    }
                },
                @{
                    Identity = '[Project]\Readers'
                    Permission = @{
                        read       = 'deny'
                    }
                }
            )
        }
    }
}

Example 3

This example shows how to remove Git repository permissions.

Configuration Example
{

    Import-DscResource -ModuleName 'AzureDevOpsDscNative'

    node localhost
    {
        AzDoGitPermission 'DeleteGitPermission'
        {
            Ensure               = 'Present'
            ProjectName          = 'Test Project'
            RepositoryName       = 'Test Repository'
            isInherited          = $true
            # Note: Permissions can be empty to remove all permissions
            # Ensure = 'Absent' is not required.
            Permissions          = @()
        }
    }
}

Commands

Resources

Clone this wiki locally