1. Packages
  2. Azure Active Directory (Azure AD)
  3. API Docs
  4. AdministrativeUnitRoleMember
Azure Active Directory (Azure AD) v6.0.1 published on Monday, Oct 14, 2024 by Pulumi

azuread.AdministrativeUnitRoleMember

Explore with Pulumi AI

azuread logo
Azure Active Directory (Azure AD) v6.0.1 published on Monday, Oct 14, 2024 by Pulumi

    Manages a single directory role assignment scoped to an administrative unit within Azure Active Directory.

    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 and RoleManagement.ReadWrite.Directory, 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

    import * as pulumi from "@pulumi/pulumi";
    import * as azuread from "@pulumi/azuread";
    
    const example = azuread.getUser({
        userPrincipalName: "jdoe@example.com",
    });
    const exampleAdministrativeUnit = new azuread.AdministrativeUnit("example", {displayName: "Example-AU"});
    const exampleDirectoryRole = new azuread.DirectoryRole("example", {displayName: "Security administrator"});
    const exampleAdministrativeUnitRoleMember = new azuread.AdministrativeUnitRoleMember("example", {
        roleObjectId: exampleDirectoryRole.objectId,
        administrativeUnitObjectId: exampleAdministrativeUnit.id,
        memberObjectId: example.then(example => example.id),
    });
    
    import pulumi
    import pulumi_azuread as azuread
    
    example = azuread.get_user(user_principal_name="jdoe@example.com")
    example_administrative_unit = azuread.AdministrativeUnit("example", display_name="Example-AU")
    example_directory_role = azuread.DirectoryRole("example", display_name="Security administrator")
    example_administrative_unit_role_member = azuread.AdministrativeUnitRoleMember("example",
        role_object_id=example_directory_role.object_id,
        administrative_unit_object_id=example_administrative_unit.id,
        member_object_id=example.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azuread/sdk/v6/go/azuread"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := azuread.LookupUser(ctx, &azuread.LookupUserArgs{
    			UserPrincipalName: pulumi.StringRef("jdoe@example.com"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		exampleAdministrativeUnit, err := azuread.NewAdministrativeUnit(ctx, "example", &azuread.AdministrativeUnitArgs{
    			DisplayName: pulumi.String("Example-AU"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleDirectoryRole, err := azuread.NewDirectoryRole(ctx, "example", &azuread.DirectoryRoleArgs{
    			DisplayName: pulumi.String("Security administrator"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = azuread.NewAdministrativeUnitRoleMember(ctx, "example", &azuread.AdministrativeUnitRoleMemberArgs{
    			RoleObjectId:               exampleDirectoryRole.ObjectId,
    			AdministrativeUnitObjectId: exampleAdministrativeUnit.ID(),
    			MemberObjectId:             pulumi.String(example.Id),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AzureAD = Pulumi.AzureAD;
    
    return await Deployment.RunAsync(() => 
    {
        var example = AzureAD.GetUser.Invoke(new()
        {
            UserPrincipalName = "jdoe@example.com",
        });
    
        var exampleAdministrativeUnit = new AzureAD.AdministrativeUnit("example", new()
        {
            DisplayName = "Example-AU",
        });
    
        var exampleDirectoryRole = new AzureAD.DirectoryRole("example", new()
        {
            DisplayName = "Security administrator",
        });
    
        var exampleAdministrativeUnitRoleMember = new AzureAD.AdministrativeUnitRoleMember("example", new()
        {
            RoleObjectId = exampleDirectoryRole.ObjectId,
            AdministrativeUnitObjectId = exampleAdministrativeUnit.Id,
            MemberObjectId = example.Apply(getUserResult => getUserResult.Id),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azuread.AzureadFunctions;
    import com.pulumi.azuread.inputs.GetUserArgs;
    import com.pulumi.azuread.AdministrativeUnit;
    import com.pulumi.azuread.AdministrativeUnitArgs;
    import com.pulumi.azuread.DirectoryRole;
    import com.pulumi.azuread.DirectoryRoleArgs;
    import com.pulumi.azuread.AdministrativeUnitRoleMember;
    import com.pulumi.azuread.AdministrativeUnitRoleMemberArgs;
    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) {
            final var example = AzureadFunctions.getUser(GetUserArgs.builder()
                .userPrincipalName("jdoe@example.com")
                .build());
    
            var exampleAdministrativeUnit = new AdministrativeUnit("exampleAdministrativeUnit", AdministrativeUnitArgs.builder()
                .displayName("Example-AU")
                .build());
    
            var exampleDirectoryRole = new DirectoryRole("exampleDirectoryRole", DirectoryRoleArgs.builder()
                .displayName("Security administrator")
                .build());
    
            var exampleAdministrativeUnitRoleMember = new AdministrativeUnitRoleMember("exampleAdministrativeUnitRoleMember", AdministrativeUnitRoleMemberArgs.builder()
                .roleObjectId(exampleDirectoryRole.objectId())
                .administrativeUnitObjectId(exampleAdministrativeUnit.id())
                .memberObjectId(example.applyValue(getUserResult -> getUserResult.id()))
                .build());
    
        }
    }
    
    resources:
      exampleAdministrativeUnit:
        type: azuread:AdministrativeUnit
        name: example
        properties:
          displayName: Example-AU
      exampleDirectoryRole:
        type: azuread:DirectoryRole
        name: example
        properties:
          displayName: Security administrator
      exampleAdministrativeUnitRoleMember:
        type: azuread:AdministrativeUnitRoleMember
        name: example
        properties:
          roleObjectId: ${exampleDirectoryRole.objectId}
          administrativeUnitObjectId: ${exampleAdministrativeUnit.id}
          memberObjectId: ${example.id}
    variables:
      example:
        fn::invoke:
          Function: azuread:getUser
          Arguments:
            userPrincipalName: jdoe@example.com
    

    Create AdministrativeUnitRoleMember Resource

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

    Constructor syntax

    new AdministrativeUnitRoleMember(name: string, args: AdministrativeUnitRoleMemberArgs, opts?: CustomResourceOptions);
    @overload
    def AdministrativeUnitRoleMember(resource_name: str,
                                     args: AdministrativeUnitRoleMemberArgs,
                                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def AdministrativeUnitRoleMember(resource_name: str,
                                     opts: Optional[ResourceOptions] = None,
                                     administrative_unit_object_id: Optional[str] = None,
                                     member_object_id: Optional[str] = None,
                                     role_object_id: Optional[str] = None)
    func NewAdministrativeUnitRoleMember(ctx *Context, name string, args AdministrativeUnitRoleMemberArgs, opts ...ResourceOption) (*AdministrativeUnitRoleMember, error)
    public AdministrativeUnitRoleMember(string name, AdministrativeUnitRoleMemberArgs args, CustomResourceOptions? opts = null)
    public AdministrativeUnitRoleMember(String name, AdministrativeUnitRoleMemberArgs args)
    public AdministrativeUnitRoleMember(String name, AdministrativeUnitRoleMemberArgs args, CustomResourceOptions options)
    
    type: azuread:AdministrativeUnitRoleMember
    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 AdministrativeUnitRoleMemberArgs
    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 AdministrativeUnitRoleMemberArgs
    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 AdministrativeUnitRoleMemberArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AdministrativeUnitRoleMemberArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AdministrativeUnitRoleMemberArgs
    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 administrativeUnitRoleMemberResource = new AzureAD.AdministrativeUnitRoleMember("administrativeUnitRoleMemberResource", new()
    {
        AdministrativeUnitObjectId = "string",
        MemberObjectId = "string",
        RoleObjectId = "string",
    });
    
    example, err := azuread.NewAdministrativeUnitRoleMember(ctx, "administrativeUnitRoleMemberResource", &azuread.AdministrativeUnitRoleMemberArgs{
    	AdministrativeUnitObjectId: pulumi.String("string"),
    	MemberObjectId:             pulumi.String("string"),
    	RoleObjectId:               pulumi.String("string"),
    })
    
    var administrativeUnitRoleMemberResource = new AdministrativeUnitRoleMember("administrativeUnitRoleMemberResource", AdministrativeUnitRoleMemberArgs.builder()
        .administrativeUnitObjectId("string")
        .memberObjectId("string")
        .roleObjectId("string")
        .build());
    
    administrative_unit_role_member_resource = azuread.AdministrativeUnitRoleMember("administrativeUnitRoleMemberResource",
        administrative_unit_object_id="string",
        member_object_id="string",
        role_object_id="string")
    
    const administrativeUnitRoleMemberResource = new azuread.AdministrativeUnitRoleMember("administrativeUnitRoleMemberResource", {
        administrativeUnitObjectId: "string",
        memberObjectId: "string",
        roleObjectId: "string",
    });
    
    type: azuread:AdministrativeUnitRoleMember
    properties:
        administrativeUnitObjectId: string
        memberObjectId: string
        roleObjectId: string
    

    AdministrativeUnitRoleMember 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 AdministrativeUnitRoleMember 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, group or service principal you want to add as a member of the administrative unit. Changing this forces a new resource to be created.
    RoleObjectId string
    The object ID of the directory role you want to assign. 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, group or service principal you want to add as a member of the administrative unit. Changing this forces a new resource to be created.
    RoleObjectId string
    The object ID of the directory role you want to assign. 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, group or service principal you want to add as a member of the administrative unit. Changing this forces a new resource to be created.
    roleObjectId String
    The object ID of the directory role you want to assign. 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, group or service principal you want to add as a member of the administrative unit. Changing this forces a new resource to be created.
    roleObjectId string
    The object ID of the directory role you want to assign. 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, group or service principal you want to add as a member of the administrative unit. Changing this forces a new resource to be created.
    role_object_id str
    The object ID of the directory role you want to assign. 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, group or service principal you want to add as a member of the administrative unit. Changing this forces a new resource to be created.
    roleObjectId String
    The object ID of the directory role you want to assign. Changing this forces a new resource to be created.

    Outputs

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

    Get an existing AdministrativeUnitRoleMember 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?: AdministrativeUnitRoleMemberState, opts?: CustomResourceOptions): AdministrativeUnitRoleMember
    @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,
            role_object_id: Optional[str] = None) -> AdministrativeUnitRoleMember
    func GetAdministrativeUnitRoleMember(ctx *Context, name string, id IDInput, state *AdministrativeUnitRoleMemberState, opts ...ResourceOption) (*AdministrativeUnitRoleMember, error)
    public static AdministrativeUnitRoleMember Get(string name, Input<string> id, AdministrativeUnitRoleMemberState? state, CustomResourceOptions? opts = null)
    public static AdministrativeUnitRoleMember get(String name, Output<String> id, AdministrativeUnitRoleMemberState 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, group or service principal you want to add as a member of the administrative unit. Changing this forces a new resource to be created.
    RoleObjectId string
    The object ID of the directory role you want to assign. 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, group or service principal you want to add as a member of the administrative unit. Changing this forces a new resource to be created.
    RoleObjectId string
    The object ID of the directory role you want to assign. 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, group or service principal you want to add as a member of the administrative unit. Changing this forces a new resource to be created.
    roleObjectId String
    The object ID of the directory role you want to assign. 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, group or service principal you want to add as a member of the administrative unit. Changing this forces a new resource to be created.
    roleObjectId string
    The object ID of the directory role you want to assign. 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, group or service principal you want to add as a member of the administrative unit. Changing this forces a new resource to be created.
    role_object_id str
    The object ID of the directory role you want to assign. 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, group or service principal you want to add as a member of the administrative unit. Changing this forces a new resource to be created.
    roleObjectId String
    The object ID of the directory role you want to assign. Changing this forces a new resource to be created.

    Import

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

    $ pulumi import azuread:index/administrativeUnitRoleMember:AdministrativeUnitRoleMember example 00000000-0000-0000-0000-000000000000/roleMember/zX37MRLyF0uvE-xf2WH4B7x-6CPLfudNnxFGj800htpBXqkxW7bITqGb6Rj4kuTuS
    

    -> This ID format is unique to Terraform and is composed of the Administrative Unit Object ID and the role assignment ID in the format {AdministrativeUnitObjectID}/roleMember/{RoleAssignmentID}.

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

    Package Details

    Repository
    Azure Active Directory (Azure AD) pulumi/pulumi-azuread
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azuread Terraform Provider.
    azuread logo
    Azure Active Directory (Azure AD) v6.0.1 published on Monday, Oct 14, 2024 by Pulumi