1. Packages
  2. Azure Active Directory (Azure AD)
  3. API Docs
  4. DirectoryRoleAssignment
Azure Active Directory (Azure AD) v5.48.0 published on Monday, Apr 15, 2024 by Pulumi

azuread.DirectoryRoleAssignment

Explore with Pulumi AI

azuread logo
Azure Active Directory (Azure AD) v5.48.0 published on Monday, Apr 15, 2024 by Pulumi

    Manages a single directory role assignment 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: 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

    Assignment for a built-in role

    import * as pulumi from "@pulumi/pulumi";
    import * as azuread from "@pulumi/azuread";
    
    const example = azuread.getUser({
        userPrincipalName: "jdoe@example.com",
    });
    const exampleDirectoryRole = new azuread.DirectoryRole("example", {displayName: "Security administrator"});
    const exampleDirectoryRoleAssignment = new azuread.DirectoryRoleAssignment("example", {
        roleId: exampleDirectoryRole.templateId,
        principalObjectId: example.then(example => example.objectId),
    });
    
    import pulumi
    import pulumi_azuread as azuread
    
    example = azuread.get_user(user_principal_name="jdoe@example.com")
    example_directory_role = azuread.DirectoryRole("example", display_name="Security administrator")
    example_directory_role_assignment = azuread.DirectoryRoleAssignment("example",
        role_id=example_directory_role.template_id,
        principal_object_id=example.object_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 {
    		example, err := azuread.LookupUser(ctx, &azuread.LookupUserArgs{
    			UserPrincipalName: pulumi.StringRef("jdoe@example.com"),
    		}, nil)
    		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.NewDirectoryRoleAssignment(ctx, "example", &azuread.DirectoryRoleAssignmentArgs{
    			RoleId:            exampleDirectoryRole.TemplateId,
    			PrincipalObjectId: pulumi.String(example.ObjectId),
    		})
    		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 exampleDirectoryRole = new AzureAD.DirectoryRole("example", new()
        {
            DisplayName = "Security administrator",
        });
    
        var exampleDirectoryRoleAssignment = new AzureAD.DirectoryRoleAssignment("example", new()
        {
            RoleId = exampleDirectoryRole.TemplateId,
            PrincipalObjectId = example.Apply(getUserResult => getUserResult.ObjectId),
        });
    
    });
    
    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.DirectoryRole;
    import com.pulumi.azuread.DirectoryRoleArgs;
    import com.pulumi.azuread.DirectoryRoleAssignment;
    import com.pulumi.azuread.DirectoryRoleAssignmentArgs;
    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 exampleDirectoryRole = new DirectoryRole("exampleDirectoryRole", DirectoryRoleArgs.builder()        
                .displayName("Security administrator")
                .build());
    
            var exampleDirectoryRoleAssignment = new DirectoryRoleAssignment("exampleDirectoryRoleAssignment", DirectoryRoleAssignmentArgs.builder()        
                .roleId(exampleDirectoryRole.templateId())
                .principalObjectId(example.applyValue(getUserResult -> getUserResult.objectId()))
                .build());
    
        }
    }
    
    resources:
      exampleDirectoryRole:
        type: azuread:DirectoryRole
        name: example
        properties:
          displayName: Security administrator
      exampleDirectoryRoleAssignment:
        type: azuread:DirectoryRoleAssignment
        name: example
        properties:
          roleId: ${exampleDirectoryRole.templateId}
          principalObjectId: ${example.objectId}
    variables:
      example:
        fn::invoke:
          Function: azuread:getUser
          Arguments:
            userPrincipalName: jdoe@example.com
    

    Note the use of the template_id attribute when referencing built-in roles.

    Assignment for a custom role

    import * as pulumi from "@pulumi/pulumi";
    import * as azuread from "@pulumi/azuread";
    
    const example = azuread.getUser({
        userPrincipalName: "jdoe@example.com",
    });
    const exampleCustomDirectoryRole = new azuread.CustomDirectoryRole("example", {
        displayName: "My Custom Role",
        enabled: true,
        version: "1.0",
        permissions: [{
            allowedResourceActions: [
                "microsoft.directory/applications/basic/update",
                "microsoft.directory/applications/standard/read",
            ],
        }],
    });
    const exampleDirectoryRoleAssignment = new azuread.DirectoryRoleAssignment("example", {
        roleId: exampleCustomDirectoryRole.objectId,
        principalObjectId: example.then(example => example.objectId),
    });
    
    import pulumi
    import pulumi_azuread as azuread
    
    example = azuread.get_user(user_principal_name="jdoe@example.com")
    example_custom_directory_role = azuread.CustomDirectoryRole("example",
        display_name="My Custom Role",
        enabled=True,
        version="1.0",
        permissions=[azuread.CustomDirectoryRolePermissionArgs(
            allowed_resource_actions=[
                "microsoft.directory/applications/basic/update",
                "microsoft.directory/applications/standard/read",
            ],
        )])
    example_directory_role_assignment = azuread.DirectoryRoleAssignment("example",
        role_id=example_custom_directory_role.object_id,
        principal_object_id=example.object_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 {
    		example, err := azuread.LookupUser(ctx, &azuread.LookupUserArgs{
    			UserPrincipalName: pulumi.StringRef("jdoe@example.com"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		exampleCustomDirectoryRole, err := azuread.NewCustomDirectoryRole(ctx, "example", &azuread.CustomDirectoryRoleArgs{
    			DisplayName: pulumi.String("My Custom Role"),
    			Enabled:     pulumi.Bool(true),
    			Version:     pulumi.String("1.0"),
    			Permissions: azuread.CustomDirectoryRolePermissionArray{
    				&azuread.CustomDirectoryRolePermissionArgs{
    					AllowedResourceActions: pulumi.StringArray{
    						pulumi.String("microsoft.directory/applications/basic/update"),
    						pulumi.String("microsoft.directory/applications/standard/read"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = azuread.NewDirectoryRoleAssignment(ctx, "example", &azuread.DirectoryRoleAssignmentArgs{
    			RoleId:            exampleCustomDirectoryRole.ObjectId,
    			PrincipalObjectId: pulumi.String(example.ObjectId),
    		})
    		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 exampleCustomDirectoryRole = new AzureAD.CustomDirectoryRole("example", new()
        {
            DisplayName = "My Custom Role",
            Enabled = true,
            Version = "1.0",
            Permissions = new[]
            {
                new AzureAD.Inputs.CustomDirectoryRolePermissionArgs
                {
                    AllowedResourceActions = new[]
                    {
                        "microsoft.directory/applications/basic/update",
                        "microsoft.directory/applications/standard/read",
                    },
                },
            },
        });
    
        var exampleDirectoryRoleAssignment = new AzureAD.DirectoryRoleAssignment("example", new()
        {
            RoleId = exampleCustomDirectoryRole.ObjectId,
            PrincipalObjectId = example.Apply(getUserResult => getUserResult.ObjectId),
        });
    
    });
    
    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.CustomDirectoryRole;
    import com.pulumi.azuread.CustomDirectoryRoleArgs;
    import com.pulumi.azuread.inputs.CustomDirectoryRolePermissionArgs;
    import com.pulumi.azuread.DirectoryRoleAssignment;
    import com.pulumi.azuread.DirectoryRoleAssignmentArgs;
    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 exampleCustomDirectoryRole = new CustomDirectoryRole("exampleCustomDirectoryRole", CustomDirectoryRoleArgs.builder()        
                .displayName("My Custom Role")
                .enabled(true)
                .version("1.0")
                .permissions(CustomDirectoryRolePermissionArgs.builder()
                    .allowedResourceActions(                
                        "microsoft.directory/applications/basic/update",
                        "microsoft.directory/applications/standard/read")
                    .build())
                .build());
    
            var exampleDirectoryRoleAssignment = new DirectoryRoleAssignment("exampleDirectoryRoleAssignment", DirectoryRoleAssignmentArgs.builder()        
                .roleId(exampleCustomDirectoryRole.objectId())
                .principalObjectId(example.applyValue(getUserResult -> getUserResult.objectId()))
                .build());
    
        }
    }
    
    resources:
      exampleCustomDirectoryRole:
        type: azuread:CustomDirectoryRole
        name: example
        properties:
          displayName: My Custom Role
          enabled: true
          version: '1.0'
          permissions:
            - allowedResourceActions:
                - microsoft.directory/applications/basic/update
                - microsoft.directory/applications/standard/read
      exampleDirectoryRoleAssignment:
        type: azuread:DirectoryRoleAssignment
        name: example
        properties:
          roleId: ${exampleCustomDirectoryRole.objectId}
          principalObjectId: ${example.objectId}
    variables:
      example:
        fn::invoke:
          Function: azuread:getUser
          Arguments:
            userPrincipalName: jdoe@example.com
    

    Scoped assignment for an application

    Create DirectoryRoleAssignment Resource

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

    Constructor syntax

    new DirectoryRoleAssignment(name: string, args: DirectoryRoleAssignmentArgs, opts?: CustomResourceOptions);
    @overload
    def DirectoryRoleAssignment(resource_name: str,
                                args: DirectoryRoleAssignmentArgs,
                                opts: Optional[ResourceOptions] = None)
    
    @overload
    def DirectoryRoleAssignment(resource_name: str,
                                opts: Optional[ResourceOptions] = None,
                                principal_object_id: Optional[str] = None,
                                role_id: Optional[str] = None,
                                app_scope_id: Optional[str] = None,
                                app_scope_object_id: Optional[str] = None,
                                directory_scope_id: Optional[str] = None,
                                directory_scope_object_id: Optional[str] = None)
    func NewDirectoryRoleAssignment(ctx *Context, name string, args DirectoryRoleAssignmentArgs, opts ...ResourceOption) (*DirectoryRoleAssignment, error)
    public DirectoryRoleAssignment(string name, DirectoryRoleAssignmentArgs args, CustomResourceOptions? opts = null)
    public DirectoryRoleAssignment(String name, DirectoryRoleAssignmentArgs args)
    public DirectoryRoleAssignment(String name, DirectoryRoleAssignmentArgs args, CustomResourceOptions options)
    
    type: azuread:DirectoryRoleAssignment
    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 DirectoryRoleAssignmentArgs
    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 DirectoryRoleAssignmentArgs
    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 DirectoryRoleAssignmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DirectoryRoleAssignmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DirectoryRoleAssignmentArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var directoryRoleAssignmentResource = new AzureAD.DirectoryRoleAssignment("directoryRoleAssignmentResource", new()
    {
        PrincipalObjectId = "string",
        RoleId = "string",
        AppScopeId = "string",
        DirectoryScopeId = "string",
        DirectoryScopeObjectId = "string",
    });
    
    example, err := azuread.NewDirectoryRoleAssignment(ctx, "directoryRoleAssignmentResource", &azuread.DirectoryRoleAssignmentArgs{
    	PrincipalObjectId:      pulumi.String("string"),
    	RoleId:                 pulumi.String("string"),
    	AppScopeId:             pulumi.String("string"),
    	DirectoryScopeId:       pulumi.String("string"),
    	DirectoryScopeObjectId: pulumi.String("string"),
    })
    
    var directoryRoleAssignmentResource = new DirectoryRoleAssignment("directoryRoleAssignmentResource", DirectoryRoleAssignmentArgs.builder()        
        .principalObjectId("string")
        .roleId("string")
        .appScopeId("string")
        .directoryScopeId("string")
        .directoryScopeObjectId("string")
        .build());
    
    directory_role_assignment_resource = azuread.DirectoryRoleAssignment("directoryRoleAssignmentResource",
        principal_object_id="string",
        role_id="string",
        app_scope_id="string",
        directory_scope_id="string",
        directory_scope_object_id="string")
    
    const directoryRoleAssignmentResource = new azuread.DirectoryRoleAssignment("directoryRoleAssignmentResource", {
        principalObjectId: "string",
        roleId: "string",
        appScopeId: "string",
        directoryScopeId: "string",
        directoryScopeObjectId: "string",
    });
    
    type: azuread:DirectoryRoleAssignment
    properties:
        appScopeId: string
        directoryScopeId: string
        directoryScopeObjectId: string
        principalObjectId: string
        roleId: string
    

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

    PrincipalObjectId string
    The object ID of the principal for you want to create a role assignment. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    RoleId string
    The template ID (in the case of built-in roles) or object ID (in the case of custom roles) of the directory role you want to assign. Changing this forces a new resource to be created.
    AppScopeId string
    Identifier of the app-specific scope when the assignment scope is app-specific. Cannot be used with directory_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    AppScopeObjectId string
    Identifier of the app-specific scope when the assignment scope is app-specific

    Deprecated: app_scope_object_id has been renamed to app_scope_id and will be removed in version 3.0 or the AzureAD Provider

    DirectoryScopeId string
    Identifier of the directory object representing the scope of the assignment. Cannot be used with app_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    DirectoryScopeObjectId string
    Identifier of the directory object representing the scope of the assignment
    PrincipalObjectId string
    The object ID of the principal for you want to create a role assignment. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    RoleId string
    The template ID (in the case of built-in roles) or object ID (in the case of custom roles) of the directory role you want to assign. Changing this forces a new resource to be created.
    AppScopeId string
    Identifier of the app-specific scope when the assignment scope is app-specific. Cannot be used with directory_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    AppScopeObjectId string
    Identifier of the app-specific scope when the assignment scope is app-specific

    Deprecated: app_scope_object_id has been renamed to app_scope_id and will be removed in version 3.0 or the AzureAD Provider

    DirectoryScopeId string
    Identifier of the directory object representing the scope of the assignment. Cannot be used with app_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    DirectoryScopeObjectId string
    Identifier of the directory object representing the scope of the assignment
    principalObjectId String
    The object ID of the principal for you want to create a role assignment. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    roleId String
    The template ID (in the case of built-in roles) or object ID (in the case of custom roles) of the directory role you want to assign. Changing this forces a new resource to be created.
    appScopeId String
    Identifier of the app-specific scope when the assignment scope is app-specific. Cannot be used with directory_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    appScopeObjectId String
    Identifier of the app-specific scope when the assignment scope is app-specific

    Deprecated: app_scope_object_id has been renamed to app_scope_id and will be removed in version 3.0 or the AzureAD Provider

    directoryScopeId String
    Identifier of the directory object representing the scope of the assignment. Cannot be used with app_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    directoryScopeObjectId String
    Identifier of the directory object representing the scope of the assignment
    principalObjectId string
    The object ID of the principal for you want to create a role assignment. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    roleId string
    The template ID (in the case of built-in roles) or object ID (in the case of custom roles) of the directory role you want to assign. Changing this forces a new resource to be created.
    appScopeId string
    Identifier of the app-specific scope when the assignment scope is app-specific. Cannot be used with directory_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    appScopeObjectId string
    Identifier of the app-specific scope when the assignment scope is app-specific

    Deprecated: app_scope_object_id has been renamed to app_scope_id and will be removed in version 3.0 or the AzureAD Provider

    directoryScopeId string
    Identifier of the directory object representing the scope of the assignment. Cannot be used with app_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    directoryScopeObjectId string
    Identifier of the directory object representing the scope of the assignment
    principal_object_id str
    The object ID of the principal for you want to create a role assignment. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    role_id str
    The template ID (in the case of built-in roles) or object ID (in the case of custom roles) of the directory role you want to assign. Changing this forces a new resource to be created.
    app_scope_id str
    Identifier of the app-specific scope when the assignment scope is app-specific. Cannot be used with directory_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    app_scope_object_id str
    Identifier of the app-specific scope when the assignment scope is app-specific

    Deprecated: app_scope_object_id has been renamed to app_scope_id and will be removed in version 3.0 or the AzureAD Provider

    directory_scope_id str
    Identifier of the directory object representing the scope of the assignment. Cannot be used with app_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    directory_scope_object_id str
    Identifier of the directory object representing the scope of the assignment
    principalObjectId String
    The object ID of the principal for you want to create a role assignment. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    roleId String
    The template ID (in the case of built-in roles) or object ID (in the case of custom roles) of the directory role you want to assign. Changing this forces a new resource to be created.
    appScopeId String
    Identifier of the app-specific scope when the assignment scope is app-specific. Cannot be used with directory_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    appScopeObjectId String
    Identifier of the app-specific scope when the assignment scope is app-specific

    Deprecated: app_scope_object_id has been renamed to app_scope_id and will be removed in version 3.0 or the AzureAD Provider

    directoryScopeId String
    Identifier of the directory object representing the scope of the assignment. Cannot be used with app_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    directoryScopeObjectId String
    Identifier of the directory object representing the scope of the assignment

    Outputs

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

    Get an existing DirectoryRoleAssignment 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?: DirectoryRoleAssignmentState, opts?: CustomResourceOptions): DirectoryRoleAssignment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            app_scope_id: Optional[str] = None,
            app_scope_object_id: Optional[str] = None,
            directory_scope_id: Optional[str] = None,
            directory_scope_object_id: Optional[str] = None,
            principal_object_id: Optional[str] = None,
            role_id: Optional[str] = None) -> DirectoryRoleAssignment
    func GetDirectoryRoleAssignment(ctx *Context, name string, id IDInput, state *DirectoryRoleAssignmentState, opts ...ResourceOption) (*DirectoryRoleAssignment, error)
    public static DirectoryRoleAssignment Get(string name, Input<string> id, DirectoryRoleAssignmentState? state, CustomResourceOptions? opts = null)
    public static DirectoryRoleAssignment get(String name, Output<String> id, DirectoryRoleAssignmentState 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:
    AppScopeId string
    Identifier of the app-specific scope when the assignment scope is app-specific. Cannot be used with directory_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    AppScopeObjectId string
    Identifier of the app-specific scope when the assignment scope is app-specific

    Deprecated: app_scope_object_id has been renamed to app_scope_id and will be removed in version 3.0 or the AzureAD Provider

    DirectoryScopeId string
    Identifier of the directory object representing the scope of the assignment. Cannot be used with app_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    DirectoryScopeObjectId string
    Identifier of the directory object representing the scope of the assignment
    PrincipalObjectId string
    The object ID of the principal for you want to create a role assignment. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    RoleId string
    The template ID (in the case of built-in roles) or object ID (in the case of custom roles) of the directory role you want to assign. Changing this forces a new resource to be created.
    AppScopeId string
    Identifier of the app-specific scope when the assignment scope is app-specific. Cannot be used with directory_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    AppScopeObjectId string
    Identifier of the app-specific scope when the assignment scope is app-specific

    Deprecated: app_scope_object_id has been renamed to app_scope_id and will be removed in version 3.0 or the AzureAD Provider

    DirectoryScopeId string
    Identifier of the directory object representing the scope of the assignment. Cannot be used with app_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    DirectoryScopeObjectId string
    Identifier of the directory object representing the scope of the assignment
    PrincipalObjectId string
    The object ID of the principal for you want to create a role assignment. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    RoleId string
    The template ID (in the case of built-in roles) or object ID (in the case of custom roles) of the directory role you want to assign. Changing this forces a new resource to be created.
    appScopeId String
    Identifier of the app-specific scope when the assignment scope is app-specific. Cannot be used with directory_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    appScopeObjectId String
    Identifier of the app-specific scope when the assignment scope is app-specific

    Deprecated: app_scope_object_id has been renamed to app_scope_id and will be removed in version 3.0 or the AzureAD Provider

    directoryScopeId String
    Identifier of the directory object representing the scope of the assignment. Cannot be used with app_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    directoryScopeObjectId String
    Identifier of the directory object representing the scope of the assignment
    principalObjectId String
    The object ID of the principal for you want to create a role assignment. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    roleId String
    The template ID (in the case of built-in roles) or object ID (in the case of custom roles) of the directory role you want to assign. Changing this forces a new resource to be created.
    appScopeId string
    Identifier of the app-specific scope when the assignment scope is app-specific. Cannot be used with directory_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    appScopeObjectId string
    Identifier of the app-specific scope when the assignment scope is app-specific

    Deprecated: app_scope_object_id has been renamed to app_scope_id and will be removed in version 3.0 or the AzureAD Provider

    directoryScopeId string
    Identifier of the directory object representing the scope of the assignment. Cannot be used with app_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    directoryScopeObjectId string
    Identifier of the directory object representing the scope of the assignment
    principalObjectId string
    The object ID of the principal for you want to create a role assignment. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    roleId string
    The template ID (in the case of built-in roles) or object ID (in the case of custom roles) of the directory role you want to assign. Changing this forces a new resource to be created.
    app_scope_id str
    Identifier of the app-specific scope when the assignment scope is app-specific. Cannot be used with directory_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    app_scope_object_id str
    Identifier of the app-specific scope when the assignment scope is app-specific

    Deprecated: app_scope_object_id has been renamed to app_scope_id and will be removed in version 3.0 or the AzureAD Provider

    directory_scope_id str
    Identifier of the directory object representing the scope of the assignment. Cannot be used with app_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    directory_scope_object_id str
    Identifier of the directory object representing the scope of the assignment
    principal_object_id str
    The object ID of the principal for you want to create a role assignment. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    role_id str
    The template ID (in the case of built-in roles) or object ID (in the case of custom roles) of the directory role you want to assign. Changing this forces a new resource to be created.
    appScopeId String
    Identifier of the app-specific scope when the assignment scope is app-specific. Cannot be used with directory_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    appScopeObjectId String
    Identifier of the app-specific scope when the assignment scope is app-specific

    Deprecated: app_scope_object_id has been renamed to app_scope_id and will be removed in version 3.0 or the AzureAD Provider

    directoryScopeId String
    Identifier of the directory object representing the scope of the assignment. Cannot be used with app_scope_id. See official documentation for example usage. Changing this forces a new resource to be created.
    directoryScopeObjectId String
    Identifier of the directory object representing the scope of the assignment
    principalObjectId String
    The object ID of the principal for you want to create a role assignment. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    roleId String
    The template ID (in the case of built-in roles) or object ID (in the case of custom roles) of the directory role you want to assign. Changing this forces a new resource to be created.

    Import

    Directory role assignments can be imported using the ID of the assignment, e.g.

    $ pulumi import azuread:index/directoryRoleAssignment:DirectoryRoleAssignment example ePROZI_iKE653D_d6aoLHyr-lKgHI8ZGiIdz8CLVcng-1
    

    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) v5.48.0 published on Monday, Apr 15, 2024 by Pulumi