This is a refactored version of the AzureDevOpsDsc project, originally created by the DSC Community. This refactored poroject that support DSC v3.
- About This Project
- Parameters documentation
- Original Project
- Credits
- License
- Getting Started
- Prerequisites
- Setup and Example of Configuration
- Testing
- Change Log
This repository represents a modernized and refactored implementation of the AzureDevOpsDsc module, building upon the foundation established by the DSC Community. The v3 version aims to improve maintainability, performance, and compatibility with current Azure DevOps and PowerShell DSC standards.
The original AzureDevOpsDsc project was developed and maintained by the DSC Community and can be found at:
- Repository: https://github.com/dsccommunity/AzureDevOpsDsc
Full credit for the original concept and implementation goes to the DSC Community and all contributors to the original AzureDevOpsDsc project.
Please refer to the LICENSE file for licensing information.
To get started either:
- Install from the PowerShell Gallery using PowerShellGet by running the following command:
Install-Module -Name AzureDevOpsDscv3 -Repository PSGallery- Download AzureDevOpsDsc from the PowerShell Gallery
and then unzip it to one of your PowerShell modules folders (such as
$env:ProgramFiles\WindowsPowerShell\Modules).
To confirm installation, run the below command and ensure you see the AzureDevOpsDsc DSC resources available:
Get-DscResource -Module AzureDevOpsDscv3The minimum Windows Management Framework (PowerShell) version required is 5.0 or higher, which ships with Windows 10 or Windows Server 2016, but can also be installed on Windows 7 SP1, Windows 8.1, Windows Server 2012, and Windows Server 2012 R2.
DSCv3: DSCv3 Get-Started
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
parameters:
Token:
type: string
defaultValue: PAT-Token
resources:
- name: Working with classic DSC resources for ADO v4
type: Microsoft.Windows/WindowsPowerShell
properties:
resources:
- name: Create ADO project - DSC
type: AzureDevOpsDscv3/ProjectResource
properties:
Organization: ExampleOrganization
ProjectName: TestDSC
Description: "Project created via DSC v3 with secure parameters"
pat: "[parameters('Token')]"
SourceControlType: Git
Ensure: Present
- name: AddUser
type: AzureDevOpsDscv3/OrganizationUserResource
properties:
UserPrincipalName: UserPrincipalName
Organization: ExampleOrganization
AccessLevel: Basic # or Stakeholder, BasicPlusTestPlans
Ensure: Present
pat: "[parameters('Token')]"
- name: AddGroup
type: AzureDevOpsDscv3/OrganizationGroupResource
properties:
GroupOriginId: EntraID-GroupObjectID # group descriptor
GroupDisplayName: EntraID-GroupDisplayName
Organization: ExampleOrganization
AccessLevel: Basic
Ensure: Present
pat: "[parameters('Token')]"
#(Note: If you are on a 32-bit system, use .x86 instead).
winget install Microsoft.VCRedist.2015+.x64
# Install latest stable
winget install --id 9NVTPZWRC6KQ --source msstore
dsc --version
dsc -l debug config set --file .\dsc_resources_ado.dsc.yaml
This project includes comprehensive unit tests using the Pester testing framework.
To run the tests locally, you need to have Pester 5.0+ installed:
# Install Pester if not already installed
# Note: -Force is used to ensure the latest version is installed
Install-Module -Name Pester -MinimumVersion 5.0.0 -Force -Scope CurrentUser
# Run all tests
Invoke-Pester -Path ./tests
# Run tests with code coverage
$config = New-PesterConfiguration
$config.Run.Path = './tests'
$config.CodeCoverage.Enabled = $true
$config.CodeCoverage.Path = './module/AzureDevOpsDscv3/AzureDevOpsDscv3.psm1'
$config.Output.Verbosity = 'Detailed'
Invoke-Pester -Configuration $configThe project uses GitHub Actions for continuous integration. Tests are automatically run on:
- Push to the
mainbranch - Pull requests targeting the
mainbranch
The CI workflow:
- Sets up a PowerShell environment
- Installs required dependencies
- Runs all Pester tests
- Generates code coverage reports
- Uploads test results and coverage artifacts
Test results and code coverage reports are available as artifacts in the GitHub Actions workflow runs.
A full list of changes in each version can be found in the change log.