AzureAD

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

DirectoryRole

Manages a Directory Role within Azure Active Directory. Directory Roles are also known as Administrator Roles.

Directory Roles are built-in to Azure Active Directory and are immutable. However, by default they are not activated in a tenant (except for the Global Administrator role). This resource ensures a directory role is activated from its associated role template, and exports the object ID of the role, so that role assignments can be made for it.

Once activated, directory roles cannot be deactivated and so this resource does not perform any actions on destroy.

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 Pulumi;
using AzureAD = Pulumi.AzureAD;

class MyStack : Stack
{
    public MyStack()
    {
        var example = new AzureAD.DirectoryRole("example", new AzureAD.DirectoryRoleArgs
        {
            TemplateId = "00000000-0000-0000-0000-000000000000",
        });
    }

}
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.NewDirectoryRole(ctx, "example", &azuread.DirectoryRoleArgs{
			TemplateId: pulumi.String("00000000-0000-0000-0000-000000000000"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

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

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

    public static void stack(Context ctx) {
        var example = new DirectoryRole("example", DirectoryRoleArgs.builder()        
            .templateId("00000000-0000-0000-0000-000000000000")
            .build());

        }
}
import pulumi
import pulumi_azuread as azuread

example = azuread.DirectoryRole("example", template_id="00000000-0000-0000-0000-000000000000")
import * as pulumi from "@pulumi/pulumi";
import * as azuread from "@pulumi/azuread";

const example = new azuread.DirectoryRole("example", {
    templateId: "00000000-0000-0000-0000-000000000000",
});
resources:
  example:
    type: azuread:DirectoryRole
    properties:
      templateId: 00000000-0000-0000-0000-000000000000

Create a DirectoryRole Resource

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

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

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

DisplayName string

The display name of the directory role to activate. Changing this forces a new resource to be created.

TemplateId string

The object ID of the role template from which to activate the directory role. Changing this forces a new resource to be created.

DisplayName string

The display name of the directory role to activate. Changing this forces a new resource to be created.

TemplateId string

The object ID of the role template from which to activate the directory role. Changing this forces a new resource to be created.

displayName String

The display name of the directory role to activate. Changing this forces a new resource to be created.

templateId String

The object ID of the role template from which to activate the directory role. Changing this forces a new resource to be created.

displayName string

The display name of the directory role to activate. Changing this forces a new resource to be created.

templateId string

The object ID of the role template from which to activate the directory role. Changing this forces a new resource to be created.

display_name str

The display name of the directory role to activate. Changing this forces a new resource to be created.

template_id str

The object ID of the role template from which to activate the directory role. Changing this forces a new resource to be created.

displayName String

The display name of the directory role to activate. Changing this forces a new resource to be created.

templateId String

The object ID of the role template from which to activate the directory role. Changing this forces a new resource to be created.

Outputs

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

Description string

The description of the directory role.

Id string

The provider-assigned unique ID for this managed resource.

ObjectId string

The object ID of the directory role.

Description string

The description of the directory role.

Id string

The provider-assigned unique ID for this managed resource.

ObjectId string

The object ID of the directory role.

description String

The description of the directory role.

id String

The provider-assigned unique ID for this managed resource.

objectId String

The object ID of the directory role.

description string

The description of the directory role.

id string

The provider-assigned unique ID for this managed resource.

objectId string

The object ID of the directory role.

description str

The description of the directory role.

id str

The provider-assigned unique ID for this managed resource.

object_id str

The object ID of the directory role.

description String

The description of the directory role.

id String

The provider-assigned unique ID for this managed resource.

objectId String

The object ID of the directory role.

Look up an Existing DirectoryRole Resource

Get an existing DirectoryRole 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?: DirectoryRoleState, opts?: CustomResourceOptions): DirectoryRole
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        description: Optional[str] = None,
        display_name: Optional[str] = None,
        object_id: Optional[str] = None,
        template_id: Optional[str] = None) -> DirectoryRole
func GetDirectoryRole(ctx *Context, name string, id IDInput, state *DirectoryRoleState, opts ...ResourceOption) (*DirectoryRole, error)
public static DirectoryRole Get(string name, Input<string> id, DirectoryRoleState? state, CustomResourceOptions? opts = null)
public static DirectoryRole get(String name, Output<String> id, DirectoryRoleState 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 directory role.

DisplayName string

The display name of the directory role to activate. Changing this forces a new resource to be created.

ObjectId string

The object ID of the directory role.

TemplateId string

The object ID of the role template from which to activate the directory role. Changing this forces a new resource to be created.

Description string

The description of the directory role.

DisplayName string

The display name of the directory role to activate. Changing this forces a new resource to be created.

ObjectId string

The object ID of the directory role.

TemplateId string

The object ID of the role template from which to activate the directory role. Changing this forces a new resource to be created.

description String

The description of the directory role.

displayName String

The display name of the directory role to activate. Changing this forces a new resource to be created.

objectId String

The object ID of the directory role.

templateId String

The object ID of the role template from which to activate the directory role. Changing this forces a new resource to be created.

description string

The description of the directory role.

displayName string

The display name of the directory role to activate. Changing this forces a new resource to be created.

objectId string

The object ID of the directory role.

templateId string

The object ID of the role template from which to activate the directory role. Changing this forces a new resource to be created.

description str

The description of the directory role.

display_name str

The display name of the directory role to activate. Changing this forces a new resource to be created.

object_id str

The object ID of the directory role.

template_id str

The object ID of the role template from which to activate the directory role. Changing this forces a new resource to be created.

description String

The description of the directory role.

displayName String

The display name of the directory role to activate. Changing this forces a new resource to be created.

objectId String

The object ID of the directory role.

templateId String

The object ID of the role template from which to activate the directory role. Changing this forces a new resource to be created.

Import

This resource does not support importing.

Package Details

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

This Pulumi package is based on the azuread Terraform Provider.