We recommend using Azure Native.
Azure v6.28.0 published on Friday, Oct 3, 2025 by Pulumi
azure.pim.getRoleAssignments
Use this data source to access information about existing Role Assignments.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const exampleResourceGroup = new azure.core.ResourceGroup("example", {
    name: "example",
    location: "West Europe",
});
const example = azure.pim.getRoleAssignmentsOutput({
    scope: exampleResourceGroup.id,
});
export const id = example.apply(example => example.roleAssignments);
import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("example",
    name="example",
    location="West Europe")
example = azure.pim.get_role_assignments_output(scope=example_resource_group.id)
pulumi.export("id", example.role_assignments)
package main
import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/pim"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleResourceGroup, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
			Name:     pulumi.String("example"),
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		example := pim.GetRoleAssignmentsOutput(ctx, pim.GetRoleAssignmentsOutputArgs{
			Scope: exampleResourceGroup.ID(),
		}, nil)
		ctx.Export("id", example.ApplyT(func(example pim.GetRoleAssignmentsResult) ([]pim.GetRoleAssignmentsRoleAssignment, error) {
			return []pim.GetRoleAssignmentsRoleAssignment(example.RoleAssignments), nil
		}).([]pim.GetRoleAssignmentsRoleAssignmentOutput))
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() => 
{
    var exampleResourceGroup = new Azure.Core.ResourceGroup("example", new()
    {
        Name = "example",
        Location = "West Europe",
    });
    var example = Azure.Pim.GetRoleAssignments.Invoke(new()
    {
        Scope = exampleResourceGroup.Id,
    });
    return new Dictionary<string, object?>
    {
        ["id"] = example.Apply(getRoleAssignmentsResult => getRoleAssignmentsResult.RoleAssignments),
    };
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.pim.PimFunctions;
import com.pulumi.azure.pim.inputs.GetRoleAssignmentsArgs;
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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
            .name("example")
            .location("West Europe")
            .build());
        final var example = PimFunctions.getRoleAssignments(GetRoleAssignmentsArgs.builder()
            .scope(exampleResourceGroup.id())
            .build());
        ctx.export("id", example.applyValue(_example -> _example.roleAssignments()));
    }
}
resources:
  exampleResourceGroup:
    type: azure:core:ResourceGroup
    name: example
    properties:
      name: example
      location: West Europe
variables:
  example:
    fn::invoke:
      function: azure:pim:getRoleAssignments
      arguments:
        scope: ${exampleResourceGroup.id}
outputs:
  id: ${example.roleAssignments}
