AzureAD

Pulumi Official
Package maintained by Pulumi
v5.22.0 published on Wednesday, May 4, 2022 by Pulumi

AdministrativeUnitMember

Manages a single administrative unit membership within Azure Active Directory.

Warning Do not use this resource at the same time as the members property of the azuread.AdministrativeUnit resource for the same administrative unit. Doing so will cause a conflict and administrative unit members will be removed.

API Permissions

The following API permissions are required in order to use this resource.

When authenticated with a service principal, this resource requires one of the following application roles: AdministrativeUnit.ReadWrite.All or Directory.ReadWrite.All

When authenticated with a user principal, this resource requires one of the following directory roles: Privileged Role Administrator or Global Administrator

Example Usage

using Pulumi;
using AzureAD = Pulumi.AzureAD;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleUser = Output.Create(AzureAD.GetUser.InvokeAsync(new AzureAD.GetUserArgs
        {
            UserPrincipalName = "jdoe@hashicorp.com",
        }));
        var exampleAdministrativeUnit = new AzureAD.AdministrativeUnit("exampleAdministrativeUnit", new AzureAD.AdministrativeUnitArgs
        {
            DisplayName = "Example-AU",
        });
        var exampleAdministrativeUnitMember = new AzureAD.AdministrativeUnitMember("exampleAdministrativeUnitMember", new AzureAD.AdministrativeUnitMemberArgs
        {
            AdministrativeUnitObjectId = exampleAdministrativeUnit.Id,
            MemberObjectId = exampleUser.Apply(exampleUser => exampleUser.Id),
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-azuread/sdk/v5/go/azuread"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleUser, err := azuread.LookupUser(ctx, &GetUserArgs{
			UserPrincipalName: pulumi.StringRef("jdoe@hashicorp.com"),
		}, nil)
		if err != nil {
			return err
		}
		exampleAdministrativeUnit, err := azuread.NewAdministrativeUnit(ctx, "exampleAdministrativeUnit", &azuread.AdministrativeUnitArgs{
			DisplayName: pulumi.String("Example-AU"),
		})
		if err != nil {
			return err
		}
		_, err = azuread.NewAdministrativeUnitMember(ctx, "exampleAdministrativeUnitMember", &azuread.AdministrativeUnitMemberArgs{
			AdministrativeUnitObjectId: exampleAdministrativeUnit.ID(),
			MemberObjectId:             pulumi.String(exampleUser.Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var exampleUser = Output.of(AzureadFunctions.getUser(GetUserArgs.builder()
            .userPrincipalName("jdoe@hashicorp.com")
            .build()));

        var exampleAdministrativeUnit = new AdministrativeUnit("exampleAdministrativeUnit", AdministrativeUnitArgs.builder()        
            .displayName("Example-AU")
            .build());

        var exampleAdministrativeUnitMember = new AdministrativeUnitMember("exampleAdministrativeUnitMember", AdministrativeUnitMemberArgs.builder()        
            .administrativeUnitObjectId(exampleAdministrativeUnit.getId())
            .memberObjectId(exampleUser.apply(getUserResult -> getUserResult.getId()))
            .build());

        }
}
import pulumi
import pulumi_azuread as azuread

example_user = azuread.get_user(user_principal_name="jdoe@hashicorp.com")
example_administrative_unit = azuread.AdministrativeUnit("exampleAdministrativeUnit", display_name="Example-AU")
example_administrative_unit_member = azuread.AdministrativeUnitMember("exampleAdministrativeUnitMember",
    administrative_unit_object_id=example_administrative_unit.id,
    member_object_id=example_user.id)
import * as pulumi from "@pulumi/pulumi";
import * as azuread from "@pulumi/azuread";

const exampleUser = azuread.getUser({
    userPrincipalName: "jdoe@hashicorp.com",
});
const exampleAdministrativeUnit = new azuread.AdministrativeUnit("exampleAdministrativeUnit", {displayName: "Example-AU"});
const exampleAdministrativeUnitMember = new azuread.AdministrativeUnitMember("exampleAdministrativeUnitMember", {
    administrativeUnitObjectId: exampleAdministrativeUnit.id,
    memberObjectId: exampleUser.then(exampleUser => exampleUser.id),
});
resources:
  exampleAdministrativeUnit:
    type: azuread:AdministrativeUnit
    properties:
      displayName: Example-AU
  exampleAdministrativeUnitMember:
    type: azuread:AdministrativeUnitMember
    properties:
      administrativeUnitObjectId: ${exampleAdministrativeUnit.id}
      memberObjectId: ${exampleUser.id}
variables:
  exampleUser:
    Fn::Invoke:
      Function: azuread:getUser
      Arguments:
        userPrincipalName: jdoe@hashicorp.com

Create a AdministrativeUnitMember Resource

new AdministrativeUnitMember(name: string, args?: AdministrativeUnitMemberArgs, opts?: CustomResourceOptions);
@overload
def AdministrativeUnitMember(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             administrative_unit_object_id: Optional[str] = None,
                             member_object_id: Optional[str] = None)
@overload
def AdministrativeUnitMember(resource_name: str,
                             args: Optional[AdministrativeUnitMemberArgs] = None,
                             opts: Optional[ResourceOptions] = None)
func NewAdministrativeUnitMember(ctx *Context, name string, args *AdministrativeUnitMemberArgs, opts ...ResourceOption) (*AdministrativeUnitMember, error)
public AdministrativeUnitMember(string name, AdministrativeUnitMemberArgs? args = null, CustomResourceOptions? opts = null)
public AdministrativeUnitMember(String name, AdministrativeUnitMemberArgs args)
public AdministrativeUnitMember(String name, AdministrativeUnitMemberArgs args, CustomResourceOptions options)
type: azuread:AdministrativeUnitMember
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args AdministrativeUnitMemberArgs
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 AdministrativeUnitMemberArgs
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 AdministrativeUnitMemberArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args AdministrativeUnitMemberArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args AdministrativeUnitMemberArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

AdministrativeUnitObjectId string

The object ID of the administrative unit you want to add the member to. Changing this forces a new resource to be created.

MemberObjectId string

The object ID of the user or group you want to add as a member of the administrative unit. Changing this forces a new resource to be created.

AdministrativeUnitObjectId string

The object ID of the administrative unit you want to add the member to. Changing this forces a new resource to be created.

MemberObjectId string

The object ID of the user or group you want to add as a member of the administrative unit. Changing this forces a new resource to be created.

administrativeUnitObjectId String

The object ID of the administrative unit you want to add the member to. Changing this forces a new resource to be created.

memberObjectId String

The object ID of the user or group you want to add as a member of the administrative unit. Changing this forces a new resource to be created.

administrativeUnitObjectId string

The object ID of the administrative unit you want to add the member to. Changing this forces a new resource to be created.

memberObjectId string

The object ID of the user or group you want to add as a member of the administrative unit. Changing this forces a new resource to be created.

administrative_unit_object_id str

The object ID of the administrative unit you want to add the member to. Changing this forces a new resource to be created.

member_object_id str

The object ID of the user or group you want to add as a member of the administrative unit. Changing this forces a new resource to be created.

administrativeUnitObjectId String

The object ID of the administrative unit you want to add the member to. Changing this forces a new resource to be created.

memberObjectId String

The object ID of the user or group you want to add as a member of the administrative unit. Changing this forces a new resource to be created.

Outputs

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

Get an existing AdministrativeUnitMember 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?: AdministrativeUnitMemberState, opts?: CustomResourceOptions): AdministrativeUnitMember
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        administrative_unit_object_id: Optional[str] = None,
        member_object_id: Optional[str] = None) -> AdministrativeUnitMember
