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

azuredevops.getRepositories

Explore with Pulumi AI

Use this data source to access information about multiple existing Git Repositories within Azure DevOps. To read informations about a single Git Repository use the data source azuredevops.Git

Example Usage

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

const example = azuredevops.getProject({
    name: "Example Project",
});
// Load all Git repositories of a project, which are accessible for the current user
const example_all_repos = example.then(example => azuredevops.getRepositories({
    projectId: example.id,
    includeHidden: true,
}));
// Load a specific Git repository by name
const example_single_repo = example.then(example => azuredevops.getRepositories({
    projectId: example.id,
    name: "Example Repository",
}));
Copy
import pulumi
import pulumi_azuredevops as azuredevops

example = azuredevops.get_project(name="Example Project")
# Load all Git repositories of a project, which are accessible for the current user
example_all_repos = azuredevops.get_repositories(project_id=example.id,
    include_hidden=True)
# Load a specific Git repository by name
example_single_repo = azuredevops.get_repositories(project_id=example.id,
    name="Example Repository")
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.LookupProject(ctx, &azuredevops.LookupProjectArgs{
			Name: pulumi.StringRef("Example Project"),
		}, nil)
		if err != nil {
			return err
		}
		// Load all Git repositories of a project, which are accessible for the current user
		_, err = azuredevops.GetRepositories(ctx, &azuredevops.GetRepositoriesArgs{
			ProjectId:     pulumi.StringRef(example.Id),
			IncludeHidden: pulumi.BoolRef(true),
		}, nil)
		if err != nil {
			return err
		}
		// Load a specific Git repository by name
		_, err = azuredevops.GetRepositories(ctx, &azuredevops.GetRepositoriesArgs{
			ProjectId: pulumi.StringRef(example.Id),
			Name:      pulumi.StringRef("Example Repository"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureDevOps = Pulumi.AzureDevOps;

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

    // Load all Git repositories of a project, which are accessible for the current user
    var example_all_repos = AzureDevOps.GetRepositories.Invoke(new()
    {
        ProjectId = example.Apply(getProjectResult => getProjectResult.Id),
        IncludeHidden = true,
    });

    // Load a specific Git repository by name
    var example_single_repo = AzureDevOps.GetRepositories.Invoke(new()
    {
        ProjectId = example.Apply(getProjectResult => getProjectResult.Id),
        Name = "Example Repository",
    });

});
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.GetProjectArgs;
import com.pulumi.azuredevops.inputs.GetRepositoriesArgs;
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.getProject(GetProjectArgs.builder()
            .name("Example Project")
            .build());

        // Load all Git repositories of a project, which are accessible for the current user
        final var example-all-repos = AzuredevopsFunctions.getRepositories(GetRepositoriesArgs.builder()
            .projectId(example.applyValue(getProjectResult -> getProjectResult.id()))
            .includeHidden(true)
            .build());

        // Load a specific Git repository by name
        final var example-single-repo = AzuredevopsFunctions.getRepositories(GetRepositoriesArgs.builder()
            .projectId(example.applyValue(getProjectResult -> getProjectResult.id()))
            .name("Example Repository")
            .build());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: azuredevops:getProject
      arguments:
        name: Example Project
  # Load all Git repositories of a project, which are accessible for the current user
  example-all-repos:
    fn::invoke:
      function: azuredevops:getRepositories
      arguments:
        projectId: ${example.id}
        includeHidden: true
  # Load a specific Git repository by name
  example-single-repo:
    fn::invoke:
      function: azuredevops:getRepositories
      arguments:
        projectId: ${example.id}
        name: Example Repository
Copy

Using getRepositories

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 getRepositories(args: GetRepositoriesArgs, opts?: InvokeOptions): Promise<GetRepositoriesResult>
function getRepositoriesOutput(args: GetRepositoriesOutputArgs, opts?: InvokeOptions): Output<GetRepositoriesResult>
Copy
def get_repositories(include_hidden: Optional[bool] = None,
                     name: Optional[str] = None,
                     project_id: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetRepositoriesResult
def get_repositories_output(include_hidden: Optional[pulumi.Input[bool]] = None,
                     name: Optional[pulumi.Input[str]] = None,
                     project_id: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetRepositoriesResult]
Copy
func GetRepositories(ctx *Context, args *GetRepositoriesArgs, opts ...InvokeOption) (*GetRepositoriesResult, error)
func GetRepositoriesOutput(ctx *Context, args *GetRepositoriesOutputArgs, opts ...InvokeOption) GetRepositoriesResultOutput
Copy

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

public static class GetRepositories 
{
    public static Task<GetRepositoriesResult> InvokeAsync(GetRepositoriesArgs args, InvokeOptions? opts = null)
    public static Output<GetRepositoriesResult> Invoke(GetRepositoriesInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetRepositoriesResult> getRepositories(GetRepositoriesArgs args, InvokeOptions options)
public static Output<GetRepositoriesResult> getRepositories(GetRepositoriesArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: azuredevops:index/getRepositories:getRepositories
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

IncludeHidden bool

Defaults to false.

DataSource without specifying any arguments will return all Git repositories of an organization.

Name string
Name of the Git repository to retrieve; requires project_id to be specified as well
ProjectId string
ID of project to list Git repositories
IncludeHidden bool

Defaults to false.

DataSource without specifying any arguments will return all Git repositories of an organization.

Name string
Name of the Git repository to retrieve; requires project_id to be specified as well
ProjectId string
ID of project to list Git repositories
includeHidden Boolean

Defaults to false.

DataSource without specifying any arguments will return all Git repositories of an organization.

name String
Name of the Git repository to retrieve; requires project_id to be specified as well
projectId String
ID of project to list Git repositories
includeHidden boolean

Defaults to false.

DataSource without specifying any arguments will return all Git repositories of an organization.

name string
Name of the Git repository to retrieve; requires project_id to be specified as well
projectId string
ID of project to list Git repositories
include_hidden bool

Defaults to false.

DataSource without specifying any arguments will return all Git repositories of an organization.

name str
Name of the Git repository to retrieve; requires project_id to be specified as well
project_id str
ID of project to list Git repositories
includeHidden Boolean

Defaults to false.

DataSource without specifying any arguments will return all Git repositories of an organization.

name String
Name of the Git repository to retrieve; requires project_id to be specified as well
projectId String
ID of project to list Git repositories

getRepositories Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
Repositories List<Pulumi.AzureDevOps.Outputs.GetRepositoriesRepository>
A repositories blocks as documented below. A list of existing projects in your Azure DevOps Organization with details about every project.
IncludeHidden bool
Name string
Git repository name.
ProjectId string
Project identifier to which the Git repository belongs.
Id string
The provider-assigned unique ID for this managed resource.
Repositories []GetRepositoriesRepository
A repositories blocks as documented below. A list of existing projects in your Azure DevOps Organization with details about every project.
IncludeHidden bool
Name string
Git repository name.
ProjectId string
Project identifier to which the Git repository belongs.
id String
The provider-assigned unique ID for this managed resource.
repositories List<GetRepositoriesRepository>
A repositories blocks as documented below. A list of existing projects in your Azure DevOps Organization with details about every project.
includeHidden Boolean
name String
Git repository name.
projectId String
Project identifier to which the Git repository belongs.
id string
The provider-assigned unique ID for this managed resource.
repositories GetRepositoriesRepository[]
A repositories blocks as documented below. A list of existing projects in your Azure DevOps Organization with details about every project.
includeHidden boolean
name string
Git repository name.
projectId string
Project identifier to which the Git repository belongs.
id str
The provider-assigned unique ID for this managed resource.
repositories Sequence[GetRepositoriesRepository]
A repositories blocks as documented below. A list of existing projects in your Azure DevOps Organization with details about every project.
include_hidden bool
name str
Git repository name.
project_id str
Project identifier to which the Git repository belongs.
id String
The provider-assigned unique ID for this managed resource.
repositories List<Property Map>
A repositories blocks as documented below. A list of existing projects in your Azure DevOps Organization with details about every project.
includeHidden Boolean
name String
Git repository name.
projectId String
Project identifier to which the Git repository belongs.

Supporting Types

GetRepositoriesRepository

DefaultBranch This property is required. string
The ref of the default branch.
Disabled This property is required. bool
Is the repository disabled?
Id This property is required. string
Git repository identifier.
Name This property is required. string
Name of the Git repository to retrieve; requires project_id to be specified as well
ProjectId This property is required. string
ID of project to list Git repositories
RemoteUrl This property is required. string
HTTPS Url to clone the Git repository
Size This property is required. int
Compressed size (bytes) of the repository.
SshUrl This property is required. string
SSH Url to clone the Git repository
Url This property is required. string
Details REST API endpoint for the Git Repository.
WebUrl This property is required. string
Url of the Git repository web view
DefaultBranch This property is required. string
The ref of the default branch.
Disabled This property is required. bool
Is the repository disabled?
Id This property is required. string
Git repository identifier.
Name This property is required. string
Name of the Git repository to retrieve; requires project_id to be specified as well
ProjectId This property is required. string
ID of project to list Git repositories
RemoteUrl This property is required. string
HTTPS Url to clone the Git repository
Size This property is required. int
Compressed size (bytes) of the repository.
SshUrl This property is required. string
SSH Url to clone the Git repository
Url This property is required. string
Details REST API endpoint for the Git Repository.
WebUrl This property is required. string
Url of the Git repository web view
defaultBranch This property is required. String
The ref of the default branch.
disabled This property is required. Boolean
Is the repository disabled?
id This property is required. String
Git repository identifier.
name This property is required. String
Name of the Git repository to retrieve; requires project_id to be specified as well
projectId This property is required. String
ID of project to list Git repositories
remoteUrl This property is required. String
HTTPS Url to clone the Git repository
size This property is required. Integer
Compressed size (bytes) of the repository.
sshUrl This property is required. String
SSH Url to clone the Git repository
url This property is required. String
Details REST API endpoint for the Git Repository.
webUrl This property is required. String
Url of the Git repository web view
defaultBranch This property is required. string
The ref of the default branch.
disabled This property is required. boolean
Is the repository disabled?
id This property is required. string
Git repository identifier.
name This property is required. string
Name of the Git repository to retrieve; requires project_id to be specified as well
projectId This property is required. string
ID of project to list Git repositories
remoteUrl This property is required. string
HTTPS Url to clone the Git repository
size This property is required. number
Compressed size (bytes) of the repository.
sshUrl This property is required. string
SSH Url to clone the Git repository
url This property is required. string
Details REST API endpoint for the Git Repository.
webUrl This property is required. string
Url of the Git repository web view
default_branch This property is required. str
The ref of the default branch.
disabled This property is required. bool
Is the repository disabled?
id This property is required. str
Git repository identifier.
name This property is required. str
Name of the Git repository to retrieve; requires project_id to be specified as well
project_id This property is required. str
ID of project to list Git repositories
remote_url This property is required. str
HTTPS Url to clone the Git repository
size This property is required. int
Compressed size (bytes) of the repository.
ssh_url This property is required. str
SSH Url to clone the Git repository
url This property is required. str
Details REST API endpoint for the Git Repository.
web_url This property is required. str
Url of the Git repository web view
defaultBranch This property is required. String
The ref of the default branch.
disabled This property is required. Boolean
Is the repository disabled?
id This property is required. String
Git repository identifier.
name This property is required. String
Name of the Git repository to retrieve; requires project_id to be specified as well
projectId This property is required. String
ID of project to list Git repositories
remoteUrl This property is required. String
HTTPS Url to clone the Git repository
size This property is required. Number
Compressed size (bytes) of the repository.
sshUrl This property is required. String
SSH Url to clone the Git repository
url This property is required. String
Details REST API endpoint for the Git Repository.
webUrl This property is required. String
Url of the Git repository web view

Package Details

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