API Providers
This data source uses the following Azure API Providers:
- Microsoft.Authorization- 2022-04-01
Using getRoleAssignments
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 getRoleAssignments(args: GetRoleAssignmentsArgs, opts?: InvokeOptions): Promise<GetRoleAssignmentsResult>
function getRoleAssignmentsOutput(args: GetRoleAssignmentsOutputArgs, opts?: InvokeOptions): Output<GetRoleAssignmentsResult>def get_role_assignments(limit_at_scope: Optional[bool] = None,
                         principal_id: Optional[str] = None,
                         scope: Optional[str] = None,
                         tenant_id: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> GetRoleAssignmentsResult
def get_role_assignments_output(limit_at_scope: Optional[pulumi.Input[bool]] = None,
                         principal_id: Optional[pulumi.Input[str]] = None,
                         scope: Optional[pulumi.Input[str]] = None,
                         tenant_id: Optional[pulumi.Input[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetRoleAssignmentsResult]func GetRoleAssignments(ctx *Context, args *GetRoleAssignmentsArgs, opts ...InvokeOption) (*GetRoleAssignmentsResult, error)
func GetRoleAssignmentsOutput(ctx *Context, args *GetRoleAssignmentsOutputArgs, opts ...InvokeOption) GetRoleAssignmentsResultOutput> Note: This function is named GetRoleAssignments in the Go SDK.
public static class GetRoleAssignments 
{
    public static Task<GetRoleAssignmentsResult> InvokeAsync(GetRoleAssignmentsArgs args, InvokeOptions? opts = null)
    public static Output<GetRoleAssignmentsResult> Invoke(GetRoleAssignmentsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetRoleAssignmentsResult> getRoleAssignments(GetRoleAssignmentsArgs args, InvokeOptions options)
public static Output<GetRoleAssignmentsResult> getRoleAssignments(GetRoleAssignmentsArgs args, InvokeOptions options)
fn::invoke:
  function: azure:pim/getRoleAssignments:getRoleAssignments
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Scope string
- The scope at which to list Role Assignments.
- LimitAt boolScope 
- Whether to limit the result exactly at the specified scope and not above or below it. Defaults to false.
- PrincipalId string
- The principal ID to filter the list of Role Assignments against.
- TenantId string
- The tenant ID for cross-tenant requests.
- Scope string
- The scope at which to list Role Assignments.
- LimitAt boolScope 
- Whether to limit the result exactly at the specified scope and not above or below it. Defaults to false.
- PrincipalId string
- The principal ID to filter the list of Role Assignments against.
- TenantId string
- The tenant ID for cross-tenant requests.
- scope String
- The scope at which to list Role Assignments.
- limitAt BooleanScope 
- Whether to limit the result exactly at the specified scope and not above or below it. Defaults to false.
- principalId String
- The principal ID to filter the list of Role Assignments against.
- tenantId String
- The tenant ID for cross-tenant requests.
- scope string
- The scope at which to list Role Assignments.
- limitAt booleanScope 
- Whether to limit the result exactly at the specified scope and not above or below it. Defaults to false.
- principalId string
- The principal ID to filter the list of Role Assignments against.
- tenantId string
- The tenant ID for cross-tenant requests.
- scope str
- The scope at which to list Role Assignments.
- limit_at_ boolscope 
- Whether to limit the result exactly at the specified scope and not above or below it. Defaults to false.
- principal_id str
- The principal ID to filter the list of Role Assignments against.
- tenant_id str
- The tenant ID for cross-tenant requests.
- scope String
- The scope at which to list Role Assignments.
- limitAt BooleanScope 
- Whether to limit the result exactly at the specified scope and not above or below it. Defaults to false.
- principalId String
- The principal ID to filter the list of Role Assignments against.
- tenantId String
- The tenant ID for cross-tenant requests.
getRoleAssignments Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- RoleAssignments List<GetRole Assignments Role Assignment> 
- A role_assignmentsblock as defined below.
- Scope string
- LimitAt boolScope 
- PrincipalId string
- The principal ID.
- TenantId string
- Id string
- The provider-assigned unique ID for this managed resource.
- RoleAssignments []GetRole Assignments Role Assignment 
- A role_assignmentsblock as defined below.
- Scope string
- LimitAt boolScope 
- PrincipalId string
- The principal ID.
- TenantId string
- id String
- The provider-assigned unique ID for this managed resource.
- roleAssignments List<GetRole Assignments Role Assignment> 
- A role_assignmentsblock as defined below.
- scope String
- limitAt BooleanScope 
- principalId String
- The principal ID.
- tenantId String
- id string
- The provider-assigned unique ID for this managed resource.
- roleAssignments GetRole Assignments Role Assignment[] 
- A role_assignmentsblock as defined below.
- scope string
- limitAt booleanScope 
- principalId string
- The principal ID.
- tenantId string
- id str
- The provider-assigned unique ID for this managed resource.
- role_assignments Sequence[GetRole Assignments Role Assignment] 
- A role_assignmentsblock as defined below.
- scope str
- limit_at_ boolscope 
- principal_id str
- The principal ID.
- tenant_id str
- id String
- The provider-assigned unique ID for this managed resource.
- roleAssignments List<Property Map>
- A role_assignmentsblock as defined below.
- scope String
- limitAt BooleanScope 
- principalId String
- The principal ID.
- tenantId String
Supporting Types
GetRoleAssignmentsRoleAssignment    
- Condition string
- The condition that limits the resource the role can be assigned to.
- ConditionVersion string
- The version of the condition.
- DelegatedManaged stringIdentity Resource Id 
- The ID of the delegated managed identity resource.
- Description string
- The description for this Role Assignment.
- PrincipalId string
- The principal ID to filter the list of Role Assignments against.
- PrincipalType string
- The type of the principal_id.
- RoleAssignment stringId 
- The ID of the Role Assignment.
- RoleAssignment stringName 
- The name of the Role Assignment.
- RoleAssignment stringScope 
- The scope of the Role Assignment.
- RoleDefinition stringId 
- The ID of the Role Definition.
- Condition string
- The condition that limits the resource the role can be assigned to.
- ConditionVersion string
- The version of the condition.
- DelegatedManaged stringIdentity Resource Id 
- The ID of the delegated managed identity resource.
- Description string
- The description for this Role Assignment.
- PrincipalId string
- The principal ID to filter the list of Role Assignments against.
- PrincipalType string
- The type of the principal_id.
- RoleAssignment stringId 
- The ID of the Role Assignment.
- RoleAssignment stringName 
- The name of the Role Assignment.
- RoleAssignment stringScope 
- The scope of the Role Assignment.
- RoleDefinition stringId 
- The ID of the Role Definition.
- condition String
- The condition that limits the resource the role can be assigned to.
- conditionVersion String
- The version of the condition.
- delegatedManaged StringIdentity Resource Id 
- The ID of the delegated managed identity resource.
- description String
- The description for this Role Assignment.
- principalId String
- The principal ID to filter the list of Role Assignments against.
- principalType String
- The type of the principal_id.
- roleAssignment StringId 
- The ID of the Role Assignment.
- roleAssignment StringName 
- The name of the Role Assignment.
- roleAssignment StringScope 
- The scope of the Role Assignment.
- roleDefinition StringId 
- The ID of the Role Definition.
- condition string
- The condition that limits the resource the role can be assigned to.
- conditionVersion string
- The version of the condition.
- delegatedManaged stringIdentity Resource Id 
- The ID of the delegated managed identity resource.
- description string
- The description for this Role Assignment.
- principalId string
- The principal ID to filter the list of Role Assignments against.
- principalType string
- The type of the principal_id.
- roleAssignment stringId 
- The ID of the Role Assignment.
- roleAssignment stringName 
- The name of the Role Assignment.
- roleAssignment stringScope 
- The scope of the Role Assignment.
- roleDefinition stringId 
- The ID of the Role Definition.
- condition str
- The condition that limits the resource the role can be assigned to.
- condition_version str
- The version of the condition.
- delegated_managed_ stridentity_ resource_ id 
- The ID of the delegated managed identity resource.
- description str
- The description for this Role Assignment.
- principal_id str
- The principal ID to filter the list of Role Assignments against.
- principal_type str
- The type of the principal_id.
- role_assignment_ strid 
- The ID of the Role Assignment.
- role_assignment_ strname 
- The name of the Role Assignment.
- role_assignment_ strscope 
- The scope of the Role Assignment.
- role_definition_ strid 
- The ID of the Role Definition.
- condition String
- The condition that limits the resource the role can be assigned to.
- conditionVersion String
- The version of the condition.
- delegatedManaged StringIdentity Resource Id 
- The ID of the delegated managed identity resource.
- description String
- The description for this Role Assignment.
- principalId String
- The principal ID to filter the list of Role Assignments against.
- principalType String
- The type of the principal_id.
- roleAssignment StringId 
- The ID of the Role Assignment.
- roleAssignment StringName 
- The name of the Role Assignment.
- roleAssignment StringScope 
- The scope of the Role Assignment.
- roleDefinition StringId 
- The ID of the Role Definition.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the azurermTerraform Provider.
