Skip to content

AzDevOpsProject

dscbot edited this page Nov 17, 2024 · 1 revision

Parameters

Parameter Attribute DataType Description Allowed Values
ProjectName Key System.String The 'Name' of the Azure DevOps, 'Project' resource.
ApiUri Write System.String
Ensure Write Ensure Present, Absent
Pat Write System.String
ProjectDescription Write System.String The 'Description' of the Azure DevOps, 'Project' resource.
ProjectId Write System.String The 'Id' of the Azure DevOps, 'Project' resource.
SourceControlType Write System.String The 'SourceControlType' of the Azure DevOps, 'Project' resource. If the 'Project' resource already exists in Azure DevOps, the parameter SourceControlType cannot be used to change to another type. Git, Tfvc

Description

A DSC Resource for Azure DevOps that represents the 'Project' resource.

Examples

Example 1

This example shows how to ensure that the Azure DevOps project called 'Test Project' exists (or is added if it does not exist).

Configuration Example
{
    param
    (
        [Parameter(Mandatory = $true)]
        [string]
        $ApiUri,

        [Parameter(Mandatory = $true)]
        [string]
        $Pat
    )

    Import-DscResource -ModuleName 'AzureDevOpsDsc'

    node localhost
    {
        AzDevOpsProject 'AddProject'
        {
            Ensure               = 'Present'

            ApiUri               = $ApiUri
            Pat                  = $Pat

            ProjectName          = 'Test Project'
            ProjectDescription   = 'A Test Project'

            SourceControlType    = 'Git'
        }

    }
}

Example 2

This example shows how to ensure that an Azure DevOps project with a ProjectName of 'Test Project' can have it's description updated to 'A Test Project with a new description'.

Configuration Example
{
    param
    (
        [Parameter(Mandatory = $true)]
        [string]
        $ApiUri,

        [Parameter(Mandatory = $true)]
        [string]
        $Pat
    )

    Import-DscResource -ModuleName 'AzureDevOpsDsc'

    node localhost
    {
        AzDevOpsProject 'UpdateProject'
        {
            Ensure               = 'Present'

            ApiUri               = $ApiUri
            Pat                  = $Pat

            ProjectName          = 'Test Project'
            ProjectDescription   = 'A Test Project with a new description'  # Updated property


            #SourceControlType    = 'Git'  # Note: Update of this property is not supported

        }

    }
}

Example 3

This example shows how to delete a project called 'Test Project'.

Configuration Example
{
    param
    (
        [Parameter(Mandatory = $true)]
        [string]
        $ApiUri,

        [Parameter(Mandatory = $true)]
        [string]
        $Pat
    )

    Import-DscResource -ModuleName 'AzureDevOpsDsc'

    node localhost
    {

        AzDevOpsProject 'DeleteProject'
        {
            Ensure               = 'Absent'  # 'Absent' ensures this will be removed/deleted

            ApiUri               = $ApiUri
            Pat                  = $Pat

            ProjectName          = 'Test Project'  # Identifies the name of the project to be deleted
        }

    }
}

Home

Resources

Clone this wiki locally