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

azuredevops.Environment

Explore with Pulumi AI

Manages an Environment.

Example Usage

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

const example = new azuredevops.Project("example", {
    name: "Example Project",
    workItemTemplate: "Agile",
    versionControl: "Git",
    visibility: "private",
    description: "Managed by Pulumi",
});
const exampleEnvironment = new azuredevops.Environment("example", {
    projectId: example.id,
    name: "Example Environment",
});
Copy
import pulumi
import pulumi_azuredevops as azuredevops

example = azuredevops.Project("example",
    name="Example Project",
    work_item_template="Agile",
    version_control="Git",
    visibility="private",
    description="Managed by Pulumi")
example_environment = azuredevops.Environment("example",
    project_id=example.id,
    name="Example Environment")
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.NewProject(ctx, "example", &azuredevops.ProjectArgs{
			Name:             pulumi.String("Example Project"),
			WorkItemTemplate: pulumi.String("Agile"),
			VersionControl:   pulumi.String("Git"),
			Visibility:       pulumi.String("private"),
			Description:      pulumi.String("Managed by Pulumi"),
		})
		if err != nil {
			return err
		}
		_, err = azuredevops.NewEnvironment(ctx, "example", &azuredevops.EnvironmentArgs{
			ProjectId: example.ID(),
			Name:      pulumi.String("Example Environment"),
		})
		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 = new AzureDevOps.Project("example", new()
    {
        Name = "Example Project",
        WorkItemTemplate = "Agile",
        VersionControl = "Git",
        Visibility = "private",
        Description = "Managed by Pulumi",
    });

    var exampleEnvironment = new AzureDevOps.Environment("example", new()
    {
        ProjectId = example.Id,
        Name = "Example Environment",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azuredevops.Project;
import com.pulumi.azuredevops.ProjectArgs;
import com.pulumi.azuredevops.Environment;
import com.pulumi.azuredevops.EnvironmentArgs;
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) {
        var example = new Project("example", ProjectArgs.builder()
            .name("Example Project")
            .workItemTemplate("Agile")
            .versionControl("Git")
            .visibility("private")
            .description("Managed by Pulumi")
            .build());

        var exampleEnvironment = new Environment("exampleEnvironment", EnvironmentArgs.builder()
            .projectId(example.id())
            .name("Example Environment")
            .build());

    }
}
Copy
resources:
  example:
    type: azuredevops:Project
    properties:
      name: Example Project
      workItemTemplate: Agile
      versionControl: Git
      visibility: private
      description: Managed by Pulumi
  exampleEnvironment:
    type: azuredevops:Environment
    name: example
    properties:
      projectId: ${example.id}
      name: Example Environment
Copy

Create Environment Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Environment(name: string, args: EnvironmentArgs, opts?: CustomResourceOptions);
@overload
def Environment(resource_name: str,
                args: EnvironmentArgs,
                opts: Optional[ResourceOptions] = None)

@overload
def Environment(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                project_id: Optional[str] = None,
                description: Optional[str] = None,
                name: Optional[str] = None)
func NewEnvironment(ctx *Context, name string, args EnvironmentArgs, opts ...ResourceOption) (*Environment, error)
public Environment(string name, EnvironmentArgs args, CustomResourceOptions? opts = null)
public Environment(String name, EnvironmentArgs args)
public Environment(String name, EnvironmentArgs args, CustomResourceOptions options)
type: azuredevops:Environment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. EnvironmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. EnvironmentArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. EnvironmentArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. EnvironmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. EnvironmentArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var environmentResource = new AzureDevOps.Environment("environmentResource", new()
{
    ProjectId = "string",
    Description = "string",
    Name = "string",
});
Copy
example, err := azuredevops.NewEnvironment(ctx, "environmentResource", &azuredevops.EnvironmentArgs{
	ProjectId:   pulumi.String("string"),
	Description: pulumi.String("string"),
	Name:        pulumi.String("string"),
})
Copy
var environmentResource = new Environment("environmentResource", EnvironmentArgs.builder()
    .projectId("string")
    .description("string")
    .name("string")
    .build());
Copy
environment_resource = azuredevops.Environment("environmentResource",
    project_id="string",
    description="string",
    name="string")
Copy
const environmentResource = new azuredevops.Environment("environmentResource", {
    projectId: "string",
    description: "string",
    name: "string",
});
Copy
type: azuredevops:Environment
properties:
    description: string
    name: string
    projectId: string
Copy

Environment Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Environment resource accepts the following input properties:

ProjectId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the project. Changing this forces a new Environment to be created.
Description string
A description for the Environment.
Name string
The name which should be used for this Environment.
ProjectId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the project. Changing this forces a new Environment to be created.
Description string
A description for the Environment.
Name string
The name which should be used for this Environment.
projectId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the project. Changing this forces a new Environment to be created.
description String
A description for the Environment.
name String
The name which should be used for this Environment.
projectId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the project. Changing this forces a new Environment to be created.
description string
A description for the Environment.
name string
The name which should be used for this Environment.
project_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the project. Changing this forces a new Environment to be created.
description str
A description for the Environment.
name str
The name which should be used for this Environment.
projectId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the project. Changing this forces a new Environment to be created.
description String
A description for the Environment.
name String
The name which should be used for this Environment.

Outputs

All input properties are implicitly available as output properties. Additionally, the Environment resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing Environment Resource

Get an existing Environment resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: EnvironmentState, opts?: CustomResourceOptions): Environment
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        description: Optional[str] = None,
        name: Optional[str] = None,
        project_id: Optional[str] = None) -> Environment
func GetEnvironment(ctx *Context, name string, id IDInput, state *EnvironmentState, opts ...ResourceOption) (*Environment, error)
public static Environment Get(string name, Input<string> id, EnvironmentState? state, CustomResourceOptions? opts = null)
public static Environment get(String name, Output<String> id, EnvironmentState state, CustomResourceOptions options)
resources:  _:    type: azuredevops:Environment    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Description string
A description for the Environment.
Name string
The name which should be used for this Environment.
ProjectId Changes to this property will trigger replacement. string
The ID of the project. Changing this forces a new Environment to be created.
Description string
A description for the Environment.
Name string
The name which should be used for this Environment.
ProjectId Changes to this property will trigger replacement. string
The ID of the project. Changing this forces a new Environment to be created.
description String
A description for the Environment.
name String
The name which should be used for this Environment.
projectId Changes to this property will trigger replacement. String
The ID of the project. Changing this forces a new Environment to be created.
description string
A description for the Environment.
name string
The name which should be used for this Environment.
projectId Changes to this property will trigger replacement. string
The ID of the project. Changing this forces a new Environment to be created.
description str
A description for the Environment.
name str
The name which should be used for this Environment.
project_id Changes to this property will trigger replacement. str
The ID of the project. Changing this forces a new Environment to be created.
description String
A description for the Environment.
name String
The name which should be used for this Environment.
projectId Changes to this property will trigger replacement. String
The ID of the project. Changing this forces a new Environment to be created.

Import

Azure DevOps Environments can be imported using the project ID and environment ID, e.g.:

$ pulumi import azuredevops:index/environment:Environment example 00000000-0000-0000-0000-000000000000/0
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

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