azuread.CustomDirectoryRole
Explore with Pulumi AI
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
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",
],
},
],
});
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=[
{
"allowed_resource_actions": [
"microsoft.directory/applications/basic/update",
"microsoft.directory/applications/create",
"microsoft.directory/applications/standard/read",
],
},
{
"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",
],
},
])
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 {
_, 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
})
}
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 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());
}
}
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
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new CustomDirectoryRole(name: string, args: CustomDirectoryRoleArgs, opts?: CustomResourceOptions);
@overload
def CustomDirectoryRole(resource_name: str,
args: CustomDirectoryRoleArgs,
opts: Optional[ResourceOptions] = None)
@overload
def CustomDirectoryRole(resource_name: str,
opts: Optional[ResourceOptions] = None,
display_name: Optional[str] = None,
enabled: Optional[bool] = None,
permissions: Optional[Sequence[CustomDirectoryRolePermissionArgs]] = None,
version: Optional[str] = None,
description: Optional[str] = None,
template_id: Optional[str] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var customDirectoryRoleResource = new AzureAD.CustomDirectoryRole("customDirectoryRoleResource", new()
{
DisplayName = "string",
Enabled = false,
Permissions = new[]
{
new AzureAD.Inputs.CustomDirectoryRolePermissionArgs
{
AllowedResourceActions = new[]
{
"string",
},
},
},
Version = "string",
Description = "string",
TemplateId = "string",
});
example, err := azuread.NewCustomDirectoryRole(ctx, "customDirectoryRoleResource", &azuread.CustomDirectoryRoleArgs{
DisplayName: pulumi.String("string"),
Enabled: pulumi.Bool(false),
Permissions: azuread.CustomDirectoryRolePermissionArray{
&azuread.CustomDirectoryRolePermissionArgs{
AllowedResourceActions: pulumi.StringArray{
pulumi.String("string"),
},
},
},
Version: pulumi.String("string"),
Description: pulumi.String("string"),
TemplateId: pulumi.String("string"),
})
var customDirectoryRoleResource = new CustomDirectoryRole("customDirectoryRoleResource", CustomDirectoryRoleArgs.builder()
.displayName("string")
.enabled(false)
.permissions(CustomDirectoryRolePermissionArgs.builder()
.allowedResourceActions("string")
.build())
.version("string")
.description("string")
.templateId("string")
.build());
custom_directory_role_resource = azuread.CustomDirectoryRole("customDirectoryRoleResource",
display_name="string",
enabled=False,
permissions=[{
"allowed_resource_actions": ["string"],
}],
version="string",
description="string",
template_id="string")
const customDirectoryRoleResource = new azuread.CustomDirectoryRole("customDirectoryRoleResource", {
displayName: "string",
enabled: false,
permissions: [{
allowedResourceActions: ["string"],
}],
version: "string",
description: "string",
templateId: "string",
});
type: azuread:CustomDirectoryRole
properties:
description: string
displayName: string
enabled: false
permissions:
- allowedResourceActions:
- string
templateId: string
version: string
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The CustomDirectoryRole resource accepts the following input properties:
- Display
Name string - The display name of the custom directory role.
- Enabled bool
- Indicates whether the role is enabled for assignment.
- Permissions
List<Pulumi.
Azure AD. Inputs. Custom Directory Role Permission> - 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.
- Template
Id 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 string - The display name of the custom directory role.
- Enabled bool
- Indicates whether the role is enabled for assignment.
- Permissions
[]Custom
Directory Role Permission Args - 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.
- Template
Id 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 String - The display name of the custom directory role.
- enabled Boolean
- Indicates whether the role is enabled for assignment.
- permissions
List<Custom
Directory Role Permission> - 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.
- template
Id 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 string - The display name of the custom directory role.
- enabled boolean
- Indicates whether the role is enabled for assignment.
- permissions
Custom
Directory Role Permission[] - 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.
- template
Id 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[Custom
Directory Role Permission Args] - 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.
- display
Name 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.
- template
Id 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:
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.
- Description string
- The description of the custom directory role.
- Display
Name string - The display name of the custom directory role.
- Enabled bool
- Indicates whether the role is enabled for assignment.
- Object
Id string - The object ID of the custom directory role.
- Permissions
List<Pulumi.
Azure AD. Inputs. Custom Directory Role Permission> - A collection of
permissions
blocks as documented below. - Template
Id 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.
- Display
Name string - The display name of the custom directory role.
- Enabled bool
- Indicates whether the role is enabled for assignment.
- Object
Id string - The object ID of the custom directory role.
- Permissions
[]Custom
Directory Role Permission Args - A collection of
permissions
blocks as documented below. - Template
Id 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.
- display
Name String - The display name of the custom directory role.
- enabled Boolean
- Indicates whether the role is enabled for assignment.
- object
Id String - The object ID of the custom directory role.
- permissions
List<Custom
Directory Role Permission> - A collection of
permissions
blocks as documented below. - template
Id 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.
- display
Name string - The display name of the custom directory role.
- enabled boolean
- Indicates whether the role is enabled for assignment.
- object
Id string - The object ID of the custom directory role.
- permissions
Custom
Directory Role Permission[] - A collection of
permissions
blocks as documented below. - template
Id 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[Custom
Directory Role Permission Args] - 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.
- display
Name String - The display name of the custom directory role.
- enabled Boolean
- Indicates whether the role is enabled for assignment.
- object
Id String - The object ID of the custom directory role.
- permissions List<Property Map>
- A collection of
permissions
blocks as documented below. - template
Id 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
- Allowed
Resource List<string>Actions - A set of tasks that can be performed on a resource. For more information, see the Permissions Reference documentation.
- Allowed
Resource []stringActions - A set of tasks that can be performed on a resource. For more information, see the Permissions Reference documentation.
- allowed
Resource List<String>Actions - A set of tasks that can be performed on a resource. For more information, see the Permissions Reference documentation.
- allowed
Resource string[]Actions - A set of tasks that can be performed on a resource. For more information, see the Permissions Reference documentation.
- allowed_
resource_ Sequence[str]actions - A set of tasks that can be performed on a resource. For more information, see the Permissions Reference documentation.
- allowed
Resource List<String>Actions - 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.
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.