func GetAdministrativeUnitMember(ctx *Context, name string, id IDInput, state *AdministrativeUnitMemberState, opts ...ResourceOption) (*AdministrativeUnitMember, error)
public static AdministrativeUnitMember Get(string name, Input<string> id, AdministrativeUnitMemberState? state, CustomResourceOptions? opts = null)
public static AdministrativeUnitMember get(String name, Output<String> id, AdministrativeUnitMemberState 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:
AdministrativeUnitObjectId string

The object ID of the administrative unit you want to add the member to. Changing this forces a new resource to be created.

MemberObjectId string

The object ID of the user or group you want to add as a member of the administrative unit. Changing this forces a new resource to be created.

AdministrativeUnitObjectId string

The object ID of the administrative unit you want to add the member to. Changing this forces a new resource to be created.

MemberObjectId string

The object ID of the user or group you want to add as a member of the administrative unit. Changing this forces a new resource to be created.

administrativeUnitObjectId String

The object ID of the administrative unit you want to add the member to. Changing this forces a new resource to be created.

memberObjectId String

The object ID of the user or group you want to add as a member of the administrative unit. Changing this forces a new resource to be created.

administrativeUnitObjectId string

The object ID of the administrative unit you want to add the member to. Changing this forces a new resource to be created.

memberObjectId string

The object ID of the user or group you want to add as a member of the administrative unit. Changing this forces a new resource to be created.

administrative_unit_object_id str

The object ID of the administrative unit you want to add the member to. Changing this forces a new resource to be created.

member_object_id str

The object ID of the user or group you want to add as a member of the administrative unit. Changing this forces a new resource to be created.

administrativeUnitObjectId String

The object ID of the administrative unit you want to add the member to. Changing this forces a new resource to be created.

memberObjectId String

The object ID of the user or group you want to add as a member of the administrative unit. Changing this forces a new resource to be created.

Import

Administrative unit members can be imported using the object ID of the administrative unit and the object ID of the member, e.g.

 $ pulumi import azuread:index/administrativeUnitMember:AdministrativeUnitMember test 00000000-0000-0000-0000-000000000000/member/11111111-1111-1111-1111-111111111111

-> This ID format is unique to Terraform and is composed of the Administrative Unit Object ID and the target Member Object ID in the format {AdministrativeUnitObjectID}/member/{MemberObjectID}.

Package Details

Repository
https://github.com/pulumi/pulumi-azuread
License
Apache-2.0
Notes

This Pulumi package is based on the azuread Terraform Provider.