1. Packages
  2. Azure Active Directory (Azure AD)
  3. API Docs
  4. getDirectoryRoles
Azure Active Directory (Azure AD) v6.0.1 published on Monday, Oct 14, 2024 by Pulumi

azuread.getDirectoryRoles

Explore with Pulumi AI

azuread logo
Azure Active Directory (Azure AD) v6.0.1 published on Monday, Oct 14, 2024 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);
    
    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.
    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 string
    The description of the directory role.
    DisplayName string
    The display name of the directory role.
    ObjectId string
    The object ID of the directory role.
    TemplateId string
    The template ID of the directory role.
    Description string
    The description of the directory role.
    DisplayName string
    The display name of the directory role.
    ObjectId string
    The object ID of the directory role.
    TemplateId string
    The template ID of the directory role.
    description String
    The description of the directory role.
    displayName String
    The display name of the directory role.
    objectId String
    The object ID of the directory role.
    templateId String
    The template ID of the directory role.
    description string
    The description of the directory role.
    displayName string
    The display name of the directory role.
    objectId string
    The object ID of the directory role.
    templateId 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.
    displayName String
    The display name of the directory role.
    objectId String
    The object ID of the directory role.
    templateId 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.
    azuread logo
    Azure Active Directory (Azure AD) v6.0.1 published on Monday, Oct 14, 2024 by Pulumi