azuread.getDirectoryRoles
Explore with Pulumi AI
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);
import pulumi
import pulumi_azuread as azuread
current = azuread.get_directory_roles()
pulumi.export("roles", current.object_ids)
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
})
}
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),
};
});
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()));
}
}
variables:
current:
fn::invoke:
Function: azuread:getDirectoryRoles
Arguments: {}
outputs:
roles: ${current.objectIds}
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>
def get_directory_roles(opts: Optional[InvokeOptions] = None) -> GetDirectoryRolesResult
def get_directory_roles_output(opts: Optional[InvokeOptions] = None) -> Output[GetDirectoryRolesResult]
func GetDirectoryRoles(ctx *Context, opts ...InvokeOption) (*GetDirectoryRolesResult, error)
func GetDirectoryRolesOutput(ctx *Context, opts ...InvokeOption) GetDirectoryRolesResultOutput
> 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)
}
public static CompletableFuture<GetDirectoryRolesResult> getDirectoryRoles(InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: azuread:index/getDirectoryRoles:getDirectoryRoles
arguments:
# arguments dictionary
getDirectoryRoles Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Object
Ids List<string> - The object IDs of the roles.
- Roles
List<Pulumi.
Azure AD. Outputs. Get Directory Roles Role> - A list of users. Each
role
object provides the attributes documented below. - Template
Ids List<string> - The template IDs of the roles.
- Id string
- The provider-assigned unique ID for this managed resource.
- Object
Ids []string - The object IDs of the roles.
- Roles
[]Get
Directory Roles Role - A list of users. Each
role
object provides the attributes documented below. - Template
Ids []string - The template IDs of the roles.
- id String
- The provider-assigned unique ID for this managed resource.
- object
Ids List<String> - The object IDs of the roles.
- roles
List<Get
Directory Roles Role> - A list of users. Each
role
object provides the attributes documented below. - template
Ids List<String> - The template IDs of the roles.
- id string
- The provider-assigned unique ID for this managed resource.
- object
Ids string[] - The object IDs of the roles.
- roles
Get
Directory Roles Role[] - A list of users. Each
role
object provides the attributes documented below. - template
Ids 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[Get
Directory Roles Role] - 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.
- object
Ids List<String> - The object IDs of the roles.
- roles List<Property Map>
- A list of users. Each
role
object provides the attributes documented below. - template
Ids List<String> - The template IDs of the roles.
Supporting Types
GetDirectoryRolesRole
- Description string
- The description of the directory role.
- Display
Name string - The display name of the directory role.
- Object
Id string - The object ID of the directory role.
- Template
Id string - The template ID of the directory role.
- Description string
- The description of the directory role.
- Display
Name string - The display name of the directory role.
- Object
Id string - The object ID of the directory role.
- Template
Id string - The template ID of the directory role.
- description String
- The description of the directory role.
- display
Name String - The display name of the directory role.
- object
Id String - The object ID of the directory role.
- template
Id String - The template ID of the directory role.
- description string
- The description of the directory role.
- display
Name string - The display name of the directory role.
- object
Id string - The object ID of the directory role.
- template
Id string - The template ID of the directory role.
- description str
- The description of the directory role.
- display_
name str - The display name of the directory role.
- object_
id str - The object ID of the directory role.
- template_
id str - The template ID of the directory role.
- description String
- The description of the directory role.
- display
Name String - The display name of the directory role.
- object
Id String - The object ID of the directory role.
- template
Id 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.