1. Packages
  2. Azure Active Directory (Azure AD)
  3. API Docs
  4. getDirectoryRoles
Azure Active Directory (Azure AD) v6.4.0 published on Monday, Apr 7, 2025 by Pulumi

azuread.getDirectoryRoles

Explore with Pulumi AI

Azure Active Directory (Azure AD) v6.4.0 published on Monday, Apr 7, 2025 by Pulumi

Use this data source to access information about activated directory roles 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.Read.Directory or Directory.Read.All

When authenticated with a user principal, this data source does not require any additional roles.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azuread from "@pulumi/azuread";

const current = azuread.getDirectoryRoles({});
export const roles = current.then(current => current.objectIds);
Copy
import pulumi
import pulumi_azuread as azuread

current = azuread.get_directory_roles()
pulumi.export("roles", current.object_ids)
Copy
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 {
		current, err := azuread.GetDirectoryRoles(ctx, map[string]interface{}{}, nil)
		if err != nil {
			return err
		}
		ctx.Export("roles", current.ObjectIds)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureAD = Pulumi.AzureAD;

return await Deployment.RunAsync(() => 
{
    var current = AzureAD.GetDirectoryRoles.Invoke();

    return new Dictionary<string, object?>
    {
        ["roles"] = current.Apply(getDirectoryRolesResult => getDirectoryRolesResult.ObjectIds),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azuread.AzureadFunctions;
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 current = AzureadFunctions.getDirectoryRoles();

        ctx.export("roles", current.applyValue(getDirectoryRolesResult -> getDirectoryRolesResult.objectIds()));
    }
}
Copy
variables:
  current:
    fn::invoke:
      function: azuread:getDirectoryRoles
      arguments: {}
outputs:
  roles: ${current.objectIds}
Copy

Using getDirectoryRoles

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getDirectoryRoles(opts?: InvokeOptions): Promise<GetDirectoryRolesResult>
function getDirectoryRolesOutput(opts?: InvokeOptions): Output<GetDirectoryRolesResult>
Copy
def get_directory_roles(opts: Optional[InvokeOptions] = None) -> GetDirectoryRolesResult
def get_directory_roles_output(opts: Optional[InvokeOptions] = None) -> Output[GetDirectoryRolesResult]
Copy
func GetDirectoryRoles(ctx *Context, opts ...InvokeOption) (*GetDirectoryRolesResult, error)
func GetDirectoryRolesOutput(ctx *Context, opts ...InvokeOption) GetDirectoryRolesResultOutput
Copy

> Note: This function is named GetDirectoryRoles in the Go SDK.

public static class GetDirectoryRoles 
{
    public static Task<GetDirectoryRolesResult> InvokeAsync(InvokeOptions? opts = null)
    public static Output<GetDirectoryRolesResult> Invoke(InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetDirectoryRolesResult> getDirectoryRoles(InvokeOptions options)
public static Output<GetDirectoryRolesResult> getDirectoryRoles(InvokeOptions options)
Copy
fn::invoke:
  function: azuread:index/getDirectoryRoles:getDirectoryRoles
  arguments:
    # arguments dictionary
Copy

getDirectoryRoles Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
ObjectIds List<string>
The object IDs of the roles.
Roles List<Pulumi.AzureAD.Outputs.GetDirectoryRolesRole>
A list of users. Each role object provides the attributes documented below.
TemplateIds List<string>
The template IDs of the roles.
Id string
The provider-assigned unique ID for this managed resource.
ObjectIds []string
The object IDs of the roles.
Roles []GetDirectoryRolesRole
A list of users. Each role object provides the attributes documented below.
TemplateIds []string
The template IDs of the roles.
id String
The provider-assigned unique ID for this managed resource.
objectIds List<String>
The object IDs of the roles.
roles List<GetDirectoryRolesRole>
A list of users. Each role object provides the attributes documented below.
templateIds List<String>
The template IDs of the roles.
id string
The provider-assigned unique ID for this managed resource.
objectIds string[]
The object IDs of the roles.
roles GetDirectoryRolesRole[]
A list of users. Each role object provides the attributes documented below.
templateIds string[]
The template IDs of the roles.
id str
The provider-assigned unique ID for this managed resource.
object_ids Sequence[str]
The object IDs of the roles.
roles Sequence[GetDirectoryRolesRole]
A list of users. Each role object provides the attributes documented below.
template_ids Sequence[str]
The template IDs of the roles.
id String
The provider-assigned unique ID for this managed resource.
objectIds List<String>
The object IDs of the roles.
roles List<Property Map>
A list of users. Each role object provides the attributes documented below.
templateIds List<String>
The template IDs of the roles.

Supporting Types

GetDirectoryRolesRole

Description This property is required. string
The description of the directory role.
DisplayName This property is required. string
The display name of the directory role.
ObjectId This property is required. string
The object ID of the directory role.
TemplateId This property is required. string
The template ID of the directory role.
Description This property is required. string
The description of the directory role.
DisplayName This property is required. string
The display name of the directory role.
ObjectId This property is required. string
The object ID of the directory role.
TemplateId This property is required. string
The template ID of the directory role.
description This property is required. String
The description of the directory role.
displayName This property is required. String
The display name of the directory role.
objectId This property is required. String
The object ID of the directory role.
templateId This property is required. String
The template ID of the directory role.
description This property is required. string
The description of the directory role.
displayName This property is required. string
The display name of the directory role.
objectId This property is required. string
The object ID of the directory role.
templateId This property is required. string
The template ID of the directory role.
description This property is required. str
The description of the directory role.
display_name This property is required. str
The display name of the directory role.
object_id This property is required. str
The object ID of the directory role.
template_id This property is required. str
The template ID of the directory role.
description This property is required. String
The description of the directory role.
displayName This property is required. String
The display name of the directory role.
objectId This property is required. String
The object ID of the directory role.
templateId This property is required. String
The template ID of the directory role.

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.
Azure Active Directory (Azure AD) v6.4.0 published on Monday, Apr 7, 2025 by Pulumi