1. Packages
  2. Azure Active Directory (Azure AD)
  3. API Docs
  4. CustomDirectoryRole
Azure Active Directory (Azure AD) v5.47.2 published on Tuesday, Feb 27, 2024 by Pulumi

azuread.CustomDirectoryRole

Explore with Pulumi AI

azuread logo
Azure Active Directory (Azure AD) v5.47.2 published on Tuesday, Feb 27, 2024 by Pulumi

    Manages a Custom Directory Role within Azure Active Directory.

    This resource is for managing custom directory roles. For management of built-in roles, see the azuread.DirectoryRole resource.

    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

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AzureAD = Pulumi.AzureAD;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new AzureAD.CustomDirectoryRole("example", new()
        {
            DisplayName = "My Custom Role",
            Description = "Allows reading applications and updating groups",
            Enabled = true,
            Version = "1.0",
            Permissions = new[]
            {
                new AzureAD.Inputs.CustomDirectoryRolePermissionArgs
                {
                    AllowedResourceActions = new[]
                    {
                        "microsoft.directory/applications/basic/update",
                        "microsoft.directory/applications/create",
                        "microsoft.directory/applications/standard/read",
                    },
                },
                new AzureAD.Inputs.CustomDirectoryRolePermissionArgs
                {
                    AllowedResourceActions = new[]
                    {
                        "microsoft.directory/groups/allProperties/read",
                        "microsoft.directory/groups/allProperties/read",
                        "microsoft.directory/groups/basic/update",
                        "microsoft.directory/groups/create",
                        "microsoft.directory/groups/delete",
                    },
                },
            },
        });
    
    });
    
    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 {
    		_, err := azuread.NewCustomDirectoryRole(ctx, "example", &azuread.CustomDirectoryRoleArgs{
    			DisplayName: pulumi.String("My Custom Role"),
    			Description: pulumi.String("Allows reading applications and updating groups"),
    			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/create"),
    						pulumi.String("microsoft.directory/applications/standard/read"),
    					},
    				},
    				&azuread.CustomDirectoryRolePermissionArgs{
    					AllowedResourceActions: pulumi.StringArray{
    						pulumi.String("microsoft.directory/groups/allProperties/read"),
    						pulumi.String("microsoft.directory/groups/allProperties/read"),
    						pulumi.String("microsoft.directory/groups/basic/update"),
    						pulumi.String("microsoft.directory/groups/create"),
    						pulumi.String("microsoft.directory/groups/delete"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azuread.CustomDirectoryRole;
    import com.pulumi.azuread.CustomDirectoryRoleArgs;
    import com.pulumi.azuread.inputs.CustomDirectoryRolePermissionArgs;
    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 example = new CustomDirectoryRole("example", CustomDirectoryRoleArgs.builder()        
                .displayName("My Custom Role")
                .description("Allows reading applications and updating groups")
                .enabled(true)
                .version("1.0")
                .permissions(            
                    CustomDirectoryRolePermissionArgs.builder()
                        .allowedResourceActions(                    
                            "microsoft.directory/applications/basic/update",
                            "microsoft.directory/applications/create",
                            "microsoft.directory/applications/standard/read")
                        .build(),
                    CustomDirectoryRolePermissionArgs.builder()
                        .allowedResourceActions(                    
                            "microsoft.directory/groups/allProperties/read",
                            "microsoft.directory/groups/allProperties/read",
                            "microsoft.directory/groups/basic/update",
                            "microsoft.directory/groups/create",
                            "microsoft.directory/groups/delete")
                        .build())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_azuread as azuread
    
    example = azuread.CustomDirectoryRole("example",
        display_name="My Custom Role",
        description="Allows reading applications and updating groups",
        enabled=True,
        version="1.0",
        permissions=[
            azuread.CustomDirectoryRolePermissionArgs(
                allowed_resource_actions=[
                    "microsoft.directory/applications/basic/update",
                    "microsoft.directory/applications/create",
                    "microsoft.directory/applications/standard/read",
                ],
            ),
            azuread.CustomDirectoryRolePermissionArgs(
                allowed_resource_actions=[
                    "microsoft.directory/groups/allProperties/read",
                    "microsoft.directory/groups/allProperties/read",
                    "microsoft.directory/groups/basic/update",
                    "microsoft.directory/groups/create",
                    "microsoft.directory/groups/delete",
                ],
            ),
        ])
    
    import * as pulumi from "@pulumi/pulumi";
    import * as azuread from "@pulumi/azuread";
    
    const example = new azuread.CustomDirectoryRole("example", {
        displayName: "My Custom Role",
        description: "Allows reading applications and updating groups",
        enabled: true,
        version: "1.0",
        permissions: [
            {
                allowedResourceActions: [
                    "microsoft.directory/applications/basic/update",
                    "microsoft.directory/applications/create",
                    "microsoft.directory/applications/standard/read",
                ],
            },
            {
                allowedResourceActions: [
                    "microsoft.directory/groups/allProperties/read",
                    "microsoft.directory/groups/allProperties/read",
                    "microsoft.directory/groups/basic/update",
                    "microsoft.directory/groups/create",
                    "microsoft.directory/groups/delete",
                ],
            },
        ],
    });
    
    resources:
      example:
        type: azuread:CustomDirectoryRole
        properties:
          displayName: My Custom Role
          description: Allows reading applications and updating groups
          enabled: true
          version: '1.0'
          permissions:
            - allowedResourceActions:
                - microsoft.directory/applications/basic/update
                - microsoft.directory/applications/create
                - microsoft.directory/applications/standard/read
            - allowedResourceActions:
                - microsoft.directory/groups/allProperties/read
                - microsoft.directory/groups/allProperties/read
                - microsoft.directory/groups/basic/update
                - microsoft.directory/groups/create
                - microsoft.directory/groups/delete
    

    Create CustomDirectoryRole Resource

    new CustomDirectoryRole(name: string, args: CustomDirectoryRoleArgs, opts?: CustomResourceOptions);
    @overload
    def CustomDirectoryRole(resource_name: str,
                            opts: Optional[ResourceOptions] = None,
                            description: Optional[str] = None,
                            display_name: Optional[str] = None,
                            enabled: Optional[bool] = None,
                            permissions: Optional[Sequence[CustomDirectoryRolePermissionArgs]] = None,
                            template_id: Optional[str] = None,
                            version: Optional[str] = None)
    @overload
    def CustomDirectoryRole(resource_name: str,
                            args: CustomDirectoryRoleArgs,
                            opts: Optional[ResourceOptions] = None)
    func NewCustomDirectoryRole(ctx *Context, name string, args CustomDirectoryRoleArgs, opts ...ResourceOption) (*CustomDirectoryRole, error)
    public CustomDirectoryRole(string name, CustomDirectoryRoleArgs args, CustomResourceOptions? opts = null)
    public CustomDirectoryRole(String name, CustomDirectoryRoleArgs args)
    public CustomDirectoryRole(String name, CustomDirectoryRoleArgs args, CustomResourceOptions options)
    
    type: azuread:CustomDirectoryRole
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args CustomDirectoryRoleArgs
    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 CustomDirectoryRoleArgs
    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 CustomDirectoryRoleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CustomDirectoryRoleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CustomDirectoryRoleArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    DisplayName string
    The display name of the custom directory role.
    Enabled bool
    Indicates whether the role is enabled for assignment.
    Permissions List<Pulumi.AzureAD.Inputs.CustomDirectoryRolePermission>
    A collection of permissions blocks as documented below.
    Version string
    The version of the role definition. This can be any arbitrary string between 1-128 characters.
    Description string
    The description of the custom directory role.
    TemplateId string
    Custom template identifier that is typically used if one needs an identifier to be the same across different directories. Changing this forces a new resource to be created.
    DisplayName string
    The display name of the custom directory role.
    Enabled bool
    Indicates whether the role is enabled for assignment.
    Permissions []CustomDirectoryRolePermissionArgs
    A collection of permissions blocks as documented below.
    Version string
    The version of the role definition. This can be any arbitrary string between 1-128 characters.
    Description string
    The description of the custom directory role.
    TemplateId string
    Custom template identifier that is typically used if one needs an identifier to be the same across different directories. Changing this forces a new resource to be created.
    displayName String
    The display name of the custom directory role.
    enabled Boolean
    Indicates whether the role is enabled for assignment.
    permissions List<CustomDirectoryRolePermission>
    A collection of permissions blocks as documented below.
    version String
    The version of the role definition. This can be any arbitrary string between 1-128 characters.
    description String
    The description of the custom directory role.
    templateId String
    Custom template identifier that is typically used if one needs an identifier to be the same across different directories. Changing this forces a new resource to be created.
    displayName string
    The display name of the custom directory role.
    enabled boolean
    Indicates whether the role is enabled for assignment.
    permissions CustomDirectoryRolePermission[]
    A collection of permissions blocks as documented below.
    version string
    The version of the role definition. This can be any arbitrary string between 1-128 characters.
    description string
    The description of the custom directory role.
    templateId string
    Custom template identifier that is typically used if one needs an identifier to be the same across different directories. Changing this forces a new resource to be created.
    display_name str
    The display name of the custom directory role.
    enabled bool
    Indicates whether the role is enabled for assignment.
    permissions Sequence[CustomDirectoryRolePermissionArgs]
    A collection of permissions blocks as documented below.
    version str
    The version of the role definition. This can be any arbitrary string between 1-128 characters.
    description str
    The description of the custom directory role.
    template_id str
    Custom template identifier that is typically used if one needs an identifier to be the same across different directories. Changing this forces a new resource to be created.
    displayName String
    The display name of the custom directory role.
    enabled Boolean
    Indicates whether the role is enabled for assignment.
    permissions List<Property Map>
    A collection of permissions blocks as documented below.
    version String
    The version of the role definition. This can be any arbitrary string between 1-128 characters.
    description String
    The description of the custom directory role.
    templateId String
    Custom template identifier that is typically used if one needs an identifier to be the same across different directories. Changing this forces a new resource to be created.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the CustomDirectoryRole resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    ObjectId string
    The object ID of the custom directory role.
    Id string
    The provider-assigned unique ID for this managed resource.
    ObjectId string
    The object ID of the custom directory role.
    id String
    The provider-assigned unique ID for this managed resource.
    objectId String
    The object ID of the custom directory role.
    id string
    The provider-assigned unique ID for this managed resource.
    objectId string
    The object ID of the custom directory role.
    id str
    The provider-assigned unique ID for this managed resource.
    object_id str
    The object ID of the custom directory role.
    id String
    The provider-assigned unique ID for this managed resource.
    objectId String
    The object ID of the custom directory role.

    Look up Existing CustomDirectoryRole Resource

    Get an existing CustomDirectoryRole 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?: CustomDirectoryRoleState, opts?: CustomResourceOptions): CustomDirectoryRole
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            display_name: Optional[str] = None,
            enabled: Optional[bool] = None,
            object_id: Optional[str] = None,
            permissions: Optional[Sequence[CustomDirectoryRolePermissionArgs]] = None,
            template_id: Optional[str] = None,
            version: Optional[str] = None) -> CustomDirectoryRole
    func GetCustomDirectoryRole(ctx *Context, name string, id IDInput, state *CustomDirectoryRoleState, opts ...ResourceOption) (*CustomDirectoryRole, error)
    public static CustomDirectoryRole Get(string name, Input<string> id, CustomDirectoryRoleState? state, CustomResourceOptions? opts = null)
    public static CustomDirectoryRole get(String name, Output<String> id, CustomDirectoryRoleState 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:
    Description string
    The description of the custom directory role.
    DisplayName string
    The display name of the custom directory role.
    Enabled bool
    Indicates whether the role is enabled for assignment.
    ObjectId string
    The object ID of the custom directory role.
    Permissions List<Pulumi.AzureAD.Inputs.CustomDirectoryRolePermission>
    A collection of permissions blocks as documented below.
    TemplateId string
    Custom template identifier that is typically used if one needs an identifier to be the same across different directories. Changing this forces a new resource to be created.
    Version string
    The version of the role definition. This can be any arbitrary string between 1-128 characters.
    Description string
    The description of the custom directory role.
    DisplayName string
    The display name of the custom directory role.
    Enabled bool
    Indicates whether the role is enabled for assignment.
    ObjectId string
    The object ID of the custom directory role.
    Permissions []CustomDirectoryRolePermissionArgs
    A collection of permissions blocks as documented below.
    TemplateId string
    Custom template identifier that is typically used if one needs an identifier to be the same across different directories. Changing this forces a new resource to be created.
    Version string
    The version of the role definition. This can be any arbitrary string between 1-128 characters.
    description String
    The description of the custom directory role.
    displayName String
    The display name of the custom directory role.
    enabled Boolean
    Indicates whether the role is enabled for assignment.
    objectId String
    The object ID of the custom directory role.
    permissions List<CustomDirectoryRolePermission>
    A collection of permissions blocks as documented below.
    templateId String
    Custom template identifier that is typically used if one needs an identifier to be the same across different directories. Changing this forces a new resource to be created.
    version String
    The version of the role definition. This can be any arbitrary string between 1-128 characters.
    description string
    The description of the custom directory role.
    displayName string
    The display name of the custom directory role.
    enabled boolean
    Indicates whether the role is enabled for assignment.
    objectId string
    The object ID of the custom directory role.
    permissions CustomDirectoryRolePermission[]
    A collection of permissions blocks as documented below.
    templateId string
    Custom template identifier that is typically used if one needs an identifier to be the same across different directories. Changing this forces a new resource to be created.
    version string
    The version of the role definition. This can be any arbitrary string between 1-128 characters.
    description str
    The description of the custom directory role.
    display_name str
    The display name of the custom directory role.
    enabled bool
    Indicates whether the role is enabled for assignment.
    object_id str
    The object ID of the custom directory role.
    permissions Sequence[CustomDirectoryRolePermissionArgs]
    A collection of permissions blocks as documented below.
    template_id str
    Custom template identifier that is typically used if one needs an identifier to be the same across different directories. Changing this forces a new resource to be created.
    version str
    The version of the role definition. This can be any arbitrary string between 1-128 characters.
    description String
    The description of the custom directory role.
    displayName String
    The display name of the custom directory role.
    enabled Boolean
    Indicates whether the role is enabled for assignment.
    objectId String
    The object ID of the custom directory role.
    permissions List<Property Map>
    A collection of permissions blocks as documented below.
    templateId String
    Custom template identifier that is typically used if one needs an identifier to be the same across different directories. Changing this forces a new resource to be created.
    version String
    The version of the role definition. This can be any arbitrary string between 1-128 characters.

    Supporting Types

    CustomDirectoryRolePermission, CustomDirectoryRolePermissionArgs

    AllowedResourceActions List<string>
    A set of tasks that can be performed on a resource. For more information, see the Permissions Reference documentation.
    AllowedResourceActions []string
    A set of tasks that can be performed on a resource. For more information, see the Permissions Reference documentation.
    allowedResourceActions List<String>
    A set of tasks that can be performed on a resource. For more information, see the Permissions Reference documentation.
    allowedResourceActions string[]
    A set of tasks that can be performed on a resource. For more information, see the Permissions Reference documentation.
    allowed_resource_actions Sequence[str]
    A set of tasks that can be performed on a resource. For more information, see the Permissions Reference documentation.
    allowedResourceActions List<String>
    A set of tasks that can be performed on a resource. For more information, see the Permissions Reference documentation.

    Import

    This resource does not support importing.

    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.47.2 published on Tuesday, Feb 27, 2024 by Pulumi