1. Registry
  2. Packages
  3. Onelogin Provider
  4. API Docs
  5. getUsers
Viewing docs for onelogin 1.1.0
published on Friday, Aug 14, 2026 by onelogin
onelogin logo onelogin logo
Viewing docs for onelogin 1.1.0
published on Friday, Aug 14, 2026 by onelogin

    Returns User IDs matching the given attributes.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as onelogin from "@pulumi/onelogin";
    
    const example = onelogin.getUsers({
        firstname: "tom",
    });
    
    import pulumi
    import pulumi_onelogin as onelogin
    
    example = onelogin.get_users(firstname="tom")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/onelogin/onelogin"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := onelogin.LookupUsers(ctx, &onelogin.LookupUsersArgs{
    			Firstname: pulumi.StringRef("tom"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Onelogin = Pulumi.Onelogin;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Onelogin.GetUsers.Invoke(new()
        {
            Firstname = "tom",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.onelogin.OneloginFunctions;
    import com.pulumi.onelogin.inputs.GetUsersArgs;
    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 example = OneloginFunctions.getUsers(GetUsersArgs.builder()
                .firstname("tom")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: onelogin:getUsers
          arguments:
            firstname: tom
    
    Example coming soon!
    

    Looking users up by email

    Resources that take user IDs — onelogin_roles.users among them — can be given the results of a lookup rather than IDs written out by hand. emails takes a list, so a whole membership can come from one data source:

    import * as pulumi from "@pulumi/pulumi";
    import * as onelogin from "@pulumi/onelogin";
    
    const engineering = onelogin.getUsers({
        emails: [
            "alice@example.com",
            "bob@example.com",
        ],
    });
    const engineeringRoles = new onelogin.Roles("engineering", {
        name: "Engineering",
        users: engineering.then(engineering => engineering.users.map(__item => __item.id)),
    });
    
    import pulumi
    import pulumi_onelogin as onelogin
    
    engineering = onelogin.get_users(emails=[
        "alice@example.com",
        "bob@example.com",
    ])
    engineering_roles = onelogin.Roles("engineering",
        name="Engineering",
        users=[__item.id for __item in engineering.users])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/onelogin/onelogin"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		engineering, err := onelogin.LookupUsers(ctx, &onelogin.LookupUsersArgs{
    			Emails: []string{
    				"alice@example.com",
    				"bob@example.com",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		var splat0 []*float64
    		for _, val0 := range engineering.Users {
    			splat0 = append(splat0, val0.Id)
    		}
    		_, err = onelogin.NewRoles(ctx, "engineering", &onelogin.RolesArgs{
    			Name:  pulumi.String("Engineering"),
    			Users: splat0,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Onelogin = Pulumi.Onelogin;
    
    return await Deployment.RunAsync(() => 
    {
        var engineering = Onelogin.GetUsers.Invoke(new()
        {
            Emails = new[]
            {
                "alice@example.com",
                "bob@example.com",
            },
        });
    
        var engineeringRoles = new Onelogin.Roles("engineering", new()
        {
            Name = "Engineering",
            Users = engineering.Apply(getUsersResult => getUsersResult.Users).Select(__item => __item.Id).ToList(),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.onelogin.OneloginFunctions;
    import com.pulumi.onelogin.inputs.GetUsersArgs;
    import com.pulumi.onelogin.Roles;
    import com.pulumi.onelogin.RolesArgs;
    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 engineering = OneloginFunctions.getUsers(GetUsersArgs.builder()
                .emails(            
                    "alice@example.com",
                    "bob@example.com")
                .build());
    
            var engineeringRoles = new Roles("engineeringRoles", RolesArgs.builder()
                .name("Engineering")
                .users(engineering.users().stream().map(element -> element.id()).collect(toList()))
                .build());
    
        }
    }
    
    Example coming soon!
    
    Example coming soon!
    

    users[*].id is already a list of numbers, so it can be passed straight through; ids holds the same values as strings.

    Note that an email matching no user contributes nothing rather than failing. If a typo would be better caught than ignored, compare the counts:

    Using getUsers

    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 getUsers(args: GetUsersArgs, opts?: InvokeOptions): Promise<GetUsersResult>
    function getUsersOutput(args: GetUsersOutputArgs, opts?: InvokeOutputOptions): Output<GetUsersResult>
    def get_users(directory_id: Optional[float] = None,
                  email: Optional[str] = None,
                  emails: Optional[Sequence[str]] = None,
                  external_id: Optional[float] = None,
                  firstname: Optional[str] = None,
                  id: Optional[str] = None,
                  lastname: Optional[str] = None,
                  samaccountname: Optional[str] = None,
                  user_id: Optional[str] = None,
                  username: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetUsersResult
    def get_users_output(directory_id: pulumi.Input[Optional[float]] = None,
                  email: pulumi.Input[Optional[str]] = None,
                  emails: pulumi.Input[Optional[Sequence[pulumi.Input[str]]]] = None,
                  external_id: pulumi.Input[Optional[float]] = None,
                  firstname: pulumi.Input[Optional[str]] = None,
                  id: pulumi.Input[Optional[str]] = None,
                  lastname: pulumi.Input[Optional[str]] = None,
                  samaccountname: pulumi.Input[Optional[str]] = None,
                  user_id: pulumi.Input[Optional[str]] = None,
                  username: pulumi.Input[Optional[str]] = None,
                  opts: Optional[InvokeOutputOptions] = None) -> Output[GetUsersResult]
    func LookupUsers(ctx *Context, args *LookupUsersArgs, opts ...InvokeOption) (*LookupUsersResult, error)
    func LookupUsersOutput(ctx *Context, args *LookupUsersOutputArgs, opts ...InvokeOption) LookupUsersResultOutput

    > Note: This function is named LookupUsers in the Go SDK.

    public static class GetUsers 
    {
        public static Task<GetUsersResult> InvokeAsync(GetUsersArgs args, InvokeOptions? opts = null)
        public static Output<GetUsersResult> Invoke(GetUsersInvokeArgs args, InvokeOptions? opts = null)
        public static Output<GetUsersResult> Invoke(GetUsersInvokeArgs args, InvokeOutputOptions opts)
    }
    public static CompletableFuture<GetUsersResult> getUsers(GetUsersArgs args, InvokeOptions options)
    public static Output<GetUsersResult> getUsers(GetUsersArgs args, InvokeOptions options)
    public static Output<GetUsersResult> getUsers(GetUsersArgs args, InvokeOutputOptions options)
    
    fn::invoke:
      function: onelogin:index/getUsers:getUsers
      arguments:
        # arguments dictionary
    data "onelogin_get_users" "name" {
        # arguments
    }

    The following arguments are supported:

    DirectoryId double
    The user's directory_id
    Email string
    The user's email.
    Emails List<string>
    A list of emails to look up at once. The API matches one email per request, so each is queried in turn and the results combined, in the order given, with duplicates removed. Any other argument set here applies to every one of those queries. Conflicts with email.
    ExternalId double
    The user's external_id
    Firstname string
    The user's first name
    Id string
    Lastname string
    The user's last name
    Samaccountname string
    The user's samaccount name
    UserId string
    Username string
    The user's username.
    DirectoryId float64
    The user's directory_id
    Email string
    The user's email.
    Emails []string
    A list of emails to look up at once. The API matches one email per request, so each is queried in turn and the results combined, in the order given, with duplicates removed. Any other argument set here applies to every one of those queries. Conflicts with email.
    ExternalId float64
    The user's external_id
    Firstname string
    The user's first name
    Id string
    Lastname string
    The user's last name
    Samaccountname string
    The user's samaccount name
    UserId string
    Username string
    The user's username.
    directory_id number
    The user's directory_id
    email string
    The user's email.
    emails list(string)
    A list of emails to look up at once. The API matches one email per request, so each is queried in turn and the results combined, in the order given, with duplicates removed. Any other argument set here applies to every one of those queries. Conflicts with email.
    external_id number
    The user's external_id
    firstname string
    The user's first name
    id string
    lastname string
    The user's last name
    samaccountname string
    The user's samaccount name
    user_id string
    username string
    The user's username.
    directoryId Double
    The user's directory_id
    email String
    The user's email.
    emails List<String>
    A list of emails to look up at once. The API matches one email per request, so each is queried in turn and the results combined, in the order given, with duplicates removed. Any other argument set here applies to every one of those queries. Conflicts with email.
    externalId Double
    The user's external_id
    firstname String
    The user's first name
    id String
    lastname String
    The user's last name
    samaccountname String
    The user's samaccount name
    userId String
    username String
    The user's username.
    directoryId number
    The user's directory_id
    email string
    The user's email.
    emails string[]
    A list of emails to look up at once. The API matches one email per request, so each is queried in turn and the results combined, in the order given, with duplicates removed. Any other argument set here applies to every one of those queries. Conflicts with email.
    externalId number
    The user's external_id
    firstname string
    The user's first name
    id string
    lastname string
    The user's last name
    samaccountname string
    The user's samaccount name
    userId string
    username string
    The user's username.
    directory_id float
    The user's directory_id
    email str
    The user's email.
    emails Sequence[str]
    A list of emails to look up at once. The API matches one email per request, so each is queried in turn and the results combined, in the order given, with duplicates removed. Any other argument set here applies to every one of those queries. Conflicts with email.
    external_id float
    The user's external_id
    firstname str
    The user's first name
    id str
    lastname str
    The user's last name
    samaccountname str
    The user's samaccount name
    user_id str
    username str
    The user's username.
    directoryId Number
    The user's directory_id
    email String
    The user's email.
    emails List<String>
    A list of emails to look up at once. The API matches one email per request, so each is queried in turn and the results combined, in the order given, with duplicates removed. Any other argument set here applies to every one of those queries. Conflicts with email.
    externalId Number
    The user's external_id
    firstname String
    The user's first name
    id String
    lastname String
    The user's last name
    samaccountname String
    The user's samaccount name
    userId String
    username String
    The user's username.

    getUsers Result

    The following output properties are available:

    Id string
    Ids List<string>
    List of user's id, as strings
    Users List<GetUsersUser>
    List of the matching users, each with id (number), username, email, firstname, lastname, samaccountname, external_id, directory_id and last_login
    DirectoryId double
    Email string
    Emails List<string>
    ExternalId double
    Firstname string
    Lastname string
    Samaccountname string
    UserId string
    Username string
    Id string
    Ids []string
    List of user's id, as strings
    Users []GetUsersUser
    List of the matching users, each with id (number), username, email, firstname, lastname, samaccountname, external_id, directory_id and last_login
    DirectoryId float64
    Email string
    Emails []string
    ExternalId float64
    Firstname string
    Lastname string
    Samaccountname string
    UserId string
    Username string
    id string
    ids list(string)
    List of user's id, as strings
    users list(object)
    List of the matching users, each with id (number), username, email, firstname, lastname, samaccountname, external_id, directory_id and last_login
    directory_id number
    email string
    emails list(string)
    external_id number
    firstname string
    lastname string
    samaccountname string
    user_id string
    username string
    id String
    ids List<String>
    List of user's id, as strings
    users List<GetUsersUser>
    List of the matching users, each with id (number), username, email, firstname, lastname, samaccountname, external_id, directory_id and last_login
    directoryId Double
    email String
    emails List<String>
    externalId Double
    firstname String
    lastname String
    samaccountname String
    userId String
    username String
    id string
    ids string[]
    List of user's id, as strings
    users GetUsersUser[]
    List of the matching users, each with id (number), username, email, firstname, lastname, samaccountname, external_id, directory_id and last_login
    directoryId number
    email string
    emails string[]
    externalId number
    firstname string
    lastname string
    samaccountname string
    userId string
    username string
    id str
    ids Sequence[str]
    List of user's id, as strings
    users Sequence[GetUsersUser]
    List of the matching users, each with id (number), username, email, firstname, lastname, samaccountname, external_id, directory_id and last_login
    directory_id float
    email str
    emails Sequence[str]
    external_id float
    firstname str
    lastname str
    samaccountname str
    user_id str
    username str
    id String
    ids List<String>
    List of user's id, as strings
    users List<Property Map>
    List of the matching users, each with id (number), username, email, firstname, lastname, samaccountname, external_id, directory_id and last_login
    directoryId Number
    email String
    emails List<String>
    externalId Number
    firstname String
    lastname String
    samaccountname String
    userId String
    username String

    Supporting Types

    GetUsersUser

    DirectoryId double
    The user's directory_id
    Email string
    The user's email.
    ExternalId double
    The user's external_id
    Firstname string
    The user's first name
    Id double
    LastLogin string
    Lastname string
    The user's last name
    Samaccountname string
    The user's samaccount name
    Username string
    The user's username.
    DirectoryId float64
    The user's directory_id
    Email string
    The user's email.
    ExternalId float64
    The user's external_id
    Firstname string
    The user's first name
    Id float64
    LastLogin string
    Lastname string
    The user's last name
    Samaccountname string
    The user's samaccount name
    Username string
    The user's username.
    directory_id number
    The user's directory_id
    email string
    The user's email.
    external_id number
    The user's external_id
    firstname string
    The user's first name
    id number
    last_login string
    lastname string
    The user's last name
    samaccountname string
    The user's samaccount name
    username string
    The user's username.
    directoryId Double
    The user's directory_id
    email String
    The user's email.
    externalId Double
    The user's external_id
    firstname String
    The user's first name
    id Double
    lastLogin String
    lastname String
    The user's last name
    samaccountname String
    The user's samaccount name
    username String
    The user's username.
    directoryId number
    The user's directory_id
    email string
    The user's email.
    externalId number
    The user's external_id
    firstname string
    The user's first name
    id number
    lastLogin string
    lastname string
    The user's last name
    samaccountname string
    The user's samaccount name
    username string
    The user's username.
    directory_id float
    The user's directory_id
    email str
    The user's email.
    external_id float
    The user's external_id
    firstname str
    The user's first name
    id float
    last_login str
    lastname str
    The user's last name
    samaccountname str
    The user's samaccount name
    username str
    The user's username.
    directoryId Number
    The user's directory_id
    email String
    The user's email.
    externalId Number
    The user's external_id
    firstname String
    The user's first name
    id Number
    lastLogin String
    lastname String
    The user's last name
    samaccountname String
    The user's samaccount name
    username String
    The user's username.

    Package Details

    Repository
    onelogin onelogin/terraform-provider-onelogin
    License
    Notes
    This Pulumi package is based on the onelogin Terraform Provider.
    onelogin logo onelogin logo
    Viewing docs for onelogin 1.1.0
    published on Friday, Aug 14, 2026 by onelogin

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial