Azure Active Directory - Query users

Use the Azure Active Directory - Query users action A tool for building the processes, logic, and direction within workflows. if you want to search for employees listed in your organization's directory based on conditions you specify. The output of the of this action can be stored in variables inside an object.

For example, your organization's Azure Active Directory contains a list of 500 employees and you want to get the email address of only 150 Belgium-based employees. To achieve this, you can:

  • Specify 150 as the maximum number of users to return.
  • Create a condition such as: When : Country or region equals "Belgium".
  • Add an object variable to store the email address of each user in a variable, and use this variable in a Get item from collection action later in your workflow.

If in reality the directory listed only 87 employees located in Belgium, then the query results will give you only 87 names. This action stores the result in an object that stores the number of users returned in a variable.

For more information about Azure Active Directory, go to Azure Active Directory.

Configure the Azure Active Directory - Query users action

  1. Add the action to the workflow and open the action configuration panel. For more information, see Add, rename, and copy actions.

  1. Select a Connection. If you do not have a connection, see Add a connection.
  1. Type the Maximum number of users to return.
  2. For example, a large-sized directory could contain about 500 employees. If you want the result to include only 150, type "150". To know the actual number of users returned by your query, see Configure the storage of the additional outputs of Azure Active Directory - Query users action.

Configure the storage of the additional outputs of Azure Active Directory - Query users action

  1. Add and configure the Azure Active Directory - Query users action.
  2. In Result create an Object variable to store the result of the action. The object stores the Number of users returned in a variable.
  3. This variable is very useful especially if your workflow should know how many values were retrieved by the action.

    Caution: The actual value stored in this variable depends on the results of the query but can be limited by setting the Maximum number of users to return. For example, a large-sized directory contains 500 names of employees located in various countries. You want to search for 150 Belgium-based employees. If in reality, the directory lists 87 employees located in Belgium, then results of your query will give you only 87 names. If this number is a crucial information in your workflow, you can store this number in a variable for use later.

  1. The object you created to store the result in step 2, stores the email addresses of the users in the Store user emails collection variable.

    To get each value stored in a collection, use the Get item from collection action.

Azure Active Directory - Query Users action fields, buttons, and settings

Section

Field

Description

Variable types

(unlabeled)

Connection Credentials and other settings required to pass data between the workflow and the indicated service, which could be a cloud service, business application, or content store.

The Azure Active Directory connection to use for querying users.

(n/a)

  Maximum number of users to return

The maximum number of users to be returned. This field accepts numbers between 1 and 999.

Integer
Conditions Add conditions/Edit conditions

Conditional statements to use for the query. For example, to search for employees located in Belgium, you can write a condition such as When "Country or region" equals "Belgium".

Displays the condition builder to define new conditions or edit existing conditions.

  • Add conditions - Displayed when there are no existing conditions specified for the action.

  • Edit conditions - Displayed when there are existing conditions set for the action. You can edit the conditions.

The Condition builder supports nested conditions, enabling you to create conditions within another condition.

(n/a)
  Condition builder

For fields and settings, see Condition builder.

 
Output Result

Stores the output of the action in an object that has multiple variables. You can use these variables later in your workflow. Includes the following variables:

  • Number of users returned: Integer variable to store the actual number of users returned by your query.

    Caution: The actual value stored in this variable depends on the results of the query but can be limited by setting the Maximum number of users to return. For example, a large-sized directory contains 500 names of employees located in various countries. You want to search for 150 Belgium-based employees. If in reality, the directory lists 87 employees located in Belgium, then results of your query will give you only 87 names. If this number is a crucial information in your workflow, you can store this number in a variable for use later.

  • Store user emails: Collection variable to store the email addresses of the users returned by the query. You can use the Get item from collection action to retrieve values stored in the collection variable.

  • Users: Collection variable that stores the user details of the users returned by the query.

Object