GroupMembership

Manages group membership within Azure DevOps.

PAT Permissions Required

  • Deployment Groups: Read & Manage

Example Usage

using Pulumi;
using AzureDevOps = Pulumi.AzureDevOps;

class MyStack : Stack
{
    public MyStack()
    {
        var project = new AzureDevOps.Core.Project("project", new AzureDevOps.Core.ProjectArgs
        {
            ProjectName = "Test Project",
        });
        var user = new AzureDevOps.Entitlement.User("user", new AzureDevOps.Entitlement.UserArgs
        {
            PrincipalName = "foo@contoso.com",
        });
        var @group = project.Id.Apply(id => AzureDevOps.Identities.GetGroup.InvokeAsync(new AzureDevOps.Identities.GetGroupArgs
        {
            ProjectId = id,
            Name = "Build Administrators",
        }));
        var membership = new AzureDevOps.Identities.GroupMembership("membership", new AzureDevOps.Identities.GroupMembershipArgs
        {
            Group = @group.Apply(@group => @group.Descriptor),
            Members = 
            {
                user.Descriptor,
            },
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-azuredevops/sdk/go/azuredevops/Core"
    "github.com/pulumi/pulumi-azuredevops/sdk/go/azuredevops/Entitlement"
    "github.com/pulumi/pulumi-azuredevops/sdk/go/azuredevops/Identities"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        project, err := Core.NewProject(ctx, "project", &Core.ProjectArgs{
            ProjectName: pulumi.String("Test Project"),
        })
        if err != nil {
            return err
        }
        user, err := Entitlement.NewUser(ctx, "user", &Entitlement.UserArgs{
            PrincipalName: pulumi.String("foo@contoso.com"),
        })
        if err != nil {
            return err
        }
        membership, err := Identities.NewGroupMembership(ctx, "membership", &Identities.GroupMembershipArgs{
            Group: group.ApplyT(func(group Identities.LookupGroupResult) (string, error) {
                return group.Descriptor, nil
            }).(pulumi.StringOutput),
            Members: pulumi.StringArray{
                user.Descriptor,
            },
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_azuredevops as azuredevops

project = azuredevops.core.Project("project", project_name="Test Project")
user = azuredevops.entitlement.User("user", principal_name="foo@contoso.com")
group = project.id.apply(lambda id: azuredevops.Identities.get_group(project_id=id,
    name="Build Administrators"))
membership = azuredevops.identities.GroupMembership("membership",
    group=group.descriptor,
    members=[user.descriptor])
import * as pulumi from "@pulumi/pulumi";
import * as azuredevops from "@pulumi/azuredevops";

const project = new azuredevops.Core.Project("project", {projectName: "Test Project"});
const user = new azuredevops.Entitlement.User("user", {principalName: "foo@contoso.com"});
const group = project.id.apply(id => azuredevops.Identities.getGroup({
    projectId: id,
    name: "Build Administrators",
}));
const membership = new azuredevops.Identities.GroupMembership("membership", {
    group: group.descriptor,
    members: [user.descriptor],
});

Create a GroupMembership Resource

def GroupMembership(resource_name, opts=None, group=None, members=None, mode=None, __props__=None);
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.
opts ResourceOptions
A bag of options that control this 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.

GroupMembership Resource Properties

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

Inputs

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.Identities.GroupMembership resource via the members block and by using the azuredevops.Identities.Group resource. However it’s not possible to use both methods to manage group members, since there’ll be conflicts.

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.Identities.GroupMembership resource via the members block and by using the azuredevops.Identities.Group resource. However it’s not possible to use both methods to manage group members, since there’ll be conflicts.

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.Identities.GroupMembership resource via the members block and by using the azuredevops.Identities.Group resource. However it’s not possible to use both methods to manage group members, since there’ll be conflicts.

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 List[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.Identities.GroupMembership resource via the members block and by using the azuredevops.Identities.Group resource. However it’s not possible to use both methods to manage group members, since there’ll be conflicts.

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.

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 str
The provider-assigned unique ID for this managed resource.

Look up an 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
static get(resource_name, id, opts=None, group=None, members=None, mode=None, __props__=None);
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)
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.

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.Identities.GroupMembership resource via the members block and by using the azuredevops.Identities.Group resource. However it’s not possible to use both methods to manage group members, since there’ll be conflicts.

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.Identities.GroupMembership resource via the members block and by using the azuredevops.Identities.Group resource. However it’s not possible to use both methods to manage group members, since there’ll be conflicts.

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.Identities.GroupMembership resource via the members block and by using the azuredevops.Identities.Group resource. However it’s not possible to use both methods to manage group members, since there’ll be conflicts.

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 List[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.Identities.GroupMembership resource via the members block and by using the azuredevops.Identities.Group resource. However it’s not possible to use both methods to manage group members, since there’ll be conflicts.

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.

Package Details

Repository
https://github.com/pulumi/pulumi-azuredevops
License
Apache-2.0
Notes
This Pulumi package is based on the azuredevops Terraform Provider.