Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
356a5a1
feat: Add support for workitems and team settings
Sep 19, 2024
18e6bb4
Merge branch 'main' into feature/teams-boards
magusdevs Sep 28, 2024
6cd93ff
Merge branch 'main' into feature/teams-boards
Manbearpiet Dec 12, 2024
26d879d
refactor: Improve error handling and messaging across multiple functions
Manbearpiet Dec 13, 2024
c3a8b1c
fix: Enhance error handling for team retrieval in Get-AzDoTeamSetting…
Manbearpiet Dec 13, 2024
aab2400
fix: Update API version in Get-AzDoWorkItem function and add support …
Manbearpiet Dec 13, 2024
4d6782d
fix: Add ValueFromPipelineByPropertyName to parameters in Get-AzDoWor…
Manbearpiet Dec 16, 2024
ae8f9c2
fix: Add WorkItemId to output in Get-AzDoWorkItem function
Manbearpiet Dec 16, 2024
50e10e5
fix: Update New-AzDoWorkItem function to include WorkItemId and addit…
Manbearpiet Dec 16, 2024
816660b
fix: Enhance Remove-AzDoWorkItem function to include deleted date and…
Manbearpiet Dec 16, 2024
a668c21
fix: Add ValueFromPipelineByPropertyName to parameters in Set-AzDoWor…
Manbearpiet Dec 16, 2024
64a73eb
fix: Update documentation for various cmdlets to improve output forma…
Manbearpiet Dec 16, 2024
7f73e56
fix: Improve verbosity in Get-AzDoProject function for better debuggi…
Manbearpiet Dec 16, 2024
36e4a78
fix: Refactor New-AzDoProject function to streamline processing and i…
Manbearpiet Dec 16, 2024
d2defa7
fix: Enhance Remove-AzDoProject function with error handling and impr…
Manbearpiet Dec 16, 2024
06f5cba
fix: Add error handling and improve verbosity in Get-AzDoTeam function
Manbearpiet Dec 16, 2024
5874278
fix: Improve verbosity and streamline processing in Add-AzDoVariableG…
Manbearpiet Dec 16, 2024
1664c13
fix: Add error handling and improve output structure in Get-AzDoVaria…
Manbearpiet Dec 16, 2024
5457a87
fix: Enhance New-AzDoVariableGroup function with error handling and i…
Manbearpiet Dec 16, 2024
11143f9
fix: Add error handling and improve output structure in Get-AzDoEnvir…
Manbearpiet Dec 16, 2024
f038fa9
fix: Improve verbosity in Get-AzDoEnvironment function
Manbearpiet Dec 16, 2024
845548d
fix: Enhance Get-AzDoRepo function with improved verbosity and stream…
Manbearpiet Dec 16, 2024
fb00379
fix: Improve verbosity and streamline output in Get-AzDoPipeline func…
Manbearpiet Dec 16, 2024
2abc8a7
fix: Remove unnecessary verbose output in Get-AzDoPipeline function
Manbearpiet Dec 16, 2024
d09f49b
fix: Enhance Set-AzDoBranchPolicyBuildValidation function with improv…
Manbearpiet Dec 16, 2024
d67e261
fix: Improve verbosity and streamline output in Set-AzDoBranchPolicyC…
Manbearpiet Dec 16, 2024
acdce96
fix: Add error handling for policy creation in Set-AzDoBranchPolicyCo…
Manbearpiet Dec 16, 2024
b421327
fix: Add error handling and improve verbosity in Set-AzDoBranchPolicy…
Manbearpiet Dec 16, 2024
6995fde
fix: Add error handling and improve verbosity in Set-AzDoBranchPolicy…
Manbearpiet Dec 16, 2024
f3e9081
fix: Add error handling and improve verbosity in Get-AzDoBranchPolicy…
Manbearpiet Dec 16, 2024
742572a
refactor: Streamline Get-AzDoClassificationNode function and improve …
Manbearpiet Dec 16, 2024
0e5277f
fix: Add error handling and improve verbosity in Remove-AzDoClassific…
Manbearpiet Dec 16, 2024
9931392
fix: Improve verbosity in Add-AzDoPipelineBranchControl function
Manbearpiet Dec 16, 2024
4cee34e
fix: Add verbosity to Set-AzDOProjectSetting function
Manbearpiet Dec 16, 2024
fdb97e9
fix: Improve verbosity in Set-AzDoTeamSettings function
Manbearpiet Dec 16, 2024
3a5da3b
fix: Add verbosity to Get-AzDoVariableGroup function
Manbearpiet Dec 16, 2024
09c319e
fix: Add verbosity to New-AzDoEnvironment function
Manbearpiet Dec 16, 2024
9d04b87
fix: Improve verbosity in New-AzDoPullRequest function
Manbearpiet Dec 16, 2024
65fcb41
fix: Add verbosity to Add-FilesToRepo function
Manbearpiet Dec 16, 2024
a58a636
fix: Add verbosity to New-AzDoRepo function
Manbearpiet Dec 16, 2024
7867bb3
fix: Add verbosity to Get-AzDoBranchPolicy function
Manbearpiet Dec 16, 2024
7056ec6
fix: Add verbosity to Test-AzDoServiceConnection function
Manbearpiet Dec 16, 2024
07f1c76
fix: Enhance verbosity in Get-AzDoServiceConnection function
Manbearpiet Dec 16, 2024
edc1cf4
fix: Add verbose logging to New-AzDoServiceConnection function
Manbearpiet Dec 16, 2024
362fe39
fix: Remove unused variable in Get-AzDoServiceConnection function
Manbearpiet Dec 16, 2024
f25f32f
fix: Add error handling to Add-AzDoPipelineBranchControl function
Manbearpiet Dec 16, 2024
6df61cc
fix: Add error handling to Test-AzDoServiceConnection function
Manbearpiet Dec 16, 2024
63e3127
fix: Add error handling to Get-AzDoProject function
Manbearpiet Dec 16, 2024
fb9b0d5
fix: Add error handling to Add-AzDoVariableGroupVariable function
Manbearpiet Dec 16, 2024
577ff07
fix: Add error handling to Get-AzDoRepo function
Manbearpiet Dec 16, 2024
e10ded1
fix: Add error handling to Get-AzDoPipeline function
Manbearpiet Dec 16, 2024
193717c
fix: Add error handling to Get-PipelineRun function
Manbearpiet Dec 16, 2024
aded3d5
fix: Add error handling to Get-AzDoBranchPolicy function
Manbearpiet Dec 16, 2024
9e7aa5d
fix: Add error handling to Set-AzDoBranchPolicyBuildValidation function
Manbearpiet Dec 16, 2024
e04d7a2
fix: Add error handling to Get-AzDoServiceConnection function
Manbearpiet Dec 16, 2024
7f02a4f
fix: Add error handling to New-AzDoServiceConnection function
Manbearpiet Dec 16, 2024
9c198c0
fix: Add error handling to Get-AzDoClassificationNode function
Manbearpiet Dec 16, 2024
942496d
fix: Enhance error handling in Remove-AzDoProject function
Manbearpiet Dec 17, 2024
808512c
fix: Update parameter attributes in New-AzDoTeam function for pipelin…
Manbearpiet Dec 17, 2024
2563ff3
fix: Correct typo in DefaultIteration property in Get-AzDoTeamSetting…
Manbearpiet Dec 17, 2024
5c2c31b
fix: Update parameter attributes in Remove-AzDoTeam function for pipe…
Manbearpiet Dec 17, 2024
98429d7
fix: Improve team deletion logic in Remove-AzDoTeam function for bett…
Manbearpiet Dec 17, 2024
49ffb89
docs: fix examples in New-AzDoVariableGroup function
Manbearpiet Dec 17, 2024
b0de18b
fix: Enable pipeline input for parameters in New-AzDoVariableGroup do…
Manbearpiet Dec 17, 2024
da71e1a
fix: Add support for PUT method in Invoke-AzDoRestMethod function
Manbearpiet Dec 18, 2024
b89990a
fix: Refactor Add-AzDoVariableGroupVariable function for improved var…
Manbearpiet Dec 18, 2024
2f66f39
fix: Simplify variable group retrieval logic in Get-AzDoVariableGroup…
Manbearpiet Dec 18, 2024
ccc53b2
fix: Correct verbose message in Get-AzDoVariableGroup function for cl…
Manbearpiet Dec 18, 2024
2f3a2ff
fix: Enhance variable output formatting in New-AzDoVariableGroup func…
Manbearpiet Dec 18, 2024
4afb014
Merge branch 'main' into feature/teams-boards
Dylan-Prins Aug 19, 2025
67ae4e2
Merge branch 'main' into feature/teams-boards
Dylan-Prins Aug 19, 2025
044a123
fix: fix help
Dylan-Prins Aug 19, 2025
9042a11
fix: disable tests for now
Dylan-Prins Aug 19, 2025
c403b7c
fix: fixing pester tests
Dylan-Prins Aug 19, 2025
deff32c
fix: disable test
Dylan-Prins Aug 19, 2025
db145b5
fix: fixing help test
Dylan-Prins Aug 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions AzureDevOpsPowerShell/Private/Invoke-AzDoRestMethod.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function Invoke-AzDoRestMethod {
$QueryParameters,

[Parameter(Mandatory)]
[ValidateSet('GET', 'POST', 'PATCH', 'DELETE')]
[ValidateSet('GET', 'POST', 'PATCH', 'DELETE', "PUT")]
[string]
$Method,

Expand Down Expand Up @@ -92,15 +92,15 @@ function Invoke-AzDoRestMethod {
}

process {
if ($Method -eq 'POST' -or ($Method -eq 'PATCH')) {
if ($Method -in @('POST', 'PATCH', "PUT")) {
Write-Verbose "Body: $($Body | ConvertTo-Json -Depth 10)"
$params.Body = $Body | ConvertTo-Json -Depth 10
}
if ($PSCmdlet.ShouldProcess($ProjectName, "Invoke Rest method on: $($PSStyle.Bold)$ProjectName$($PSStyle.Reset)")) {
try {
Invoke-RestMethod @params
} catch {
Write-AzdoError -Message ($_ | ConvertFrom-Json).message
$PSCmdlet.ThrowTerminatingError((Write-AzdoError -Message ($_ | ConvertFrom-Json).message))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion AzureDevOpsPowerShell/Private/Validate-CollectionUri.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function Validate-CollectionUri {
)

if ($CollectionUri -notmatch '^https:\/\/dev\.azure\.com\/\w+') {
Write-AzdoError "CollectionUri must be a valid Azure DevOps collection URI starting with 'https://dev.azure.com/'"
$PSCmdlet.ThrowTerminatingError((Write-AzdoError "CollectionUri must be a valid Azure DevOps collection URI starting with 'https://dev.azure.com/'"))
} else {
$true
}
Expand Down
4 changes: 1 addition & 3 deletions AzureDevOpsPowerShell/Private/Write-AzDoError.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ function Write-AzDoError {


process {
$errorRec = [System.Management.Automation.ErrorRecord]::new(
[System.Management.Automation.ErrorRecord]::new(
[Exception]::new($Message),
'ErrorID',
[System.Management.Automation.ErrorCategory]::OperationStopped,
'TargetObject'
)

$PScmdlet.ThrowTerminatingError($errorRec)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,8 @@ function Add-AzDoPipelineBranchControl {
[int]
$Timeout = 1440
)

begin {
Write-Verbose "Starting function: Add-AzDoPipelineBranchControl"
}

process {
Write-Verbose "Starting function: Add-AzDoPipelineBranchControl"

foreach ($name in $ResourceName) {

Expand Down Expand Up @@ -143,12 +139,16 @@ function Add-AzDoPipelineBranchControl {
}

if ($PSCmdlet.ShouldProcess($ProjectName, "Create build-validation policy named: $($PSStyle.Bold)$PolicyName$($PSStyle.Reset)")) {
Invoke-AzDoRestMethod @params | ForEach-Object {
[PSCustomObject]@{
CollectionUri = $CollectionUri
ProjectName = $ProjectName
CheckId = $_.id
try {
Invoke-AzDoRestMethod @params | ForEach-Object {
[PSCustomObject]@{
CollectionUri = $CollectionUri
ProjectName = $ProjectName
CheckId = $_.id
}
}
} catch {
Write-Error "Failed to create build-validation policy named: $($PolicyName) on $($ResourceType) named: $($name) in project: $($ProjectName) in collection: $($CollectionUri). Error: $_"
}
} else {
Write-Verbose "Calling Invoke-AzDoRestMethod with $($params| ConvertTo-Json -Depth 10)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,8 @@ function Set-AzDoProjectSetting {
[switch]
$StatusBadgesArePrivate
)

begin {
Write-Verbose "Starting function: Set-AzDOProjectSetting"
}

process {
Write-Verbose "Starting function: Set-AzDOProjectSetting"

$body = @{
buildsEnabledForForks = [bool]$BuildsEnabledForForks
Expand Down
35 changes: 15 additions & 20 deletions AzureDevOpsPowerShell/Public/Api/Core/Projects/Get-AzDoProject.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,8 @@ function Get-AzDoProject {
[string[]]
$ProjectName
)

begin {
Write-Verbose "Starting function: Get-AzDoProject"
}

process {
Write-Verbose "Starting function: Get-AzDoProject"

$params = @{
uri = "$CollectionUri/_apis/projects"
Expand All @@ -73,23 +69,22 @@ function Get-AzDoProject {
}

if ($PSCmdlet.ShouldProcess($CollectionUri, "Get Project(s)")) {
$result = (Invoke-AzDoRestMethod @params).value | Where-Object { -not $ProjectName -or $_.Name -in $ProjectName }
} else {
Write-Verbose "Calling Invoke-AzDoRestMethod with $($params| ConvertTo-Json -Depth 10)"
}
}
end {
if ($result) {
$result | ForEach-Object {
[PSCustomObject]@{
CollectionURI = $CollectionUri
ProjectName = $_.name
ProjectID = $_.id
ProjectURL = $_.url
ProjectVisibility = $_.visibility
State = $_.state
try {
(Invoke-AzDoRestMethod @params).value | Where-Object { -not $ProjectName -or $_.Name -in $ProjectName } | ForEach-Object {
[PSCustomObject]@{
CollectionURI = $CollectionUri
ProjectName = $_.name
ProjectID = $_.id
ProjectURL = $_.url
ProjectVisibility = $_.visibility
State = $_.state
}
}
} catch {
$PSCmdlet.ThrowTerminatingError((Write-AzDoError -Message "Failed to get projects in collection '$CollectionURI' Error: $_" ))
}
} else {
Write-Verbose "Calling Invoke-AzDoRestMethod with $($params| ConvertTo-Json -Depth 10)"
}
}
}
Expand Down
15 changes: 3 additions & 12 deletions AzureDevOpsPowerShell/Public/Api/Core/Projects/New-AzDoProject.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,9 @@ function New-AzDoProject {
[string]
$Visibility = 'private'
)

begin {
process {
Write-Verbose "Starting function: New-AzDoProject"
}

process {

$params = @{
uri = "$CollectionUri/_apis/projects"
Expand Down Expand Up @@ -160,7 +157,7 @@ function New-AzDoProject {
if ($_ -match 'TF200019') {
Write-Warning "Project $name already exists, trying to get it"
} else {
Write-AzDoError -message $_
$PSCmdlet.ThrowTerminatingError((Write-AzDoError -message "Failed to create project: $name Error: $_"))
}
}

Expand All @@ -176,16 +173,10 @@ function New-AzDoProject {
} while (
$response.State -ne 'wellFormed'
)
$result += ($response)
$response
} else {
Write-Verbose "Calling Invoke-AzDoRestMethod with $($params| ConvertTo-Json -Depth 10)"
}
}
}

end {
if ($result) {
$result
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,8 @@ function Remove-AzDoProject {
[string[]]
$ProjectName
)

begin {
Write-Verbose "Starting function: Remove-AzDoProject"
$result = @()
}

Process {
Write-Verbose "Starting function: Remove-AzDoProject"

foreach ($name in $ProjectName) {

Expand All @@ -64,16 +59,29 @@ function Remove-AzDoProject {
}

if ($PSCmdlet.ShouldProcess($CollectionUri, "Delete project named: $($PSStyle.Bold)$name$($PSStyle.Reset)")) {
$result += Invoke-AzDoRestMethod @params
try {
Invoke-AzDoRestMethod @params | ForEach-Object {
[PSCustomObject]@{
CollectionURI = $CollectionUri
ProjectName = $name
ProjectID = $_.id
Removed = $true
}
}
} catch {
Write-Error "Error Deleting project '$projectname' in collectionURI '$CollectionUri' Error: $_"
[PSCustomObject]@{
CollectionURI = $CollectionUri
ProjectName = $name
ProjectID = $projectId
Removed = $false
}
continue
}
} else {
Write-Verbose "Calling Invoke-AzDoRestMethod with $($params| ConvertTo-Json -Depth 10)"
}
}
}

end {
if ($result) {
$result
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
function Get-AzDoTeamSettings {
<#
.SYNOPSIS
Get the settings of a Team in Azure DevOps.
.DESCRIPTION
Get the settings of a Team or multiple in Azure DevOps.
.EXAMPLE
$Params = @{
CollectionUri = "https://dev.azure.com/cantoso"
ProjectName = "Playground"
TeamName = "Team1"
}

Get-AzDoTeamSettings @Params

This example will get the settings of the team 'Team1' in the project 'Playground'.
.OUTPUTS
PSObject with the settings of the team(s).
#>

[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')]
param (
# Collection Uri of the organization
[Parameter(Mandatory, ValueFromPipelineByPropertyName)]
[ValidateScript({ Validate-CollectionUri -CollectionUri $_ })]
[string]
$CollectionUri,

# Name of the project where the team is located
[Parameter(Mandatory, ValueFromPipelineByPropertyName)]
[string]
$ProjectName,

# Name of the team to get the settings from
[Parameter(Mandatory, ValueFromPipelineByPropertyName)]
[string[]]
$TeamName
)
process {
Write-Verbose "Starting function: Get-AzDoTeamSettings"
$CollectionUri = $CollectionUri.TrimEnd('/')

foreach ($Name in $TeamName) {
try {
$team = Get-AzDoTeam -CollectionUri $CollectionUri -ProjectName $ProjectName -TeamName $Name
if (-not $team) {
Write-Error "Team '$Name' not found in project '$ProjectName'."
continue
}
} catch {
Write-Error "Failed to get team '$Name' in project '$ProjectName'. Error: $_"
continue
}

$params = @{
uri = "$CollectionUri/$ProjectName/$Name/_apis/work/teamSettings"
method = 'GET'
version = '7.1-preview.1'
}

if ($PSCmdlet.ShouldProcess("Get team settings for team '$Name' in project '$ProjectName'")) {
try {
Invoke-AzDoRestMethod @params | ForEach-Object {
[PSCustomObject]@{
CollectionUri = $CollectionUri
ProjectName = $ProjectName
TeamName = $Name
TeamId = ($_.url -split '/')[-4]
BacklogIteration = $_.backlogIteration
BacklogVisibilities = $_.backlogVisibilities
DefaultIteration = $_.defaultIteration
DefaultIterationMacro = $_.defaultIterationMacro
WorkingDays = $_.workingDays
BugsBehavior = $_.bugsBehavior
Url = $_.url
}
}
} catch {
Write-Error "Failed to get settings for team '$name' in $projectName Error: $_"
continue
}
} else {
Write-Verbose "Skipping team settings for team '$Name' in project '$ProjectName'."
}
}
}
}
Loading
Loading