published on Monday, Mar 9, 2026 by Pulumi
published on Monday, Mar 9, 2026 by Pulumi
With this resource, you can create and manage collections of permissions that can be assigned to users, which are otherwise known as roles. Permissions (scopes) are created on auth0.ResourceServer, then associated with roles and optionally, users using this resource.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Auth0 = Pulumi.Auth0;
return await Deployment.RunAsync(() =>
{
var myResourceServer = new Auth0.ResourceServer("myResourceServer", new()
{
Identifier = "my-resource-server-identifier",
SigningAlg = "RS256",
TokenLifetime = 86400,
SkipConsentForVerifiableFirstPartyClients = true,
EnforcePolicies = true,
Scopes = new[]
{
new Auth0.Inputs.ResourceServerScopeArgs
{
Value = "read:something",
Description = "read something",
},
},
});
var myRole = new Auth0.Role("myRole", new()
{
Description = "Role Description...",
Permissions = new[]
{
new Auth0.Inputs.RolePermissionArgs
{
ResourceServerIdentifier = myResourceServer.Identifier,
Name = "read:something",
},
},
});
var myUser = new Auth0.User("myUser", new()
{
ConnectionName = "Username-Password-Authentication",
UserId = "auth0|1234567890",
Email = "test@test.com",
Password = "passpass$12$12",
Nickname = "testnick",
Username = "testnick",
Roles = new[]
{
myRole.Id,
},
});
});
package main
import (
"github.com/pulumi/pulumi-auth0/sdk/v2/go/auth0"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
myResourceServer, err := auth0.NewResourceServer(ctx, "myResourceServer", &auth0.ResourceServerArgs{
Identifier: pulumi.String("my-resource-server-identifier"),
SigningAlg: pulumi.String("RS256"),
TokenLifetime: pulumi.Int(86400),
SkipConsentForVerifiableFirstPartyClients: pulumi.Bool(true),
EnforcePolicies: pulumi.Bool(true),
Scopes: auth0.ResourceServerScopeTypeArray{
&auth0.ResourceServerScopeTypeArgs{
Value: pulumi.String("read:something"),
Description: pulumi.String("read something"),
},
},
})
if err != nil {
return err
}
myRole, err := auth0.NewRole(ctx, "myRole", &auth0.RoleArgs{
Description: pulumi.String("Role Description..."),
Permissions: auth0.RolePermissionTypeArray{
&auth0.RolePermissionTypeArgs{
ResourceServerIdentifier: myResourceServer.Identifier,
Name: pulumi.String("read:something"),
},
},
})
if err != nil {
return err
}
_, err = auth0.NewUser(ctx, "myUser", &auth0.UserArgs{
ConnectionName: pulumi.String("Username-Password-Authentication"),
UserId: pulumi.String("auth0|1234567890"),
Email: pulumi.String("test@test.com"),
Password: pulumi.String("passpass$12$12"),
Nickname: pulumi.String("testnick"),
Username: pulumi.String("testnick"),
Roles: pulumi.StringArray{
myRole.ID(),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.auth0.ResourceServer;
import com.pulumi.auth0.ResourceServerArgs;
import com.pulumi.auth0.inputs.ResourceServerScopeArgs;
import com.pulumi.auth0.Role;
import com.pulumi.auth0.RoleArgs;
import com.pulumi.auth0.inputs.RolePermissionArgs;
import com.pulumi.auth0.User;
import com.pulumi.auth0.UserArgs;
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 myResourceServer = new ResourceServer("myResourceServer", ResourceServerArgs.builder()
.identifier("my-resource-server-identifier")
.signingAlg("RS256")
.tokenLifetime(86400)
.skipConsentForVerifiableFirstPartyClients(true)
.enforcePolicies(true)
.scopes(ResourceServerScopeArgs.builder()
.value("read:something")
.description("read something")
.build())
.build());
var myRole = new Role("myRole", RoleArgs.builder()
.description("Role Description...")
.permissions(RolePermissionArgs.builder()
.resourceServerIdentifier(myResourceServer.identifier())
.name("read:something")
.build())
.build());
var myUser = new User("myUser", UserArgs.builder()
.connectionName("Username-Password-Authentication")
.userId("auth0|1234567890")
.email("test@test.com")
.password("passpass$12$12")
.nickname("testnick")
.username("testnick")
.roles(myRole.id())
.build());
}
}
import * as pulumi from "@pulumi/pulumi";
import * as auth0 from "@pulumi/auth0";
const myResourceServer = new auth0.ResourceServer("myResourceServer", {
identifier: "my-resource-server-identifier",
signingAlg: "RS256",
tokenLifetime: 86400,
skipConsentForVerifiableFirstPartyClients: true,
enforcePolicies: true,
scopes: [{
value: "read:something",
description: "read something",
}],
});
const myRole = new auth0.Role("myRole", {
description: "Role Description...",
permissions: [{
resourceServerIdentifier: myResourceServer.identifier,
name: "read:something",
}],
});
const myUser = new auth0.User("myUser", {
connectionName: "Username-Password-Authentication",
userId: "auth0|1234567890",
email: "test@test.com",
password: "passpass$12$12",
nickname: "testnick",
username: "testnick",
roles: [myRole.id],
});
import pulumi
import pulumi_auth0 as auth0
my_resource_server = auth0.ResourceServer("myResourceServer",
identifier="my-resource-server-identifier",
signing_alg="RS256",
token_lifetime=86400,
skip_consent_for_verifiable_first_party_clients=True,
enforce_policies=True,
scopes=[auth0.ResourceServerScopeArgs(
value="read:something",
description="read something",
)])
my_role = auth0.Role("myRole",
description="Role Description...",
permissions=[auth0.RolePermissionArgs(
resource_server_identifier=my_resource_server.identifier,
name="read:something",
)])
my_user = auth0.User("myUser",
connection_name="Username-Password-Authentication",
user_id="auth0|1234567890",
email="test@test.com",
password="passpass$12$12",
nickname="testnick",
username="testnick",
roles=[my_role.id])
resources:
myResourceServer:
type: auth0:ResourceServer
properties:
identifier: my-resource-server-identifier
signingAlg: RS256
tokenLifetime: 86400
skipConsentForVerifiableFirstPartyClients: true
enforcePolicies: true
scopes:
- value: read:something
description: read something
myUser:
type: auth0:User
properties:
connectionName: Username-Password-Authentication
userId: auth0|1234567890
email: test@test.com
password: passpass$12$12
nickname: testnick
username: testnick
roles:
- ${myRole.id}
myRole:
type: auth0:Role
properties:
description: Role Description...
permissions:
- resourceServerIdentifier: ${myResourceServer.identifier}
name: read:something
Create Role Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Role(name: string, args?: RoleArgs, opts?: CustomResourceOptions);@overload
def Role(resource_name: str,
args: Optional[RoleArgs] = None,
opts: Optional[ResourceOptions] = None)
@overload
def Role(resource_name: str,
opts: Optional[ResourceOptions] = None,
description: Optional[str] = None,
name: Optional[str] = None,
permissions: Optional[Sequence[RolePermissionArgs]] = None)func NewRole(ctx *Context, name string, args *RoleArgs, opts ...ResourceOption) (*Role, error)public Role(string name, RoleArgs? args = null, CustomResourceOptions? opts = null)type: auth0:Role
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args RoleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args RoleArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args RoleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RoleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RoleArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var roleResource = new Auth0.Role("roleResource", new()
{
Description = "string",
Name = "string",
});
example, err := auth0.NewRole(ctx, "roleResource", &auth0.RoleArgs{
Description: pulumi.String("string"),
Name: pulumi.String("string"),
})
var roleResource = new Role("roleResource", RoleArgs.builder()
.description("string")
.name("string")
.build());
role_resource = auth0.Role("roleResource",
description="string",
name="string")
const roleResource = new auth0.Role("roleResource", {
description: "string",
name: "string",
});
type: auth0:Role
properties:
description: string
name: string
Role Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Role resource accepts the following input properties:
- Description string
- Description of the role.
- Name string
- Name for this role.
- Permissions
List<Role
Permission> - Configuration settings for permissions (scopes) attached to the role. Managing permissions through the
permissionsattribute is deprecated and it will be removed in a future major version. Migrate to theauth0_role_permissionorauth0_role_permissionsresource to manage role permissions instead. Check the MIGRATION GUIDE for more info.
- Description string
- Description of the role.
- Name string
- Name for this role.
- Permissions
[]Role
Permission Type Args - Configuration settings for permissions (scopes) attached to the role. Managing permissions through the
permissionsattribute is deprecated and it will be removed in a future major version. Migrate to theauth0_role_permissionorauth0_role_permissionsresource to manage role permissions instead. Check the MIGRATION GUIDE for more info.
- description String
- Description of the role.
- name String
- Name for this role.
- permissions
List<Role
Permission> - Configuration settings for permissions (scopes) attached to the role. Managing permissions through the
permissionsattribute is deprecated and it will be removed in a future major version. Migrate to theauth0_role_permissionorauth0_role_permissionsresource to manage role permissions instead. Check the MIGRATION GUIDE for more info.
- description string
- Description of the role.
- name string
- Name for this role.
- permissions
Role
Permission[] - Configuration settings for permissions (scopes) attached to the role. Managing permissions through the
permissionsattribute is deprecated and it will be removed in a future major version. Migrate to theauth0_role_permissionorauth0_role_permissionsresource to manage role permissions instead. Check the MIGRATION GUIDE for more info.
- description str
- Description of the role.
- name str
- Name for this role.
- permissions
Sequence[Role
Permission Args] - Configuration settings for permissions (scopes) attached to the role. Managing permissions through the
permissionsattribute is deprecated and it will be removed in a future major version. Migrate to theauth0_role_permissionorauth0_role_permissionsresource to manage role permissions instead. Check the MIGRATION GUIDE for more info.
- description String
- Description of the role.
- name String
- Name for this role.
- permissions List<Property Map>
- Configuration settings for permissions (scopes) attached to the role. Managing permissions through the
permissionsattribute is deprecated and it will be removed in a future major version. Migrate to theauth0_role_permissionorauth0_role_permissionsresource to manage role permissions instead. Check the MIGRATION GUIDE for more info.
Outputs
All input properties are implicitly available as output properties. Additionally, the Role resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Role Resource
Get an existing Role resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: RoleState, opts?: CustomResourceOptions): Role@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
description: Optional[str] = None,
name: Optional[str] = None,
permissions: Optional[Sequence[RolePermissionArgs]] = None) -> Rolefunc GetRole(ctx *Context, name string, id IDInput, state *RoleState, opts ...ResourceOption) (*Role, error)public static Role Get(string name, Input<string> id, RoleState? state, CustomResourceOptions? opts = null)public static Role get(String name, Output<String> id, RoleState state, CustomResourceOptions options)resources: _: type: auth0:Role get: id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Description string
- Description of the role.
- Name string
- Name for this role.
- Permissions
List<Role
Permission> - Configuration settings for permissions (scopes) attached to the role. Managing permissions through the
permissionsattribute is deprecated and it will be removed in a future major version. Migrate to theauth0_role_permissionorauth0_role_permissionsresource to manage role permissions instead. Check the MIGRATION GUIDE for more info.
- Description string
- Description of the role.
- Name string
- Name for this role.
- Permissions
[]Role
Permission Type Args - Configuration settings for permissions (scopes) attached to the role. Managing permissions through the
permissionsattribute is deprecated and it will be removed in a future major version. Migrate to theauth0_role_permissionorauth0_role_permissionsresource to manage role permissions instead. Check the MIGRATION GUIDE for more info.
- description String
- Description of the role.
- name String
- Name for this role.
- permissions
List<Role
Permission> - Configuration settings for permissions (scopes) attached to the role. Managing permissions through the
permissionsattribute is deprecated and it will be removed in a future major version. Migrate to theauth0_role_permissionorauth0_role_permissionsresource to manage role permissions instead. Check the MIGRATION GUIDE for more info.
- description string
- Description of the role.
- name string
- Name for this role.
- permissions
Role
Permission[] - Configuration settings for permissions (scopes) attached to the role. Managing permissions through the
permissionsattribute is deprecated and it will be removed in a future major version. Migrate to theauth0_role_permissionorauth0_role_permissionsresource to manage role permissions instead. Check the MIGRATION GUIDE for more info.
- description str
- Description of the role.
- name str
- Name for this role.
- permissions
Sequence[Role
Permission Args] - Configuration settings for permissions (scopes) attached to the role. Managing permissions through the
permissionsattribute is deprecated and it will be removed in a future major version. Migrate to theauth0_role_permissionorauth0_role_permissionsresource to manage role permissions instead. Check the MIGRATION GUIDE for more info.
- description String
- Description of the role.
- name String
- Name for this role.
- permissions List<Property Map>
- Configuration settings for permissions (scopes) attached to the role. Managing permissions through the
permissionsattribute is deprecated and it will be removed in a future major version. Migrate to theauth0_role_permissionorauth0_role_permissionsresource to manage role permissions instead. Check the MIGRATION GUIDE for more info.
Supporting Types
RolePermission, RolePermissionArgs
- Name string
- Name of the permission (scope) configured on the resource server. If referencing a scope from an
auth0.ResourceServerresource, use thevalueproperty, for exampleauth0_resource_server.my_resource_server.scopes[0].value. - Resource
Server stringIdentifier - Unique identifier for the resource server.
- Description string
- Description of the permission.
- Resource
Server stringName - Name of resource server that the permission is associated with.
- Name string
- Name of the permission (scope) configured on the resource server. If referencing a scope from an
auth0.ResourceServerresource, use thevalueproperty, for exampleauth0_resource_server.my_resource_server.scopes[0].value. - Resource
Server stringIdentifier - Unique identifier for the resource server.
- Description string
- Description of the permission.
- Resource
Server stringName - Name of resource server that the permission is associated with.
- name String
- Name of the permission (scope) configured on the resource server. If referencing a scope from an
auth0.ResourceServerresource, use thevalueproperty, for exampleauth0_resource_server.my_resource_server.scopes[0].value. - resource
Server StringIdentifier - Unique identifier for the resource server.
- description String
- Description of the permission.
- resource
Server StringName - Name of resource server that the permission is associated with.
- name string
- Name of the permission (scope) configured on the resource server. If referencing a scope from an
auth0.ResourceServerresource, use thevalueproperty, for exampleauth0_resource_server.my_resource_server.scopes[0].value. - resource
Server stringIdentifier - Unique identifier for the resource server.
- description string
- Description of the permission.
- resource
Server stringName - Name of resource server that the permission is associated with.
- name str
- Name of the permission (scope) configured on the resource server. If referencing a scope from an
auth0.ResourceServerresource, use thevalueproperty, for exampleauth0_resource_server.my_resource_server.scopes[0].value. - resource_
server_ stridentifier - Unique identifier for the resource server.
- description str
- Description of the permission.
- resource_
server_ strname - Name of resource server that the permission is associated with.
- name String
- Name of the permission (scope) configured on the resource server. If referencing a scope from an
auth0.ResourceServerresource, use thevalueproperty, for exampleauth0_resource_server.my_resource_server.scopes[0].value. - resource
Server StringIdentifier - Unique identifier for the resource server.
- description String
- Description of the permission.
- resource
Server StringName - Name of resource server that the permission is associated with.
Import
Existing roles can be imported using their ID. # Example
$ pulumi import auth0:index/role:Role my_role XXXXXXXXXXXXXXXXXXXXXXX
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Auth0 pulumi/pulumi-auth0
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
auth0Terraform Provider.
published on Monday, Mar 9, 2026 by Pulumi
