Skip to content

Commit c7e2d98

Browse files
committed
docs: 📚 Update examples in Remove-AzDoEnvironment, Get-AzDoProjectProperties, Get-AzDoEnvironment, and Get-AzDoPipelineBranchControl functions
- Enhanced documentation with additional examples for clarity. - Provided detailed usage scenarios for removing environments and retrieving project properties. - Improved consistency across function documentation.
1 parent 4703b87 commit c7e2d98

6 files changed

Lines changed: 198 additions & 118 deletions

File tree

AzureDevOpsPowerShell/Public/Api/Core/Projects/Get-AzDoProjectProperties.ps1

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,34 @@
1-
<#
1+
function Get-AzDoProjectProperties {
2+
<#
23
.SYNOPSIS
34
Retrieves properties of specified Azure DevOps projects.
45
56
.DESCRIPTION
67
The Get-AzDoProjectProperties function retrieves properties of specified Azure DevOps projects within a given collection URI. It supports pipeline input for project names and collection URI.
78
89
.EXAMPLE
9-
PS> Get-AzDoProjectProperties -CollectionUri "https://dev.azure.com/organization" -ProjectName "Project1"
10+
$Params = @{
11+
CollectionUri = "https://dev.azure.com/organization"
12+
ProjectName = "Project1"
13+
}
14+
Get-AzDoProjectProperties @Params
15+
16+
This example retrieves properties of the project named "Project1" in the specified Azure DevOps organization.
1017
1118
.EXAMPLE
12-
PS> "Project1", "Project2" | Get-AzDoProjectProperties -CollectionUri "https://dev.azure.com/organization"
19+
$Params = @{
20+
CollectionUri = "https://dev.azure.com/organization"
21+
}
22+
"Project1", "Project2" | Get-AzDoProjectProperties @Params
23+
24+
This example retrieves properties of multiple projects ("Project1" and "Project2") in the specified Azure DevOps organization.
1325
1426
.NOTES
1527
This function requires the Validate-CollectionUri and Invoke-AzDoRestMethod helper functions to be defined in the scope.
1628
1729
.LINK
1830
https://learn.microsoft.com/en-us/rest/api/azure/devops/core/projects/get-project-properties?view=azure-devops-rest-7.1&tabs=HTTP
1931
#>
20-
function Get-AzDoProjectProperties {
21-
2232
[CmdletBinding(SupportsShouldProcess)]
2333
param (
2434
# Collection Uri of the organization

AzureDevOpsPowerShell/Public/Api/Environments/Environments/Get-AzDoEnvironment.ps1

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,35 @@ function Get-AzDoEnvironment {
44
Creates a Build Validation policy on a branch
55
.DESCRIPTION
66
Creates a Build Validation policy on a branch
7+
78
.EXAMPLE
8-
$params = @{
9+
$Params = @{
910
CollectionUri = "https://dev.azure.com/contoso"
10-
Name = "Policy 1"
11-
RepoName = "Repo 1"
12-
ProjectName = "Project 1"
13-
Id = 1
11+
ProjectName = "Project 1"
1412
}
15-
Set-AzDoBranchPolicyBuildValidation @params
13+
Get-AzDoEnvironment @Params
1614
17-
This example creates a policy with splatting parameters
15+
This example retrieves all environments in the specified project ("Project 1") in Azure DevOps.
1816
1917
.EXAMPLE
20-
$env:SYSTEM_ACCESSTOKEN = '***'
21-
New-AzDoPipeline -CollectionUri "https://dev.azure.com/contoso" -ProjectName "Project 1" -Name "Pipeline 1" -RepoName "Repo 1" -Path "main.yml"
22-
| Set-AzDoBranchPolicyBuildValidation
18+
$Params = @{
19+
CollectionUri = "https://dev.azure.com/contoso"
20+
ProjectName = "Project 1"
21+
EnvironmentName = "Environment 1"
22+
}
23+
Get-AzDoEnvironment @Params
24+
25+
This example retrieves details of the environment named "Environment 1" in the specified project ("Project 1") in Azure DevOps.
26+
27+
.EXAMPLE
28+
$Params = @{
29+
CollectionUri = "https://dev.azure.com/contoso"
30+
ProjectName = "Project 1"
31+
EnvironmentName = @("Environment 1", "Environment 2")
32+
}
33+
Get-AzDoEnvironment @Params
2334
24-
This example creates a new Azure Pipeline and sets this pipeline as Build Validation policy on the main branch
35+
This example retrieves details of multiple environments ("Environment 1" and "Environment 2") in the specified project ("Project 1") in Azure DevOps.
2536
2637
.OUTPUTS
2738
[PSCustomObject]@{

AzureDevOpsPowerShell/Public/Api/Environments/Environments/Remove-AzDoEnvironment.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,28 @@ function Remove-AzDoEnvironment {
99
.EXAMPLE
1010
Remove-AzDoEnvironment -CollectionUri "https://dev.azure.com/contoso" -ProjectName "Project 1" -EnvironmentName "Environment 1"
1111
12+
This example removes the environment named "Environment 1" from the specified project in Azure DevOps.
13+
1214
.EXAMPLE
1315
Remove-AzDoEnvironment -CollectionUri "https://dev.azure.com/contoso" -ProjectName "Project 1" -EnvironmentName "Environment 1", "Environment 2"
1416
17+
This example removes multiple environments ("Environment 1" and "Environment 2") from the specified project in Azure DevOps.
18+
1519
.EXAMPLE
1620
Remove-AzDoEnvironment -CollectionUri "https://dev.azure.com/contoso" -ProjectName "Project 1" -EnvironmentName 1
1721
22+
This example removes the environment with the ID 1 from the specified project in Azure DevOps.
23+
1824
.EXAMPLE
1925
Remove-AzDoEnvironment -CollectionUri "https://dev.azure.com/contoso" -ProjectName "Project 1" -EnvironmentName 1, 2
2026
27+
This example removes multiple environments with IDs 1 and 2 from the specified project in Azure DevOps.
28+
2129
.EXAMPLE
2230
Remove-AzDoEnvironment -CollectionUri "https://dev.azure.com/contoso" -ProjectName "Project 1" -EnvironmentName "Environment 1", 2
2331
32+
This example removes a mix of environments by name ("Environment 1") and ID (2) from the specified project in Azure DevOps.
33+
2434
.LINK
2535
https://learn.microsoft.com/en-us/rest/api/azure/devops/environments/environments/delete?view=azure-devops-rest-7.2
2636
#>

AzureDevOpsPowerShell/Public/Api/Git/PolicyConfigurations/Get-AzDoPipelineBranchControl.ps1

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<#
1+
function Get-AzDoPipelineBranchControl {
2+
<#
23
.SYNOPSIS
34
Retrieves branch policy configurations of specified Azure DevOps projects.
45
@@ -7,19 +8,40 @@ The Get-AzDoPipelineBranchControl function retrieves branch policy configuration
78
It supports pipeline input for project names and collection URI.
89
910
.EXAMPLE
10-
PS> Get-AzDoPipelineBranchControl -CollectionUri "https://dev.azure.com/organization" -ProjectName "Project1"
11+
$Params = @{
12+
CollectionUri = "https://dev.azure.com/organization"
13+
ProjectName = "Project1"
14+
}
15+
Get-AzDoPipelineBranchControl @Params
16+
17+
This example retrieves branch policy configurations for the project named "Project1" in the specified Azure DevOps organization.
1118
1219
.EXAMPLE
13-
PS> "Project1", "Project2" | Get-AzDoPipelineBranchControl -CollectionUri "https://dev.azure.com/organization"
20+
$Params = @{
21+
CollectionUri = "https://dev.azure.com/organization"
22+
}
23+
"Project1", "Project2" | Get-AzDoPipelineBranchControl @Params
24+
25+
This example retrieves branch policy configurations for multiple projects ("Project1" and "Project2") in the specified Azure DevOps organization.
26+
27+
.EXAMPLE
28+
$Params = @{
29+
CollectionUri = "https://dev.azure.com/organization"
30+
ProjectName = "Project1"
31+
RepositoryId = "12345"
32+
RefName = "refs/heads/main"
33+
PolicyType = "Build"
34+
}
35+
Get-AzDoPipelineBranchControl @Params
36+
37+
This example retrieves branch policy configurations for the "main" branch in the repository with ID "12345" in the project "Project1" in the specified Azure DevOps organization, filtered by the "Build" policy type.
1438
1539
.NOTES
1640
This function requires the Validate-CollectionUri and Invoke-AzDoRestMethod helper functions to be defined in the scope.
1741
1842
.LINK
1943
https://learn.microsoft.com/en-us/rest/api/azure/devops/git/policy-configurations/list?view=azure-devops-rest-5.0#policyconfiguration
2044
#>
21-
function Get-AzDoPipelineBranchControl {
22-
2345
[CmdletBinding(SupportsShouldProcess)]
2446
param (
2547
# Collection URI of the organization

AzureDevOpsPowerShell/Public/Api/Git/PullRequests/Get-AzDoPullRequest.ps1

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,56 @@ function Get-AzDoPullRequest {
66
.DESCRIPTION
77
This function fetches pull request details using Azure DevOps REST API.
88
9-
.PARAMETER CollectionUri
10-
The base URL of the Azure DevOps organization (e.g., https://dev.azure.com/my-org).
11-
12-
.PARAMETER ProjectName
13-
The name of the Azure DevOps project.
9+
.EXAMPLE
10+
$Params = @{
11+
CollectionUri = "https://dev.azure.com/my-org"
12+
ProjectName = "MyProject"
13+
}
14+
Get-AzDoPullRequest @Params
1415
15-
.PARAMETER RepositoryName
16-
The name of the repository (optional for project-wide pull request queries).
16+
This example retrieves all pull requests for the specified project.
1717
18-
.PARAMETER PullRequestId
19-
The ID of a specific pull request (optional for listing all pull requests).
18+
.EXAMPLE
19+
$Params = @{
20+
CollectionUri = "https://dev.azure.com/my-org"
21+
ProjectName = "MyProject"
22+
RepositoryName = "RepositoryName"
23+
}
24+
Get-AzDoPullRequest @Params
2025
21-
.PARAMETER Query
22-
A query string to filter the results (optional).
23-
Can only be used without PullRequestId:
24-
https://learn.microsoft.com/en-us/rest/api/azure/devops/git/pull-requests/get-pull-requests?view=azure-devops-rest-7.2&tabs=HTTP#uri-parameters
25-
https://learn.microsoft.com/en-us/rest/api/azure/devops/git/pull-requests/get-pull-requests-by-project?view=azure-devops-rest-7.2&tabs=HTTP#uri-parameters
26+
This example retrieves all pull requests for the specified repository in the project.
2627
2728
.EXAMPLE
28-
Get-AzDoPullRequest -CollectionUri "https://dev.azure.com/my-org" -ProjectName "MyProject"
29+
$Params = @{
30+
CollectionUri = "https://dev.azure.com/my-org"
31+
ProjectName = "MyProject"
32+
RepositoryName = "RepositoryName"
33+
Query = "searchCriteria.status=completed"
34+
}
35+
Get-AzDoPullRequest @Params
2936
30-
.EXAMPLE
31-
Get-AzDoPullRequest -CollectionUri "https://dev.azure.com/my-org" -ProjectName "MyProject" -RepositoryName "RepositoryName"
37+
This example retrieves all completed pull requests for the specified repository in the project.
3238
3339
.EXAMPLE
34-
Get-AzDoPullRequest -CollectionUri "https://dev.azure.com/my-org" -ProjectName "MyProject" -RepositoryName "RepositoryName" -Query "searchCriteria.status=completed"
40+
$Params = @{
41+
CollectionUri = "https://dev.azure.com/my-org"
42+
ProjectName = "MyProject"
43+
RepositoryName = "RepositoryName"
44+
PullRequestId = "6789"
45+
}
46+
Get-AzDoPullRequest @Params
3547
36-
.EXAMPLE
37-
Get-AzDoPullRequest -CollectionUri "https://dev.azure.com/my-org" -ProjectName "MyProject" -RepositoryName "RepositoryName" -PullRequestId "6789"
48+
This example retrieves details of a specific pull request by its ID for the specified repository in the project.
3849
3950
.EXAMPLE
40-
Get-AzDoPullRequest -CollectionUri "https://dev.azure.com/my-org" -ProjectName "MyProject" -PullRequestId "6789"
51+
$Params = @{
52+
CollectionUri = "https://dev.azure.com/my-org"
53+
ProjectName = "MyProject"
54+
PullRequestId = "6789"
55+
}
56+
Get-AzDoPullRequest @Params
57+
58+
This example retrieves details of a specific pull request by its ID for the specified project.
4159
4260
.OUTPUTS
4361
PSCustomObject with pull request details.
@@ -59,6 +77,7 @@ function Get-AzDoPullRequest {
5977
#>
6078
[CmdletBinding(DefaultParameterSetName = "AllProjectPullRequests", SupportsShouldProcess)]
6179
param (
80+
# The base URL of the Azure DevOps organization (e.g., https://dev.azure.com/my-org)
6281
[Parameter(Mandatory, ValueFromPipelineByPropertyName, ParameterSetName = "RepoSpecificPullRequest")]
6382
[Parameter(Mandatory, ValueFromPipelineByPropertyName, ParameterSetName = "ProjectSpecificPullRequest")]
6483
[Parameter(Mandatory, ValueFromPipelineByPropertyName, ParameterSetName = "AllRepoPullRequests")]
@@ -67,29 +86,32 @@ function Get-AzDoPullRequest {
6786
[string]
6887
$CollectionUri,
6988

89+
# The name of the Azure DevOps project.
7090
[Parameter(Mandatory, ValueFromPipelineByPropertyName, ParameterSetName = "RepoSpecificPullRequest")]
7191
[Parameter(Mandatory, ValueFromPipelineByPropertyName, ParameterSetName = "ProjectSpecificPullRequest")]
7292
[Parameter(Mandatory, ValueFromPipelineByPropertyName, ParameterSetName = "AllRepoPullRequests")]
7393
[Parameter(Mandatory, ValueFromPipelineByPropertyName, ParameterSetName = "AllProjectPullRequests")]
7494
[string]
7595
$ProjectName,
7696

97+
# The name of the repository (optional for project-wide pull request queries).
7798
[Parameter(Mandatory, ValueFromPipeline, ParameterSetName = "RepoSpecificPullRequest")]
7899
[Parameter(Mandatory, ValueFromPipeline, ParameterSetName = "AllRepoPullRequests")]
79100
[string]
80101
$RepoName,
81102

103+
# The ID of a specific pull request (optional for listing all pull requests).
82104
[Parameter(Mandatory, ValueFromPipeline, ParameterSetName = "RepoSpecificPullRequest")]
83105
[Parameter(Mandatory, ValueFromPipeline, ParameterSetName = "ProjectSpecificPullRequest")]
84106
[string]
85107
$PullRequestId,
86108

109+
# A query string to filter the results (optional).
87110
[Parameter(ValueFromPipelineByPropertyName, ParameterSetName = "AllRepoPullRequests")]
88111
[string]
89112
$Query
90113
)
91114

92-
93115
begin {
94116
$result = @()
95117
Write-Verbose "Starting function: Get-AzDoPullRequest"

0 commit comments

Comments
 (0)