Auth0 v3.16.0 published on Wednesday, Mar 12, 2025 by Pulumi
auth0.getRole
Explore with Pulumi AI
Data source to retrieve a specific Auth0 role by role_id or name.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as auth0 from "@pulumi/auth0";
// An Auth0 Role loaded using its name.
const some_role_by_name = auth0.getRole({
    name: "my-role",
});
// An Auth0 Role loaded using its ID.
const some_role_by_id = auth0.getRole({
    roleId: "abcdefghkijklmnopqrstuvwxyz0123456789",
});
import pulumi
import pulumi_auth0 as auth0
# An Auth0 Role loaded using its name.
some_role_by_name = auth0.get_role(name="my-role")
# An Auth0 Role loaded using its ID.
some_role_by_id = auth0.get_role(role_id="abcdefghkijklmnopqrstuvwxyz0123456789")
package main
import (
	"github.com/pulumi/pulumi-auth0/sdk/v3/go/auth0"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// An Auth0 Role loaded using its name.
		_, err := auth0.LookupRole(ctx, &auth0.LookupRoleArgs{
			Name: pulumi.StringRef("my-role"),
		}, nil)
		if err != nil {
			return err
		}
		// An Auth0 Role loaded using its ID.
		_, err = auth0.LookupRole(ctx, &auth0.LookupRoleArgs{
			RoleId: pulumi.StringRef("abcdefghkijklmnopqrstuvwxyz0123456789"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Auth0 = Pulumi.Auth0;
return await Deployment.RunAsync(() => 
{
    // An Auth0 Role loaded using its name.
    var some_role_by_name = Auth0.GetRole.Invoke(new()
    {
        Name = "my-role",
    });
    // An Auth0 Role loaded using its ID.
    var some_role_by_id = Auth0.GetRole.Invoke(new()
    {
        RoleId = "abcdefghkijklmnopqrstuvwxyz0123456789",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.auth0.Auth0Functions;
import com.pulumi.auth0.inputs.GetRoleArgs;
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) {
        // An Auth0 Role loaded using its name.
        final var some-role-by-name = Auth0Functions.getRole(GetRoleArgs.builder()
            .name("my-role")
            .build());
        // An Auth0 Role loaded using its ID.
        final var some-role-by-id = Auth0Functions.getRole(GetRoleArgs.builder()
            .roleId("abcdefghkijklmnopqrstuvwxyz0123456789")
            .build());
    }
}
variables:
  # An Auth0 Role loaded using its name.
  some-role-by-name:
    fn::invoke:
      function: auth0:getRole
      arguments:
        name: my-role
  # An Auth0 Role loaded using its ID.
  some-role-by-id:
    fn::invoke:
      function: auth0:getRole
      arguments:
        roleId: abcdefghkijklmnopqrstuvwxyz0123456789
Using getRole
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 getRole(args: GetRoleArgs, opts?: InvokeOptions): Promise<GetRoleResult>
function getRoleOutput(args: GetRoleOutputArgs, opts?: InvokeOptions): Output<GetRoleResult>def get_role(name: Optional[str] = None,
             role_id: Optional[str] = None,
             opts: Optional[InvokeOptions] = None) -> GetRoleResult
def get_role_output(name: Optional[pulumi.Input[str]] = None,
             role_id: Optional[pulumi.Input[str]] = None,
             opts: Optional[InvokeOptions] = None) -> Output[GetRoleResult]func LookupRole(ctx *Context, args *LookupRoleArgs, opts ...InvokeOption) (*LookupRoleResult, error)
func LookupRoleOutput(ctx *Context, args *LookupRoleOutputArgs, opts ...InvokeOption) LookupRoleResultOutput> Note: This function is named LookupRole in the Go SDK.
public static class GetRole 
{
    public static Task<GetRoleResult> InvokeAsync(GetRoleArgs args, InvokeOptions? opts = null)
    public static Output<GetRoleResult> Invoke(GetRoleInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetRoleResult> getRole(GetRoleArgs args, InvokeOptions options)
public static Output<GetRoleResult> getRole(GetRoleArgs args, InvokeOptions options)
fn::invoke:
  function: auth0:index/getRole:getRole
  arguments:
    # arguments dictionaryThe following arguments are supported:
getRole Result
The following output properties are available:
- Description string
- The description of the role.
- Id string
- The provider-assigned unique ID for this managed resource.
- Permissions
List<GetRole Permission> 
- Configuration settings for permissions (scopes) attached to the role.
- Users List<string>
- List of user IDs assigned to this role. Retrieves a maximum of 1000 user IDs.
- Name string
- The name of the role. If not provided, role_idmust be set.
- RoleId string
- The ID of the role. If not provided, namemust be set.
- Description string
- The description of the role.
- Id string
- The provider-assigned unique ID for this managed resource.
- Permissions
[]GetRole Permission Type 
- Configuration settings for permissions (scopes) attached to the role.
- Users []string
- List of user IDs assigned to this role. Retrieves a maximum of 1000 user IDs.
- Name string
- The name of the role. If not provided, role_idmust be set.
- RoleId string
- The ID of the role. If not provided, namemust be set.
- description String
- The description of the role.
- id String
- The provider-assigned unique ID for this managed resource.
- permissions
List<GetRole Permission> 
- Configuration settings for permissions (scopes) attached to the role.
- users List<String>
- List of user IDs assigned to this role. Retrieves a maximum of 1000 user IDs.
- name String
- The name of the role. If not provided, role_idmust be set.
- roleId String
- The ID of the role. If not provided, namemust be set.
- description string
- The description of the role.
- id string
- The provider-assigned unique ID for this managed resource.
- permissions
GetRole Permission[] 
- Configuration settings for permissions (scopes) attached to the role.
- users string[]
- List of user IDs assigned to this role. Retrieves a maximum of 1000 user IDs.
- name string
- The name of the role. If not provided, role_idmust be set.
- roleId string
- The ID of the role. If not provided, namemust be set.
- description str
- The description of the role.
- id str
- The provider-assigned unique ID for this managed resource.
- permissions
Sequence[GetRole Permission] 
- Configuration settings for permissions (scopes) attached to the role.
- users Sequence[str]
- List of user IDs assigned to this role. Retrieves a maximum of 1000 user IDs.
- name str
- The name of the role. If not provided, role_idmust be set.
- role_id str
- The ID of the role. If not provided, namemust be set.
- description String
- The description of the role.
- id String
- The provider-assigned unique ID for this managed resource.
- permissions List<Property Map>
- Configuration settings for permissions (scopes) attached to the role.
- users List<String>
- List of user IDs assigned to this role. Retrieves a maximum of 1000 user IDs.
- name String
- The name of the role. If not provided, role_idmust be set.
- roleId String
- The ID of the role. If not provided, namemust be set.
Supporting Types
GetRolePermission  
- Description string
- Description of the permission.
- Name string
- Name of the permission (scope) configured on the resource server (API).
- ResourceServer stringIdentifier 
- Unique identifier for the resource server (API).
- ResourceServer stringName 
- Name of resource server (API) that the permission is associated with.
- Description string
- Description of the permission.
- Name string
- Name of the permission (scope) configured on the resource server (API).
- ResourceServer stringIdentifier 
- Unique identifier for the resource server (API).
- ResourceServer stringName 
- Name of resource server (API) that the permission is associated with.
- description String
- Description of the permission.
- name String
- Name of the permission (scope) configured on the resource server (API).
- resourceServer StringIdentifier 
- Unique identifier for the resource server (API).
- resourceServer StringName 
- Name of resource server (API) that the permission is associated with.
- description string
- Description of the permission.
- name string
- Name of the permission (scope) configured on the resource server (API).
- resourceServer stringIdentifier 
- Unique identifier for the resource server (API).
- resourceServer stringName 
- Name of resource server (API) that the permission is associated with.
- description str
- Description of the permission.
- name str
- Name of the permission (scope) configured on the resource server (API).
- resource_server_ stridentifier 
- Unique identifier for the resource server (API).
- resource_server_ strname 
- Name of resource server (API) that the permission is associated with.
- description String
- Description of the permission.
- name String
- Name of the permission (scope) configured on the resource server (API).
- resourceServer StringIdentifier 
- Unique identifier for the resource server (API).
- resourceServer StringName 
- Name of resource server (API) that the permission is associated with.
Package Details
- Repository
- Auth0 pulumi/pulumi-auth0
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the auth0Terraform Provider.