getUsers

Gets Object IDs or UPNs for multiple Azure Active Directory users.

NOTE: If you’re authenticating using a Service Principal then it must have permissions to Read directory data within the Windows Azure Active Directory API.

Example Usage

using Pulumi;
using AzureAD = Pulumi.AzureAD;

class MyStack : Stack
{
    public MyStack()
    {
        var users = Output.Create(AzureAD.GetUsers.InvokeAsync(new AzureAD.GetUsersArgs
        {
            UserPrincipalNames = 
            {
                "kat@hashicorp.com",
                "byte@hashicorp.com",
            },
        }));
    }

}
package main

import (
	"github.com/pulumi/pulumi-azuread/sdk/v4/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@hashicorp.com",
				"byte@hashicorp.com",
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_azuread as azuread

users = azuread.get_users(user_principal_names=[
    "kat@hashicorp.com",
    "byte@hashicorp.com",
])
import * as pulumi from "@pulumi/pulumi";
import * as azuread from "@pulumi/azuread";

const users = pulumi.output(azuread.getUsers({
    userPrincipalNames: [
        "kat@hashicorp.com",
        "byte@hashicorp.com",
    ],
}, { async: true }));

Using getUsers

function getUsers(args: GetUsersArgs, opts?: InvokeOptions): Promise<GetUsersResult>
def get_users(ignore_missing: Optional[bool] = None,
              mail_nicknames: Optional[Sequence[str]] = None,
              object_ids: Optional[Sequence[str]] = None,
              user_principal_names: Optional[Sequence[str]] = None,
              opts: Optional[InvokeOptions] = None) -> GetUsersResult
func GetUsers(ctx *Context, args *GetUsersArgs, opts ...InvokeOption) (*GetUsersResult, error)

Note: This function is named GetUsers in the Go SDK.

public static class GetUsers {
    public static Task<GetUsersResult> InvokeAsync(GetUsersArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

IgnoreMissing bool
Ignore missing users and return users that were found. The data source will still fail if no users are found. Defaults to false.
MailNicknames List<string>
The email aliases of the Azure AD Users.
ObjectIds List<string>
The Object IDs of the Azure AD Users.
UserPrincipalNames List<string>
The User Principal Names of the Azure AD Users.
IgnoreMissing bool
Ignore missing users and return users that were found. The data source will still fail if no users are found. Defaults to false.
MailNicknames []string
The email aliases of the Azure AD Users.
ObjectIds []string
The Object IDs of the Azure AD Users.
UserPrincipalNames []string
The User Principal Names of the Azure AD Users.
ignoreMissing boolean
Ignore missing users and return users that were found. The data source will still fail if no users are found. Defaults to false.
mailNicknames string[]
The email aliases of the Azure AD Users.
objectIds string[]
The Object IDs of the Azure AD Users.
userPrincipalNames string[]
The User Principal Names of the Azure AD Users.
ignore_missing bool
Ignore missing users and return users that were found. The data source will still fail if no users are found. Defaults to false.
mail_nicknames Sequence[str]
The email aliases of the Azure AD Users.
object_ids Sequence[str]
The Object IDs of the Azure AD Users.
user_principal_names Sequence[str]
The User Principal Names of the Azure AD Users.

getUsers Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
MailNicknames List<string>
The email aliases of the Azure AD Users.
ObjectIds List<string>
The Object IDs of the Azure AD Users.
UserPrincipalNames List<string>
The User Principal Names of the Azure AD Users.
Users List<Pulumi.AzureAD.Outputs.GetUsersUser>
A list of Azure AD Users. Each user object provides the attributes documented below.
IgnoreMissing bool
Id string
The provider-assigned unique ID for this managed resource.
MailNicknames []string
The email aliases of the Azure AD Users.
ObjectIds []string
The Object IDs of the Azure AD Users.
UserPrincipalNames []string
The User Principal Names of the Azure AD Users.
Users []GetUsersUser
A list of Azure AD Users. Each user object provides the attributes documented below.
IgnoreMissing bool
id string
The provider-assigned unique ID for this managed resource.
mailNicknames string[]
The email aliases of the Azure AD Users.
objectIds string[]
The Object IDs of the Azure AD Users.
userPrincipalNames string[]
The User Principal Names of the Azure AD Users.
users GetUsersUser[]
A list of Azure AD Users. Each user object provides the attributes documented below.
ignoreMissing boolean
id str
The provider-assigned unique ID for this managed resource.
mail_nicknames Sequence[str]
The email aliases of the Azure AD Users.
object_ids Sequence[str]
The Object IDs of the Azure AD Users.
user_principal_names Sequence[str]
The User Principal Names of the Azure AD Users.
users Sequence[GetUsersUser]
A list of Azure AD Users. Each user object provides the attributes documented below.
ignore_missing bool

Supporting Types

GetUsersUser

AccountEnabled bool
True if the account is enabled; otherwise False.
DisplayName string
The Display Name of the Azure AD User.
ImmutableId string
The value used to associate an on-premises Active Directory user account with their Azure AD user object.
Mail string
The primary email address of the Azure AD User.
MailNickname string
The email alias of the Azure AD User.
ObjectId string
The Object ID of the Azure AD User.
OnpremisesSamAccountName string
The on-premise SAM account name of the Azure AD User.
OnpremisesUserPrincipalName string
The on-premise user principal name of the Azure AD User.
UsageLocation string
The usage location of the Azure AD User.
UserPrincipalName string
The User Principal Name of the Azure AD User.
AccountEnabled bool
True if the account is enabled; otherwise False.
DisplayName string
The Display Name of the Azure AD User.
ImmutableId string
The value used to associate an on-premises Active Directory user account with their Azure AD user object.
Mail string
The primary email address of the Azure AD User.
MailNickname string
The email alias of the Azure AD User.
ObjectId string
The Object ID of the Azure AD User.
OnpremisesSamAccountName string
The on-premise SAM account name of the Azure AD User.
OnpremisesUserPrincipalName string
The on-premise user principal name of the Azure AD User.
UsageLocation string
The usage location of the Azure AD User.
UserPrincipalName string
The User Principal Name of the Azure AD User.
accountEnabled boolean
True if the account is enabled; otherwise False.
displayName string
The Display Name of the Azure AD User.
immutableId string
The value used to associate an on-premises Active Directory user account with their Azure AD user object.
mail string
The primary email address of the Azure AD User.
mailNickname string
The email alias of the Azure AD User.
objectId string
The Object ID of the Azure AD User.
onpremisesSamAccountName string
The on-premise SAM account name of the Azure AD User.
onpremisesUserPrincipalName string
The on-premise user principal name of the Azure AD User.
usageLocation string
The usage location of the Azure AD User.
userPrincipalName string
The User Principal Name of the Azure AD User.
account_enabled bool
True if the account is enabled; otherwise False.
display_name str
The Display Name of the Azure AD User.
immutable_id str
The value used to associate an on-premises Active Directory user account with their Azure AD user object.
mail str
The primary email address of the Azure AD User.
mail_nickname str
The email alias of the Azure AD User.
object_id str
The Object ID of the Azure AD User.
onpremises_sam_account_name str
The on-premise SAM account name of the Azure AD User.
onpremises_user_principal_name str
The on-premise user principal name of the Azure AD User.
usage_location str
The usage location of the Azure AD User.
user_principal_name str
The User Principal Name of the Azure AD User.

Package Details

Repository
https://github.com/pulumi/pulumi-azuread
License
Apache-2.0
Notes
This Pulumi package is based on the azuread Terraform Provider.