Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
Comment thread
Manbearpiet marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
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
)

begin {
Write-Verbose "Starting function: Get-AzDoTeamSettings"
Comment thread
Manbearpiet marked this conversation as resolved.
$CollectionUri = $CollectionUri.TrimEnd('/')
# create dynamic array to store the results
$result = New-Object System.Collections.Generic.List[System.Object]
}

process {
foreach ($Name in $TeamName) {
$params = @{
Comment thread
Manbearpiet marked this conversation as resolved.
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 {
$result += Invoke-AzDoRestMethod @params
} catch {
Write-AzdoError -Message $_
}
} else {
Write-Verbose "Skipping team settings for team '$Name' in project '$ProjectName'."
}
}
}

end {
if ($result) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We made a bad example, need to remove this pattern consistently from the repo.

$result | ForEach-Object {
[PSCustomObject]@{
TeamId = ($_.url -split '/')[-4]
BacklogIteration = $_.backlogIteration
BacklogVisibilities = $_.backlogVisibilities
DefualtIteration = $_.defaultIteration
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

DefaultIterationMacro = $_.defaultIterationMacro
WorkingDays = $_.workingDays
BugsBehavior = $_.bugsBehavior
Url = $_.url
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
function Set-AzDoTeamSettings {
<#
.SYNOPSIS
Set the settings of a Team in Azure DevOps.
.DESCRIPTION
Set the settings of a Team or multiple in Azure DevOps.
.EXAMPLE
$Params = @{
CollectionUri = "https://dev.azure.com/cantoso"
ProjectName = "Playground"
TeamName = "Team1"
BacklogIteration = "323b04b6-2fb8-4093-94f4-fbe3bd36a19f"
DefaultIteration = "8c2457e8-8936-4cdc-b3aa-17b20f56c76c"
BugsBehavior = "off"
WorkingDays = @("monday", "tuesday", "wednesday", "thursday", "friday")
Iterations = @(
"8c2457e8-8936-4cdc-b3aa-17b20f56c76c",
"323b04b6-2fb8-4093-94f4-fbe3bd36a19f"
)
AreaPath = "ProjectName"
IncludeAreaChildren = $true
}

Set-AzDoTeamSettings @Params

This example will set the settings of the team 'Team1' in the project 'Playground'.
#>
[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,

# Backlog iteration id
[Parameter(ValueFromPipelineByPropertyName)]
[string]
$BacklogIteration,

# Bugs behavior
[Parameter(ValueFromPipelineByPropertyName)]
[ValidateSet('off', 'asRequirements', 'asTasks')]
[string]
$BugsBehavior,

# Working days
[Parameter(ValueFromPipelineByPropertyName)]
[ValidateSet('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday')]
[string[]]
$WorkingDays,

# Iteration paths
[Parameter(ValueFromPipelineByPropertyName)]
[string[]]
$Iterations,

# Area path
[Parameter(ValueFromPipelineByPropertyName)]
[string]
$AreaPath,

# Include area children
[Parameter(ValueFromPipelineByPropertyName)]
[bool]
$IncludeAreaChildren = $true
)

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

process {
$Team = Get-AzDoTeam -CollectionUri $CollectionUri -ProjectName $ProjectName -TeamName $TeamName -ErrorAction SilentlyContinue
if ($Team) {
# Set the team settings
$Settings = @{}
if ($BacklogIteration) {
$Settings.backlogIteration = $BacklogIteration
}
if ($BugsBehavior) {
$Settings.bugsBehavior = $BugsBehavior
}
if ($WorkingDays) {
$Settings.workingDays = $WorkingDays
}
$SettingsParams = @{
uri = "$CollectionUri/$ProjectName/$TeamName/_apis/work/teamSettings"
method = 'PATCH'
version = '7.1-preview.1'
body = $Settings
}
try {
Write-Verbose "Setting team settings for team '$TeamName' in project '$ProjectName'."
$SettingsResult = Invoke-AzDoRestMethod @SettingsParams
} catch {
Write-AzdoError -Message $_
}

# Set the area path
if ($AreaPath) {
$AreaParams = @{
uri = "$CollectionUri/$ProjectName/$TeamName/_apis/work/teamsettings/teamfieldvalues"
method = 'PATCH'
version = '7.1-preview.1'
body = @{
defaultValue = "$ProjectName\\$AreaPath"
values = @(
@{
includeChildren = $IncludeAreaChildren
value = "$ProjectName\\$AreaPath"
}
)
}
}
try {
Write-Verbose "Setting area path for team '$TeamName' in project '$ProjectName'."
$AreaResult = Invoke-AzDoRestMethod @AreaParams
} catch {
Write-AzdoError -Message $_
}
}

# Set the iteration paths
$IterationResult = @()
foreach ($Iteration in $Iterations) {
$IterationParams = @{
uri = "$CollectionUri/$ProjectName/$TeamName/_apis/work/teamsettings/iterations"
method = 'POST'
version = '7.1-preview.1'
body = @{ id = $Iteration }
}
try {
Write-Verbose "Setting iteration paths for team '$TeamName' in project '$ProjectName'."
$IterationResult += Invoke-AzDoRestMethod @IterationParams
} catch {
Write-AzdoError -Message $_
}
}

$result += [PSCustomObject]@{
CollectionUri = $CollectionUri
ProjectName = $ProjectName
TeamName = $TeamName
BacklogIteration = $SettingsResult.backlogIteration
BugsBehavior = $SettingsResult.bugsBehavior
WorkingDays = $SettingsResult.workingDays
AreaPath = $AreaResult.defaultValue
IncludeAreaChildren = $AreaResult.values.includeChildren
Iterations = $IterationResult
}
} else {
Write-Host "Team '$TeamName' not found in project '$ProjectName', skipping."
}
}

end {
if ($result) {
$result
}
Write-Verbose "Ending function: Set-AzDoTeamSettings"
}
}
110 changes: 110 additions & 0 deletions AzureDevOpsPowerShell/Public/Api/Core/Teams/Get-AzDoTeam.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
function Get-AzDoTeam {
<#
.SYNOPSIS
Gets information about a team in Azure DevOps.
.DESCRIPTION
Gets information about 1 team if the parameter $TeamName is filled in. Otherwise it will list all the teams's.
.EXAMPLE
$Params = @{
CollectionUri = "https://dev.azure.com/contoso"
}
Get-AzDoTeam -CollectionUri = "https://dev.azure.com/contoso"

This example will list all the teams in the organization.
.EXAMPLE
$Params = @{
CollectionUri = "https://dev.azure.com/contoso"
ProjectName = "Project 1"
}
Get-AzDoTeam -CollectionUri = "https://dev.azure.com/contoso" -ProjectName = "Project 1"

This example will list all the teams contained in 'Project 1'.
.EXAMPLE
$Params = @{
CollectionUri = "https://dev.azure.com/contoso"
TeamName "Team 1"
}
Get-AzDoTeam -CollectionUri = "https://dev.azure.com/contoso" -TeamName "Team 1"

This example will fetch information about the team with the name 'Team 1'.
.EXAMPLE
$Params = @{
CollectionUri = "https://dev.azure.com/contoso"
TeamId "564e8204-a90b-4432-883b-d4363c6125ca"
}
Get-AzDoTeam -CollectionUri = "https://dev.azure.com/contoso" -TeamId "564e8204-a90b-4432-883b-d4363c6125ca"

This example will fetch information about the team with the ID '564e8204-a90b-4432-883b-d4363c6125ca'.
.OUTPUTS
PSObject with team(s).

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

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

# Name of the team to fetch
[Parameter(ValueFromPipelineByPropertyName)]
[string[]]
$TeamName,

# Id of the team to fetch
[Parameter(ValueFromPipelineByPropertyName)]
[string]
$TeamId
)

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

process {
$params = @{
uri = "$CollectionUri/_apis/teams"
version = "7.1-preview.3"
method = 'GET'
}

if ($PSCmdlet.ShouldProcess($CollectionUri, "Get Teams from: $($PSStyle.Bold)$ProjectName$($PSStyle.Reset)")) {
$teams = (Invoke-AzDoRestMethod @params).value

# Filter the teams if the parameters are filled in
if ($TeamName) {
$teams = $teams | Where-Object { $_.name -eq $TeamName }
}
if ($ProjectName) {
$teams = $teams | Where-Object { $_.projectName -eq $ProjectName }
}
if ($TeamId) {
$teams = $teams | Where-Object { $_.id -eq $TeamId }
}
$result = $teams
} else {
Write-Verbose "Calling Invoke-AzDoRestMethod with $($params| ConvertTo-Json -Depth 10)"
}
}

end {
if ($result) {
$result | ForEach-Object {
[PSCustomObject]@{
CollectionURI = $CollectionUri
ProjectName = $ProjectName
TeamName = $_.name
TeamId = $_.id
}
}
} else {
Write-Host "No teams found"
}
}
}
Loading