1. Packages
  2. Azure DevOps Provider
  3. API Docs
  4. getProjects
Azure DevOps v3.8.0 published on Monday, Mar 17, 2025 by Pulumi

azuredevops.getProjects

Explore with Pulumi AI

Use this data source to access information about existing Projects within Azure DevOps.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azuredevops from "@pulumi/azuredevops";

const example = azuredevops.getProjects({
    name: "Example Project",
    state: "wellFormed",
});
export const projectId = example.then(example => example.projects.map(__item => __item.projectId));
export const name = example.then(example => example.projects.map(__item => __item.name));
export const projectUrl = example.then(example => example.projects.map(__item => __item.projectUrl));
export const state = example.then(example => example.projects.map(__item => __item.state));
Copy
import pulumi
import pulumi_azuredevops as azuredevops

example = azuredevops.get_projects(name="Example Project",
    state="wellFormed")
pulumi.export("projectId", [__item.project_id for __item in example.projects])
pulumi.export("name", [__item.name for __item in example.projects])
pulumi.export("projectUrl", [__item.project_url for __item in example.projects])
pulumi.export("state", [__item.state for __item in example.projects])
Copy
package main

import (
	"github.com/pulumi/pulumi-azuredevops/sdk/v3/go/azuredevops"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := azuredevops.GetProjects(ctx, &azuredevops.GetProjectsArgs{
Name: pulumi.StringRef("Example Project"),
State: pulumi.StringRef("wellFormed"),
}, nil);
if err != nil {
return err
}
ctx.Export("projectId", pulumi.StringArray(%!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ example.pp:6,11-40)))
ctx.Export("name", pulumi.StringArray(%!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ example.pp:10,11-35)))
ctx.Export("projectUrl", pulumi.StringArray(%!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ example.pp:14,11-41)))
ctx.Export("state", pulumi.StringArray(%!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ example.pp:18,11-36)))
return nil
})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureDevOps = Pulumi.AzureDevOps;

