azuread.getUsers
Explore with Pulumi AI
Gets basic information for multiple Azure Active Directory users.
API Permissions
The following API permissions are required in order to use this data source.
When authenticated with a service principal, this data source requires one of the following application roles: User.ReadBasic.All
, User.Read.All
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 users = azuread.getUsers({
userPrincipalNames: [
"kat@example.com",
"byte@example.com",
],
});
import pulumi
import pulumi_azuread as azuread
users = azuread.get_users(user_principal_names=[
"kat@example.com",
"byte@example.com",
])
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 {
_, err := azuread.GetUsers(ctx, &azuread.GetUsersArgs{
UserPrincipalNames: []string{
"kat@example.com",
"byte@example.com",
},
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureAD = Pulumi.AzureAD;
return await Deployment.RunAsync(() =>
{
var users = AzureAD.GetUsers.Invoke(new()
{
UserPrincipalNames = new[]
{
"kat@example.com",
"byte@example.com",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azuread.AzureadFunctions;
import com.pulumi.azuread.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 users = AzureadFunctions.getUsers(GetUsersArgs.builder()
.userPrincipalNames(
"kat@example.com",
"byte@example.com")
.build());
}
}
variables:
users:
fn::invoke:
Function: azuread:getUsers
Arguments:
userPrincipalNames:
- kat@example.com
- byte@example.com
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?: InvokeOptions): Output<GetUsersResult>
def get_users(employee_ids: Optional[Sequence[str]] = None,
ignore_missing: Optional[bool] = None,
mail_nicknames: Optional[Sequence[str]] = None,
mails: Optional[Sequence[str]] = None,
object_ids: Optional[Sequence[str]] = None,
return_all: Optional[bool] = None,
user_principal_names: Optional[Sequence[str]] = None,
opts: Optional[InvokeOptions] = None) -> GetUsersResult
def get_users_output(employee_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
ignore_missing: Optional[pulumi.Input[bool]] = None,
mail_nicknames: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
mails: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
object_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
return_all: Optional[pulumi.Input[bool]] = None,
user_principal_names: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetUsersResult]
func GetUsers(ctx *Context, args *GetUsersArgs, opts ...InvokeOption) (*GetUsersResult, error)
func GetUsersOutput(ctx *Context, args *GetUsersOutputArgs, opts ...InvokeOption) GetUsersResultOutput
> Note: This function is named GetUsers
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 CompletableFuture<GetUsersResult> getUsers(GetUsersArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: azuread:index/getUsers:getUsers
arguments:
# arguments dictionary
The following arguments are supported:
- Employee
Ids List<string> - The employee identifiers assigned to the users by the organisation.
- Ignore
Missing bool - Ignore missing users and return users that were found. The data source will still fail if no users are found. Cannot be specified with
return_all
. Defaults tofalse
. - Mail
Nicknames List<string> - The email aliases of the users.
- Mails List<string>
- The SMTP email addresses of the users.
- Object
Ids List<string> - The object IDs of the users.
- Return
All bool - When
true
, the data source will return all users. Cannot be used withignore_missing
. Defaults tofalse
. - User
Principal List<string>Names The user principal names (UPNs) of the users.
Either
return_all
, or one ofuser_principal_names
,object_ids
,mail_nicknames
,mails
, oremployee_ids
must be specified. These may be specified as an empty list, in which case no results will be returned.
- Employee
Ids []string - The employee identifiers assigned to the users by the organisation.
- Ignore
Missing bool - Ignore missing users and return users that were found. The data source will still fail if no users are found. Cannot be specified with
return_all
. Defaults tofalse
. - Mail
Nicknames []string - The email aliases of the users.
- Mails []string
- The SMTP email addresses of the users.
- Object
Ids []string - The object IDs of the users.
- Return
All bool - When
true
, the data source will return all users. Cannot be used withignore_missing
. Defaults tofalse
. - User
Principal []stringNames The user principal names (UPNs) of the users.
Either
return_all
, or one ofuser_principal_names
,object_ids
,mail_nicknames
,mails
, oremployee_ids
must be specified. These may be specified as an empty list, in which case no results will be returned.
- employee
Ids List<String> - The employee identifiers assigned to the users by the organisation.
- ignore
Missing Boolean - Ignore missing users and return users that were found. The data source will still fail if no users are found. Cannot be specified with
return_all
. Defaults tofalse
. - mail
Nicknames List<String> - The email aliases of the users.
- mails List<String>
- The SMTP email addresses of the users.
- object
Ids List<String> - The object IDs of the users.
- return
All Boolean - When
true
, the data source will return all users. Cannot be used withignore_missing
. Defaults tofalse
. - user
Principal List<String>Names The user principal names (UPNs) of the users.
Either
return_all
, or one ofuser_principal_names
,object_ids
,mail_nicknames
,mails
, oremployee_ids
must be specified. These may be specified as an empty list, in which case no results will be returned.
- employee
Ids string[] - The employee identifiers assigned to the users by the organisation.
- ignore
Missing boolean - Ignore missing users and return users that were found. The data source will still fail if no users are found. Cannot be specified with
return_all
. Defaults tofalse
. - mail
Nicknames string[] - The email aliases of the users.
- mails string[]
- The SMTP email addresses of the users.
- object
Ids string[] - The object IDs of the users.
- return
All boolean - When
true
, the data source will return all users. Cannot be used withignore_missing
. Defaults tofalse
. - user
Principal string[]Names The user principal names (UPNs) of the users.
Either
return_all
, or one ofuser_principal_names
,object_ids
,mail_nicknames
,mails
, oremployee_ids
must be specified. These may be specified as an empty list, in which case no results will be returned.
- employee_
ids Sequence[str] - The employee identifiers assigned to the users by the organisation.
- ignore_
missing bool - Ignore missing users and return users that were found. The data source will still fail if no users are found. Cannot be specified with
return_all
. Defaults tofalse
. - mail_
nicknames Sequence[str] - The email aliases of the users.
- mails Sequence[str]
- The SMTP email addresses of the users.
- object_
ids Sequence[str] - The object IDs of the users.
- return_
all bool - When
true
, the data source will return all users. Cannot be used withignore_missing
. Defaults tofalse
. - user_
principal_ Sequence[str]names The user principal names (UPNs) of the users.
Either
return_all
, or one ofuser_principal_names
,object_ids
,mail_nicknames
,mails
, oremployee_ids
must be specified. These may be specified as an empty list, in which case no results will be returned.
- employee
Ids List<String> - The employee identifiers assigned to the users by the organisation.
- ignore
Missing Boolean - Ignore missing users and return users that were found. The data source will still fail if no users are found. Cannot be specified with
return_all
. Defaults tofalse
. - mail
Nicknames List<String> - The email aliases of the users.
- mails List<String>
- The SMTP email addresses of the users.
- object
Ids List<String> - The object IDs of the users.
- return
All Boolean - When
true
, the data source will return all users. Cannot be used withignore_missing
. Defaults tofalse
. - user
Principal List<String>Names The user principal names (UPNs) of the users.
Either
return_all
, or one ofuser_principal_names
,object_ids
,mail_nicknames
,mails
, oremployee_ids
must be specified. These may be specified as an empty list, in which case no results will be returned.
getUsers Result
The following output properties are available:
- Employee
Ids List<string> - The employee identifiers assigned to the users by the organisation.
- Id string
- The provider-assigned unique ID for this managed resource.
- Mail
Nicknames List<string> - The email aliases of the users.
- Mails List<string>
- The SMTP email addresses of the users.
- Object
Ids List<string> - The object IDs of the users.
- User
Principal List<string>Names - The user principal names (UPNs) of the users.
- Users
List<Pulumi.
Azure AD. Outputs. Get Users User> - A list of users. Each
user
object provides the attributes documented below. - Ignore
Missing bool - Return
All bool
- Employee
Ids []string - The employee identifiers assigned to the users by the organisation.
- Id string
- The provider-assigned unique ID for this managed resource.
- Mail
Nicknames []string - The email aliases of the users.
- Mails []string
- The SMTP email addresses of the users.
- Object
Ids []string - The object IDs of the users.
- User
Principal []stringNames - The user principal names (UPNs) of the users.
- Users
[]Get
Users User - A list of users. Each
user
object provides the attributes documented below. - Ignore
Missing bool - Return
All bool
- employee
Ids List<String> - The employee identifiers assigned to the users by the organisation.
- id String
- The provider-assigned unique ID for this managed resource.
- mail
Nicknames List<String> - The email aliases of the users.
- mails List<String>
- The SMTP email addresses of the users.
- object
Ids List<String> - The object IDs of the users.
- user
Principal List<String>Names - The user principal names (UPNs) of the users.
- users
List<Get
Users User> - A list of users. Each
user
object provides the attributes documented below. - ignore
Missing Boolean - return
All Boolean
- employee
Ids string[] - The employee identifiers assigned to the users by the organisation.
- id string
- The provider-assigned unique ID for this managed resource.
- mail
Nicknames string[] - The email aliases of the users.
- mails string[]
- The SMTP email addresses of the users.
- object
Ids string[] - The object IDs of the users.
- user
Principal string[]Names - The user principal names (UPNs) of the users.
- users
Get
Users User[] - A list of users. Each
user
object provides the attributes documented below. - ignore
Missing boolean - return
All boolean
- employee_
ids Sequence[str] - The employee identifiers assigned to the users by the organisation.
- id str
- The provider-assigned unique ID for this managed resource.
- mail_
nicknames Sequence[str] - The email aliases of the users.
- mails Sequence[str]
- The SMTP email addresses of the users.
- object_
ids Sequence[str] - The object IDs of the users.
- user_
principal_ Sequence[str]names - The user principal names (UPNs) of the users.
- users
Sequence[Get
Users User] - A list of users. Each
user
object provides the attributes documented below. - ignore_
missing bool - return_
all bool
- employee
Ids List<String> - The employee identifiers assigned to the users by the organisation.
- id String
- The provider-assigned unique ID for this managed resource.
- mail
Nicknames List<String> - The email aliases of the users.
- mails List<String>
- The SMTP email addresses of the users.
- object
Ids List<String> - The object IDs of the users.
- user
Principal List<String>Names - The user principal names (UPNs) of the users.
- users List<Property Map>
- A list of users. Each
user
object provides the attributes documented below. - ignore
Missing Boolean - return
All Boolean
Supporting Types
GetUsersUser
- Account
Enabled bool - Whether the account is enabled.
- Display
Name string - The display name of the user.
- Employee
Id string - The employee identifier assigned to the user by the organisation.
- Mail string
- The SMTP email address of the user.
- Mail
Nickname string - The email alias of the user.
- Object
Id string - The object ID of the user.
- Onpremises
Immutable stringId - The value used to associate an on-premises Active Directory user account with their Azure AD user object.
- Onpremises
Sam stringAccount Name - The on-premise SAM account name of the user.
- Onpremises
User stringPrincipal Name - The on-premise user principal name of the user.
- Usage
Location string - The usage location of the user.
- User
Principal stringName - The user principal name (UPN) of the user.
- Account
Enabled bool - Whether the account is enabled.
- Display
Name string - The display name of the user.
- Employee
Id string - The employee identifier assigned to the user by the organisation.
- Mail string
- The SMTP email address of the user.
- Mail
Nickname string - The email alias of the user.
- Object
Id string - The object ID of the user.
- Onpremises
Immutable stringId - The value used to associate an on-premises Active Directory user account with their Azure AD user object.
- Onpremises
Sam stringAccount Name - The on-premise SAM account name of the user.
- Onpremises
User stringPrincipal Name - The on-premise user principal name of the user.
- Usage
Location string - The usage location of the user.
- User
Principal stringName - The user principal name (UPN) of the user.
- account
Enabled Boolean - Whether the account is enabled.
- display
Name String - The display name of the user.
- employee
Id String - The employee identifier assigned to the user by the organisation.
- mail String
- The SMTP email address of the user.
- mail
Nickname String - The email alias of the user.
- object
Id String - The object ID of the user.
- onpremises
Immutable StringId - The value used to associate an on-premises Active Directory user account with their Azure AD user object.
- onpremises
Sam StringAccount Name - The on-premise SAM account name of the user.
- onpremises
User StringPrincipal Name - The on-premise user principal name of the user.
- usage
Location String - The usage location of the user.
- user
Principal StringName - The user principal name (UPN) of the user.
- account
Enabled boolean - Whether the account is enabled.
- display
Name string - The display name of the user.
- employee
Id string - The employee identifier assigned to the user by the organisation.
- mail string
- The SMTP email address of the user.
- mail
Nickname string - The email alias of the user.
- object
Id string - The object ID of the user.
- onpremises
Immutable stringId - The value used to associate an on-premises Active Directory user account with their Azure AD user object.
- onpremises
Sam stringAccount Name - The on-premise SAM account name of the user.
- onpremises
User stringPrincipal Name - The on-premise user principal name of the user.
- usage
Location string - The usage location of the user.
- user
Principal stringName - The user principal name (UPN) of the user.
- account_
enabled bool - Whether the account is enabled.
- display_
name str - The display name of the user.
- employee_
id str - The employee identifier assigned to the user by the organisation.
- mail str
- The SMTP email address of the user.
- mail_
nickname str - The email alias of the user.
- object_
id str - The object ID of the user.
- onpremises_
immutable_ strid - The value used to associate an on-premises Active Directory user account with their Azure AD user object.
- onpremises_
sam_ straccount_ name - The on-premise SAM account name of the user.
- onpremises_
user_ strprincipal_ name - The on-premise user principal name of the user.
- usage_
location str - The usage location of the user.
- user_
principal_ strname - The user principal name (UPN) of the user.
- account
Enabled Boolean - Whether the account is enabled.
- display
Name String - The display name of the user.
- employee
Id String - The employee identifier assigned to the user by the organisation.
- mail String
- The SMTP email address of the user.
- mail
Nickname String - The email alias of the user.
- object
Id String - The object ID of the user.
- onpremises
Immutable StringId - The value used to associate an on-premises Active Directory user account with their Azure AD user object.
- onpremises
Sam StringAccount Name - The on-premise SAM account name of the user.
- onpremises
User StringPrincipal Name - The on-premise user principal name of the user.
- usage
Location String - The usage location of the user.
- user
Principal StringName - The user principal name (UPN) of the user.
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.