1. Packages
  2. Azuredevops Provider
  3. API Docs
  4. GroupMembership
Azure DevOps v3.4.0 published on Wednesday, Oct 30, 2024 by Pulumi

azuredevops.GroupMembership

Explore with Pulumi AI

azuredevops logo
Azure DevOps v3.4.0 published on Wednesday, Oct 30, 2024 by Pulumi

    Manages group membership within Azure DevOps.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azuredevops from "@pulumi/azuredevops";
    
    const exampleProject = new azuredevops.Project("example", {name: "Example Project"});
    const exampleUser = new azuredevops.User("example", {principalName: "foo@contoso.com"});
    const example = azuredevops.getGroupOutput({
        projectId: exampleProject.id,
        name: "Build Administrators",
    });
    const exampleGroupMembership = new azuredevops.GroupMembership("example", {
        group: example.apply(example => example.descriptor),
        members: [exampleUser.descriptor],
    });
    
    import pulumi
    import pulumi_azuredevops as azuredevops
    
    example_project = azuredevops.Project("example", name="Example Project")
    example_user = azuredevops.User("example", principal_name="foo@contoso.com")
    example = azuredevops.get_group_output(project_id=example_project.id,
        name="Build Administrators")
    example_group_membership = azuredevops.GroupMembership("example",
        group=example.descriptor,
        members=[example_user.descriptor])
    
    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 {
    		exampleProject, err := azuredevops.NewProject(ctx, "example", &azuredevops.ProjectArgs{
    			Name: pulumi.String("Example Project"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleUser, err := azuredevops.NewUser(ctx, "example", &azuredevops.UserArgs{
    			PrincipalName: pulumi.String("foo@contoso.com"),
    		})
    		if err != nil {
    			return err
    		}
    		example := azuredevops.LookupGroupOutput(ctx, azuredevops.GetGroupOutputArgs{
    			ProjectId: exampleProject.ID(),
    			Name:      pulumi.String("Build Administrators"),
    		}, nil)
    		_, err = azuredevops.NewGroupMembership(ctx, "example", &azuredevops.GroupMembershipArgs{
    			Group: pulumi.String(example.ApplyT(func(example azuredevops.GetGroupResult) (*string, error) {
    				return &example.Descriptor, nil
    			}).(pulumi.StringPtrOutput)),
    			Members: pulumi.StringArray{
    				exampleUser.Descriptor,
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AzureDevOps = Pulumi.AzureDevOps;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleProject = new AzureDevOps.Project("example", new()
        {
            Name = "Example Project",
        });
    
        var exampleUser = new AzureDevOps.User("example", new()
        {
            PrincipalName = "foo@contoso.com",
        });
    
        var example = AzureDevOps.GetGroup.Invoke(new()
        {
            ProjectId = exampleProject.Id,
            Name = "Build Administrators",
        });
    
        var exampleGroupMembership = new AzureDevOps.GroupMembership("example", new()
        {
            Group = example.Apply(getGroupResult => getGroupResult.Descriptor),
            Members = new[]
            {
                exampleUser.Descriptor,
            },
        });
    
    });
    
    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.User;
    import com.pulumi.azuredevops.UserArgs;
    import com.pulumi.azuredevops.AzuredevopsFunctions;
    import com.pulumi.azuredevops.inputs.GetGroupArgs;
    import com.pulumi.azuredevops.GroupMembership;
    import com.pulumi.azuredevops.GroupMembershipArgs;
    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()
                .name("Example Project")
                .build());
    
            var exampleUser = new User("exampleUser", UserArgs.builder()
                .principalName("foo@contoso.com")
                .build());
    
            final var example = AzuredevopsFunctions.getGroup(GetGroupArgs.builder()
                .projectId(exampleProject.id())
                .name("Build Administrators")
                .build());
    
            var exampleGroupMembership = new GroupMembership("exampleGroupMembership", GroupMembershipArgs.builder()
                .group(example.applyValue(getGroupResult -> getGroupResult).applyValue(example -> example.applyValue(getGroupResult -> getGroupResult.descriptor())))
                .members(exampleUser.descriptor())
                .build());
    
        }
    }
    
    resources:
      exampleProject:
        type: azuredevops:Project
        name: example
        properties:
          name: Example Project
      exampleUser:
        type: azuredevops:User
        name: example
        properties:
          principalName: foo@contoso.com
      exampleGroupMembership:
        type: azuredevops:GroupMembership
        name: example
        properties:
          group: ${example.descriptor}
          members:
            - ${exampleUser.descriptor}
    variables:
      example:
        fn::invoke:
          Function: azuredevops:getGroup
          Arguments:
            projectId: ${exampleProject.id}
            name: Build Administrators
    

    PAT Permissions Required

    • Deployment Groups: Read & Manage

    Create GroupMembership Resource

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

    Constructor syntax

    new GroupMembership(name: string, args: GroupMembershipArgs, opts?: CustomResourceOptions);
    @overload
    def GroupMembership(resource_name: str,
                        args: GroupMembershipArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def GroupMembership(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        group: Optional[str] = None,
                        members: Optional[Sequence[str]] = None,
                        mode: Optional[str] = None)
    func NewGroupMembership(ctx *Context, name string, args GroupMembershipArgs, opts ...ResourceOption) (*GroupMembership, error)
    public GroupMembership(string name, GroupMembershipArgs args, CustomResourceOptions? opts = null)
    public GroupMembership(String name, GroupMembershipArgs args)
    public GroupMembership(String name, GroupMembershipArgs args, CustomResourceOptions options)
    
    type: azuredevops:GroupMembership
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args GroupMembershipArgs
    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 GroupMembershipArgs
    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 GroupMembershipArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args GroupMembershipArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args GroupMembershipArgs
    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 groupMembershipResource = new AzureDevOps.GroupMembership("groupMembershipResource", new()
    {
        Group = "string",
        Members = new[]
        {
            "string",
        },
        Mode = "string",
    });
    
    example, err := azuredevops.NewGroupMembership(ctx, "groupMembershipResource", &azuredevops.GroupMembershipArgs{
    	Group: pulumi.String("string"),
    	Members: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Mode: pulumi.String("string"),
    })
    
    var groupMembershipResource = new GroupMembership("groupMembershipResource", GroupMembershipArgs.builder()
        .group("string")
        .members("string")
        .mode("string")
        .build());
    
    group_membership_resource = azuredevops.GroupMembership("groupMembershipResource",
        group="string",
        members=["string"],
        mode="string")
    
    const groupMembershipResource = new azuredevops.GroupMembership("groupMembershipResource", {
        group: "string",
        members: ["string"],
        mode: "string",
    });
    
    type: azuredevops:GroupMembership
    properties:
        group: string
        members:
            - string
        mode: string
    

    GroupMembership 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 GroupMembership resource accepts the following input properties:

    Group string
    The descriptor of the group being managed.
    Members List<string>

    A list of user or group descriptors that will become members of the group.

    NOTE It's possible to define group members both within the azuredevops.GroupMembership resource via the members block and by using the azuredevops.Group resource. However it's not possible to use both methods to manage group members, since there'll be conflicts.

    NOTE The members uses descriptor as the identifier not Resource ID or others.

    Mode string

    The mode how the resource manages group members.

    • mode == add: the resource will ensure that all specified members will be part of the referenced group
    • mode == overwrite: the resource will replace all existing members with the members specified within the members block

    NOTE To clear all members from a group, specify an empty list of descriptors in the members attribute and set the mode member to overwrite.

    Group string
    The descriptor of the group being managed.
    Members []string

    A list of user or group descriptors that will become members of the group.

    NOTE It's possible to define group members both within the azuredevops.GroupMembership resource via the members block and by using the azuredevops.Group resource. However it's not possible to use both methods to manage group members, since there'll be conflicts.

    NOTE The members uses descriptor as the identifier not Resource ID or others.

    Mode string

    The mode how the resource manages group members.

    • mode == add: the resource will ensure that all specified members will be part of the referenced group
    • mode == overwrite: the resource will replace all existing members with the members specified within the members block

    NOTE To clear all members from a group, specify an empty list of descriptors in the members attribute and set the mode member to overwrite.

    group String
    The descriptor of the group being managed.
    members List<String>

    A list of user or group descriptors that will become members of the group.

    NOTE It's possible to define group members both within the azuredevops.GroupMembership resource via the members block and by using the azuredevops.Group resource. However it's not possible to use both methods to manage group members, since there'll be conflicts.

    NOTE The members uses descriptor as the identifier not Resource ID or others.

    mode String

    The mode how the resource manages group members.

    • mode == add: the resource will ensure that all specified members will be part of the referenced group
    • mode == overwrite: the resource will replace all existing members with the members specified within the members block

    NOTE To clear all members from a group, specify an empty list of descriptors in the members attribute and set the mode member to overwrite.

    group string
    The descriptor of the group being managed.
    members string[]

    A list of user or group descriptors that will become members of the group.

    NOTE It's possible to define group members both within the azuredevops.GroupMembership resource via the members block and by using the azuredevops.Group resource. However it's not possible to use both methods to manage group members, since there'll be conflicts.

    NOTE The members uses descriptor as the identifier not Resource ID or others.

    mode string

    The mode how the resource manages group members.

    • mode == add: the resource will ensure that all specified members will be part of the referenced group
    • mode == overwrite: the resource will replace all existing members with the members specified within the members block

    NOTE To clear all members from a group, specify an empty list of descriptors in the members attribute and set the mode member to overwrite.

    group str
    The descriptor of the group being managed.
    members Sequence[str]

    A list of user or group descriptors that will become members of the group.

    NOTE It's possible to define group members both within the azuredevops.GroupMembership resource via the members block and by using the azuredevops.Group resource. However it's not possible to use both methods to manage group members, since there'll be conflicts.

    NOTE The members uses descriptor as the identifier not Resource ID or others.

    mode str

    The mode how the resource manages group members.

    • mode == add: the resource will ensure that all specified members will be part of the referenced group
    • mode == overwrite: the resource will replace all existing members with the members specified within the members block

    NOTE To clear all members from a group, specify an empty list of descriptors in the members attribute and set the mode member to overwrite.

    group String
    The descriptor of the group being managed.
    members List<String>

    A list of user or group descriptors that will become members of the group.

    NOTE It's possible to define group members both within the azuredevops.GroupMembership resource via the members block and by using the azuredevops.Group resource. However it's not possible to use both methods to manage group members, since there'll be conflicts.

    NOTE The members uses descriptor as the identifier not Resource ID or others.

    mode String

    The mode how the resource manages group members.

    • mode == add: the resource will ensure that all specified members will be part of the referenced group
    • mode == overwrite: the resource will replace all existing members with the members specified within the members block

    NOTE To clear all members from a group, specify an empty list of descriptors in the members attribute and set the mode member to overwrite.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the GroupMembership 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 GroupMembership Resource

    Get an existing GroupMembership 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?: GroupMembershipState, opts?: CustomResourceOptions): GroupMembership
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            group: Optional[str] = None,
            members: Optional[Sequence[str]] = None,
            mode: Optional[str] = None) -> GroupMembership
    func GetGroupMembership(ctx *Context, name string, id IDInput, state *GroupMembershipState, opts ...ResourceOption) (*GroupMembership, error)
    public static GroupMembership Get(string name, Input<string> id, GroupMembershipState? state, CustomResourceOptions? opts = null)
    public static GroupMembership get(String name, Output<String> id, GroupMembershipState 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.
    The following state arguments are supported:
    Group string
    The descriptor of the group being managed.
    Members List<string>

    A list of user or group descriptors that will become members of the group.

    NOTE It's possible to define group members both within the azuredevops.GroupMembership resource via the members block and by using the azuredevops.Group resource. However it's not possible to use both methods to manage group members, since there'll be conflicts.

    NOTE The members uses descriptor as the identifier not Resource ID or others.

    Mode string

    The mode how the resource manages group members.

    • mode == add: the resource will ensure that all specified members will be part of the referenced group
    • mode == overwrite: the resource will replace all existing members with the members specified within the members block

    NOTE To clear all members from a group, specify an empty list of descriptors in the members attribute and set the mode member to overwrite.

    Group string
    The descriptor of the group being managed.
    Members []string

    A list of user or group descriptors that will become members of the group.

    NOTE It's possible to define group members both within the azuredevops.GroupMembership resource via the members block and by using the azuredevops.Group resource. However it's not possible to use both methods to manage group members, since there'll be conflicts.

    NOTE The members uses descriptor as the identifier not Resource ID or others.

    Mode string

    The mode how the resource manages group members.

    • mode == add: the resource will ensure that all specified members will be part of the referenced group
    • mode == overwrite: the resource will replace all existing members with the members specified within the members block

    NOTE To clear all members from a group, specify an empty list of descriptors in the members attribute and set the mode member to overwrite.

    group String
    The descriptor of the group being managed.
    members List<String>

    A list of user or group descriptors that will become members of the group.

    NOTE It's possible to define group members both within the azuredevops.GroupMembership resource via the members block and by using the azuredevops.Group resource. However it's not possible to use both methods to manage group members, since there'll be conflicts.

    NOTE The members uses descriptor as the identifier not Resource ID or others.

    mode String

    The mode how the resource manages group members.

    • mode == add: the resource will ensure that all specified members will be part of the referenced group
    • mode == overwrite: the resource will replace all existing members with the members specified within the members block

    NOTE To clear all members from a group, specify an empty list of descriptors in the members attribute and set the mode member to overwrite.

    group string
    The descriptor of the group being managed.
    members string[]

    A list of user or group descriptors that will become members of the group.

    NOTE It's possible to define group members both within the azuredevops.GroupMembership resource via the members block and by using the azuredevops.Group resource. However it's not possible to use both methods to manage group members, since there'll be conflicts.

    NOTE The members uses descriptor as the identifier not Resource ID or others.

    mode string

    The mode how the resource manages group members.

    • mode == add: the resource will ensure that all specified members will be part of the referenced group
    • mode == overwrite: the resource will replace all existing members with the members specified within the members block

    NOTE To clear all members from a group, specify an empty list of descriptors in the members attribute and set the mode member to overwrite.

    group str
    The descriptor of the group being managed.
    members Sequence[str]

    A list of user or group descriptors that will become members of the group.

    NOTE It's possible to define group members both within the azuredevops.GroupMembership resource via the members block and by using the azuredevops.Group resource. However it's not possible to use both methods to manage group members, since there'll be conflicts.

    NOTE The members uses descriptor as the identifier not Resource ID or others.

    mode str

    The mode how the resource manages group members.

    • mode == add: the resource will ensure that all specified members will be part of the referenced group
    • mode == overwrite: the resource will replace all existing members with the members specified within the members block

    NOTE To clear all members from a group, specify an empty list of descriptors in the members attribute and set the mode member to overwrite.

    group String
    The descriptor of the group being managed.
    members List<String>

    A list of user or group descriptors that will become members of the group.

    NOTE It's possible to define group members both within the azuredevops.GroupMembership resource via the members block and by using the azuredevops.Group resource. However it's not possible to use both methods to manage group members, since there'll be conflicts.

    NOTE The members uses descriptor as the identifier not Resource ID or others.

    mode String

    The mode how the resource manages group members.

    • mode == add: the resource will ensure that all specified members will be part of the referenced group
    • mode == overwrite: the resource will replace all existing members with the members specified within the members block

    NOTE To clear all members from a group, specify an empty list of descriptors in the members attribute and set the mode member to overwrite.

    Import

    Not supported.

    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.
    azuredevops logo
    Azure DevOps v3.4.0 published on Wednesday, Oct 30, 2024 by Pulumi