return await Deployment.RunAsync(() => 
{
    var example = AzureDevOps.GetProjects.Invoke(new()
    {
        Name = "Example Project",
        State = "wellFormed",
    });

    return new Dictionary<string, object?>
    {
        ["projectId"] = example.Apply(getProjectsResult => getProjectsResult.Projects).Select(__item => __item.ProjectId).ToList(),
        ["name"] = example.Apply(getProjectsResult => getProjectsResult.Projects).Select(__item => __item.Name).ToList(),
        ["projectUrl"] = example.Apply(getProjectsResult => getProjectsResult.Projects).Select(__item => __item.ProjectUrl).ToList(),
        ["state"] = example.Apply(getProjectsResult => getProjectsResult.Projects).Select(__item => __item.State).ToList(),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azuredevops.AzuredevopsFunctions;
import com.pulumi.azuredevops.inputs.GetProjectsArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var example = AzuredevopsFunctions.getProjects(GetProjectsArgs.builder()
            .name("Example Project")
            .state("wellFormed")
            .build());

        ctx.export("projectId", example.applyValue(getProjectsResult -> getProjectsResult.projects()).stream().map(element -> element.projectId()).collect(toList()));
        ctx.export("name", example.applyValue(getProjectsResult -> getProjectsResult.projects()).stream().map(element -> element.name()).collect(toList()));
        ctx.export("projectUrl", example.applyValue(getProjectsResult -> getProjectsResult.projects()).stream().map(element -> element.projectUrl()).collect(toList()));
        ctx.export("state", example.applyValue(getProjectsResult -> getProjectsResult.projects()).stream().map(element -> element.state()).collect(toList()));
    }
}
Copy
Coming soon!

Using getProjects

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getProjects(args: GetProjectsArgs, opts?: InvokeOptions): Promise<GetProjectsResult>
function getProjectsOutput(args: GetProjectsOutputArgs, opts?: InvokeOptions): Output<GetProjectsResult>
Copy
def get_projects(name: Optional[str] = None,
                 state: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetProjectsResult
def get_projects_output(name: Optional[pulumi.Input[str]] = None,
                 state: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetProjectsResult]
Copy
func GetProjects(ctx *Context, args *GetProjectsArgs, opts ...InvokeOption) (*GetProjectsResult, error)
func GetProjectsOutput(ctx *Context, args *GetProjectsOutputArgs, opts ...InvokeOption) GetProjectsResultOutput
Copy

> Note: This function is named GetProjects in the Go SDK.

public static class GetProjects 
{
    public static Task<GetProjectsResult> InvokeAsync(GetProjectsArgs args, InvokeOptions? opts = null)
    public static Output<GetProjectsResult> Invoke(GetProjectsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetProjectsResult> getProjects(GetProjectsArgs args, InvokeOptions options)
public static Output<GetProjectsResult> getProjects(GetProjectsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: azuredevops:index/getProjects:getProjects
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name Changes to this property will trigger replacement. string
Name of the Project, if not specified all projects will be returned.
State Changes to this property will trigger replacement. string

State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

NOTE: DataSource without specifying any arguments will return all projects.

Name Changes to this property will trigger replacement. string
Name of the Project, if not specified all projects will be returned.
State Changes to this property will trigger replacement. string

State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

NOTE: DataSource without specifying any arguments will return all projects.

name Changes to this property will trigger replacement. String
Name of the Project, if not specified all projects will be returned.
state Changes to this property will trigger replacement. String

State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

NOTE: DataSource without specifying any arguments will return all projects.

name Changes to this property will trigger replacement. string
Name of the Project, if not specified all projects will be returned.
state Changes to this property will trigger replacement. string

State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

NOTE: DataSource without specifying any arguments will return all projects.

name Changes to this property will trigger replacement. str
Name of the Project, if not specified all projects will be returned.
state Changes to this property will trigger replacement. str

State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

NOTE: DataSource without specifying any arguments will return all projects.

name Changes to this property will trigger replacement. String
Name of the Project, if not specified all projects will be returned.
state Changes to this property will trigger replacement. String

State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

NOTE: DataSource without specifying any arguments will return all projects.

getProjects Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
Projects List<Pulumi.AzureDevOps.Outputs.GetProjectsProject>
A list of projects blocks as documented below. A list of existing projects in your Azure DevOps Organization with details about every project which includes:
Name string
The name of the Project.
State string
The state of the Project.
Id string
The provider-assigned unique ID for this managed resource.
Projects []GetProjectsProject
A list of projects blocks as documented below. A list of existing projects in your Azure DevOps Organization with details about every project which includes:
Name string
The name of the Project.
State string
The state of the Project.
id String
The provider-assigned unique ID for this managed resource.
projects List<GetProjectsProject>
A list of projects blocks as documented below. A list of existing projects in your Azure DevOps Organization with details about every project which includes:
name String
The name of the Project.
state String
The state of the Project.
id string
The provider-assigned unique ID for this managed resource.
projects GetProjectsProject[]
A list of projects blocks as documented below. A list of existing projects in your Azure DevOps Organization with details about every project which includes:
name string
The name of the Project.
state string
The state of the Project.
id str
The provider-assigned unique ID for this managed resource.
projects Sequence[GetProjectsProject]
A list of projects blocks as documented below. A list of existing projects in your Azure DevOps Organization with details about every project which includes:
name str
The name of the Project.
state str
The state of the Project.
id String
The provider-assigned unique ID for this managed resource.
projects List<Property Map>
A list of projects blocks as documented below. A list of existing projects in your Azure DevOps Organization with details about every project which includes:
name String
The name of the Project.
state String
The state of the Project.

Supporting Types

GetProjectsProject

Name This property is required. string
Name of the Project, if not specified all projects will be returned.
ProjectId This property is required. string
The ID of the Project.
ProjectUrl This property is required. string
The Url to the full version of the object.
State This property is required. string

State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

NOTE: DataSource without specifying any arguments will return all projects.

Name This property is required. string
Name of the Project, if not specified all projects will be returned.
ProjectId This property is required. string
The ID of the Project.
ProjectUrl This property is required. string
The Url to the full version of the object.
State This property is required. string

State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

NOTE: DataSource without specifying any arguments will return all projects.

name This property is required. String
Name of the Project, if not specified all projects will be returned.
projectId This property is required. String
The ID of the Project.
projectUrl This property is required. String
The Url to the full version of the object.
state This property is required. String

State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

NOTE: DataSource without specifying any arguments will return all projects.

name This property is required. string
Name of the Project, if not specified all projects will be returned.
projectId This property is required. string
The ID of the Project.
projectUrl This property is required. string
The Url to the full version of the object.
state This property is required. string

State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

NOTE: DataSource without specifying any arguments will return all projects.

name This property is required. str
Name of the Project, if not specified all projects will be returned.
project_id This property is required. str
The ID of the Project.
project_url This property is required. str
The Url to the full version of the object.
state This property is required. str

State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

NOTE: DataSource without specifying any arguments will return all projects.

name This property is required. String
Name of the Project, if not specified all projects will be returned.
projectId This property is required. String
The ID of the Project.
projectUrl This property is required. String
The Url to the full version of the object.
state This property is required. String

State of the Project, if not specified all projects will be returned. Valid values are all, deleting, new, wellFormed, createPending, unchanged,deleted.

NOTE: DataSource without specifying any arguments will return all projects.

Package Details

Repository
Azure DevOps pulumi/pulumi-azuredevops
License
Apache-2.0
Notes
This Pulumi package is based on the azuredevops Terraform Provider.