azuredevops.BuildDefinitionPermissions
Explore with Pulumi AI
Manages permissions for a Build Definition
Note Permissions can be assigned to group principals and not to single user principals.
Relevant Links
PAT Permissions Required
- Project & Team: vso.security_manage - Grants the ability to read, write, and manage security permissions.
Example Usage
using System.Collections.Generic;
using Pulumi;
using AzureDevOps = Pulumi.AzureDevOps;
return await Deployment.RunAsync(() =>
{
var exampleProject = new AzureDevOps.Project("exampleProject", new()
{
WorkItemTemplate = "Agile",
VersionControl = "Git",
Visibility = "private",
Description = "Managed by Terraform",
});
var example_readers = AzureDevOps.GetGroup.Invoke(new()
{
ProjectId = exampleProject.Id,
Name = "Readers",
});
var exampleGit = new AzureDevOps.Git("exampleGit", new()
{
ProjectId = exampleProject.Id,
Initialization = new AzureDevOps.Inputs.GitInitializationArgs
{
InitType = "Clean",
},
});
var exampleBuildDefinition = new AzureDevOps.BuildDefinition("exampleBuildDefinition", new()
{
ProjectId = exampleProject.Id,
Path = "\\ExampleFolder",
CiTrigger = new AzureDevOps.Inputs.BuildDefinitionCiTriggerArgs
{
UseYaml = true,
},
Repository = new AzureDevOps.Inputs.BuildDefinitionRepositoryArgs
{
RepoType = "TfsGit",
RepoId = exampleGit.Id,
BranchName = exampleGit.DefaultBranch,
YmlPath = "azure-pipelines.yml",
},
});
var exampleBuildDefinitionPermissions = new AzureDevOps.BuildDefinitionPermissions("exampleBuildDefinitionPermissions", new()
{
ProjectId = exampleProject.Id,
Principal = example_readers.Apply(example_readers => example_readers.Apply(getGroupResult => getGroupResult.Id)),
BuildDefinitionId = exampleBuildDefinition.Id,
Permissions =
{
{ "ViewBuilds", "Allow" },
{ "EditBuildQuality", "Deny" },
{ "DeleteBuilds", "Deny" },
{ "StopBuilds", "Allow" },
},
});
});
package main
import (
"github.com/pulumi/pulumi-azuredevops/sdk/v2/go/azuredevops"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleProject, err := azuredevops.NewProject(ctx, "exampleProject", &azuredevops.ProjectArgs{
WorkItemTemplate: pulumi.String("Agile"),
VersionControl: pulumi.String("Git"),
Visibility: pulumi.String("private"),
Description: pulumi.String("Managed by Terraform"),
})
if err != nil {
return err
}
example_readers := azuredevops.LookupGroupOutput(ctx, azuredevops.GetGroupOutputArgs{
ProjectId: exampleProject.ID(),
Name: pulumi.String("Readers"),
}, nil)
exampleGit, err := azuredevops.NewGit(ctx, "exampleGit", &azuredevops.GitArgs{
ProjectId: exampleProject.ID(),
Initialization: &azuredevops.GitInitializationArgs{
InitType: pulumi.String("Clean"),
},
})
if err != nil {
return err
}
exampleBuildDefinition, err := azuredevops.NewBuildDefinition(ctx, "exampleBuildDefinition", &azuredevops.BuildDefinitionArgs{
ProjectId: exampleProject.ID(),
Path: pulumi.String("\\ExampleFolder"),
CiTrigger: &azuredevops.BuildDefinitionCiTriggerArgs{
UseYaml: pulumi.Bool(true),
},
Repository: &azuredevops.BuildDefinitionRepositoryArgs{
RepoType: pulumi.String("TfsGit"),
RepoId: exampleGit.ID(),
BranchName: exampleGit.DefaultBranch,
YmlPath: pulumi.String("azure-pipelines.yml"),
},
})
if err != nil {
return err
}
_, err = azuredevops.NewBuildDefinitionPermissions(ctx, "exampleBuildDefinitionPermissions", &azuredevops.BuildDefinitionPermissionsArgs{
ProjectId: exampleProject.ID(),
Principal: example_readers.ApplyT(func(example_readers azuredevops.GetGroupResult) (*string, error) {
return &example_readers.Id, nil
}).(pulumi.StringPtrOutput),
BuildDefinitionId: exampleBuildDefinition.ID(),
Permissions: pulumi.StringMap{
"ViewBuilds": pulumi.String("Allow"),
"EditBuildQuality": pulumi.String("Deny"),
"DeleteBuilds": pulumi.String("Deny"),
"StopBuilds": pulumi.String("Allow"),
},
})
if err != nil {
return err
}
return nil
})
}
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.AzuredevopsFunctions;
import com.pulumi.azuredevops.inputs.GetGroupArgs;
import com.pulumi.azuredevops.Git;
import com.pulumi.azuredevops.GitArgs;
import com.pulumi.azuredevops.inputs.GitInitializationArgs;
import com.pulumi.azuredevops.BuildDefinition;
import com.pulumi.azuredevops.BuildDefinitionArgs;
import com.pulumi.azuredevops.inputs.BuildDefinitionCiTriggerArgs;
import com.pulumi.azuredevops.inputs.BuildDefinitionRepositoryArgs;
import com.pulumi.azuredevops.BuildDefinitionPermissions;
import com.pulumi.azuredevops.BuildDefinitionPermissionsArgs;
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 exampleProject = new Project("exampleProject", ProjectArgs.builder()
.workItemTemplate("Agile")
.versionControl("Git")
.visibility("private")
.description("Managed by Terraform")
.build());
final var example-readers = AzuredevopsFunctions.getGroup(GetGroupArgs.builder()
.projectId(exampleProject.id())
.name("Readers")
.build());
var exampleGit = new Git("exampleGit", GitArgs.builder()
.projectId(exampleProject.id())
.initialization(GitInitializationArgs.builder()
.initType("Clean")
.build())
.build());
var exampleBuildDefinition = new BuildDefinition("exampleBuildDefinition", BuildDefinitionArgs.builder()
.projectId(exampleProject.id())
.path("\\ExampleFolder")
.ciTrigger(BuildDefinitionCiTriggerArgs.builder()
.useYaml(true)
.build())
.repository(BuildDefinitionRepositoryArgs.builder()
.repoType("TfsGit")
.repoId(exampleGit.id())
.branchName(exampleGit.defaultBranch())
.ymlPath("azure-pipelines.yml")
.build())
.build());
var exampleBuildDefinitionPermissions = new BuildDefinitionPermissions("exampleBuildDefinitionPermissions", BuildDefinitionPermissionsArgs.builder()
.projectId(exampleProject.id())
.principal(example_readers.applyValue(example_readers -> example_readers.id()))
.buildDefinitionId(exampleBuildDefinition.id())
.permissions(Map.ofEntries(
Map.entry("ViewBuilds", "Allow"),
Map.entry("EditBuildQuality", "Deny"),
Map.entry("DeleteBuilds", "Deny"),
Map.entry("StopBuilds", "Allow")
))
.build());
}
}
import pulumi
import pulumi_azuredevops as azuredevops
example_project = azuredevops.Project("exampleProject",
work_item_template="Agile",
version_control="Git",
visibility="private",
description="Managed by Terraform")
example_readers = azuredevops.get_group_output(project_id=example_project.id,
name="Readers")
example_git = azuredevops.Git("exampleGit",
project_id=example_project.id,
initialization=azuredevops.GitInitializationArgs(
init_type="Clean",
))
example_build_definition = azuredevops.BuildDefinition("exampleBuildDefinition",
project_id=example_project.id,
path="\\ExampleFolder",
ci_trigger=azuredevops.BuildDefinitionCiTriggerArgs(
use_yaml=True,
),
repository=azuredevops.BuildDefinitionRepositoryArgs(
repo_type="TfsGit",
repo_id=example_git.id,
branch_name=example_git.default_branch,
yml_path="azure-pipelines.yml",
))
example_build_definition_permissions = azuredevops.BuildDefinitionPermissions("exampleBuildDefinitionPermissions",
project_id=example_project.id,
principal=example_readers.id,
build_definition_id=example_build_definition.id,
permissions={
"ViewBuilds": "Allow",
"EditBuildQuality": "Deny",
"DeleteBuilds": "Deny",
"StopBuilds": "Allow",
})
import * as pulumi from "@pulumi/pulumi";
import * as azuredevops from "@pulumi/azuredevops";
const exampleProject = new azuredevops.Project("exampleProject", {
workItemTemplate: "Agile",
versionControl: "Git",
visibility: "private",
description: "Managed by Terraform",
});
const example-readers = azuredevops.getGroupOutput({
projectId: exampleProject.id,
name: "Readers",
});
const exampleGit = new azuredevops.Git("exampleGit", {
projectId: exampleProject.id,
initialization: {
initType: "Clean",
},
});
const exampleBuildDefinition = new azuredevops.BuildDefinition("exampleBuildDefinition", {
projectId: exampleProject.id,
path: "\\ExampleFolder",
ciTrigger: {
useYaml: true,
},
repository: {
repoType: "TfsGit",
repoId: exampleGit.id,
branchName: exampleGit.defaultBranch,
ymlPath: "azure-pipelines.yml",
},
});
const exampleBuildDefinitionPermissions = new azuredevops.BuildDefinitionPermissions("exampleBuildDefinitionPermissions", {
projectId: exampleProject.id,
principal: example_readers.apply(example_readers => example_readers.id),
buildDefinitionId: exampleBuildDefinition.id,
permissions: {
ViewBuilds: "Allow",
EditBuildQuality: "Deny",
DeleteBuilds: "Deny",
StopBuilds: "Allow",
},
});
resources:
exampleProject:
type: azuredevops:Project
properties:
workItemTemplate: Agile
versionControl: Git
visibility: private
description: Managed by Terraform
exampleGit:
type: azuredevops:Git
properties:
projectId: ${exampleProject.id}
initialization:
initType: Clean
exampleBuildDefinition:
type: azuredevops:BuildDefinition
properties:
projectId: ${exampleProject.id}
path: \ExampleFolder
ciTrigger:
useYaml: true
repository:
repoType: TfsGit
repoId: ${exampleGit.id}
branchName: ${exampleGit.defaultBranch}
ymlPath: azure-pipelines.yml
exampleBuildDefinitionPermissions:
type: azuredevops:BuildDefinitionPermissions
properties:
projectId: ${exampleProject.id}
principal: ${["example-readers"].id}
buildDefinitionId: ${exampleBuildDefinition.id}
permissions:
ViewBuilds: Allow
EditBuildQuality: Deny
DeleteBuilds: Deny
StopBuilds: Allow
variables:
example-readers:
fn::invoke:
Function: azuredevops:getGroup
Arguments:
projectId: ${exampleProject.id}
name: Readers
Create BuildDefinitionPermissions Resource
new BuildDefinitionPermissions(name: string, args: BuildDefinitionPermissionsArgs, opts?: CustomResourceOptions);
@overload
def BuildDefinitionPermissions(resource_name: str,
opts: Optional[ResourceOptions] = None,
build_definition_id: Optional[str] = None,
permissions: Optional[Mapping[str, str]] = None,
principal: Optional[str] = None,
project_id: Optional[str] = None,
replace: Optional[bool] = None)
@overload
def BuildDefinitionPermissions(resource_name: str,
args: BuildDefinitionPermissionsArgs,
opts: Optional[ResourceOptions] = None)
func NewBuildDefinitionPermissions(ctx *Context, name string, args BuildDefinitionPermissionsArgs, opts ...ResourceOption) (*BuildDefinitionPermissions, error)
public BuildDefinitionPermissions(string name, BuildDefinitionPermissionsArgs args, CustomResourceOptions? opts = null)
public BuildDefinitionPermissions(String name, BuildDefinitionPermissionsArgs args)
public BuildDefinitionPermissions(String name, BuildDefinitionPermissionsArgs args, CustomResourceOptions options)
type: azuredevops:BuildDefinitionPermissions
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args BuildDefinitionPermissionsArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args BuildDefinitionPermissionsArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args BuildDefinitionPermissionsArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args BuildDefinitionPermissionsArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args BuildDefinitionPermissionsArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
BuildDefinitionPermissions Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The BuildDefinitionPermissions resource accepts the following input properties:
- Build
Definition stringId The id of the build definition to assign the permissions.
- Permissions Dictionary<string, string>
the permissions to assign. The following permissions are available.
- Principal string
The group principal to assign the permissions.
- Project
Id string The ID of the project to assign the permissions.
- Replace bool
Replace (
true
) or merge (false
) the permissions. Default:true
.
- Build
Definition stringId The id of the build definition to assign the permissions.
- Permissions map[string]string
the permissions to assign. The following permissions are available.
- Principal string
The group principal to assign the permissions.
- Project
Id string The ID of the project to assign the permissions.
- Replace bool
Replace (
true
) or merge (false
) the permissions. Default:true
.
- build
Definition StringId The id of the build definition to assign the permissions.
- permissions Map<String,String>
the permissions to assign. The following permissions are available.
- principal String
The group principal to assign the permissions.
- project
Id String The ID of the project to assign the permissions.
- replace Boolean
Replace (
true
) or merge (false
) the permissions. Default:true
.
- build
Definition stringId The id of the build definition to assign the permissions.
- permissions {[key: string]: string}
the permissions to assign. The following permissions are available.
- principal string
The group principal to assign the permissions.
- project
Id string The ID of the project to assign the permissions.
- replace boolean
Replace (
true
) or merge (false
) the permissions. Default:true
.
- build_
definition_ strid The id of the build definition to assign the permissions.
- permissions Mapping[str, str]
the permissions to assign. The following permissions are available.
- principal str
The group principal to assign the permissions.
- project_
id str The ID of the project to assign the permissions.
- replace bool
Replace (
true
) or merge (false
) the permissions. Default:true
.
- build
Definition StringId The id of the build definition to assign the permissions.
- permissions Map<String>
the permissions to assign. The following permissions are available.
- principal String
The group principal to assign the permissions.
- project
Id String The ID of the project to assign the permissions.
- replace Boolean
Replace (
true
) or merge (false
) the permissions. Default:true
.
Outputs
All input properties are implicitly available as output properties. Additionally, the BuildDefinitionPermissions 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 BuildDefinitionPermissions Resource
Get an existing BuildDefinitionPermissions 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?: BuildDefinitionPermissionsState, opts?: CustomResourceOptions): BuildDefinitionPermissions
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
build_definition_id: Optional[str] = None,
permissions: Optional[Mapping[str, str]] = None,
principal: Optional[str] = None,
project_id: Optional[str] = None,
replace: Optional[bool] = None) -> BuildDefinitionPermissions
func GetBuildDefinitionPermissions(ctx *Context, name string, id IDInput, state *BuildDefinitionPermissionsState, opts ...ResourceOption) (*BuildDefinitionPermissions, error)
public static BuildDefinitionPermissions Get(string name, Input<string> id, BuildDefinitionPermissionsState? state, CustomResourceOptions? opts = null)
public static BuildDefinitionPermissions get(String name, Output<String> id, BuildDefinitionPermissionsState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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.
- Build
Definition stringId The id of the build definition to assign the permissions.
- Permissions Dictionary<string, string>
the permissions to assign. The following permissions are available.
- Principal string
The group principal to assign the permissions.
- Project
Id string The ID of the project to assign the permissions.
- Replace bool
Replace (
true
) or merge (false
) the permissions. Default:true
.
- Build
Definition stringId The id of the build definition to assign the permissions.
- Permissions map[string]string
the permissions to assign. The following permissions are available.
- Principal string
The group principal to assign the permissions.
- Project
Id string The ID of the project to assign the permissions.
- Replace bool
Replace (
true
) or merge (false
) the permissions. Default:true
.
- build
Definition StringId The id of the build definition to assign the permissions.
- permissions Map<String,String>
the permissions to assign. The following permissions are available.
- principal String
The group principal to assign the permissions.
- project
Id String The ID of the project to assign the permissions.
- replace Boolean
Replace (
true
) or merge (false
) the permissions. Default:true
.
- build
Definition stringId The id of the build definition to assign the permissions.
- permissions {[key: string]: string}
the permissions to assign. The following permissions are available.
- principal string
The group principal to assign the permissions.
- project
Id string The ID of the project to assign the permissions.
- replace boolean
Replace (
true
) or merge (false
) the permissions. Default:true
.
- build_
definition_ strid The id of the build definition to assign the permissions.
- permissions Mapping[str, str]
the permissions to assign. The following permissions are available.
- principal str
The group principal to assign the permissions.
- project_
id str The ID of the project to assign the permissions.
- replace bool
Replace (
true
) or merge (false
) the permissions. Default:true
.
- build
Definition StringId The id of the build definition to assign the permissions.
- permissions Map<String>
the permissions to assign. The following permissions are available.
- principal String
The group principal to assign the permissions.
- project
Id String The ID of the project to assign the permissions.
- replace Boolean
Replace (
true
) or merge (false
) the permissions. Default:true
.
Import
The resource does not support import.
Package Details
- Repository
- Azure DevOps pulumi/pulumi-azuredevops
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
azuredevops
Terraform Provider.