> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/integrations/catalog/microsoft-entra.md).

# Microsoft Entra

Microsoft Entra integration for identity lifecycle, group membership, and OAuth token operations.

### Connectors

Choose the connector that matches your authentication method. The options below use the names shown in StackAI.

| Connector                         | Authentication |
| --------------------------------- | -------------- |
| Microsoft Entra                   | Credentials    |
| Microsoft Entra Identity (OAuth2) | OAuth sign-in  |
| Microsoft Entra (OAuth2, Legacy)  | OAuth sign-in  |

#### Microsoft Entra

Connect to Microsoft Entra to perform authentication operations(exchange tokens, get access tokens, etc.).

**Set up in Microsoft Entra**

1. Grant the app the Microsoft Graph application permissions your workflows need, then grant admin consent for the tenant.
2. Assign the app registration itself a Microsoft Entra directory role. Application permissions alone do not authorize user lifecycle writes; password and account changes need at least User Administrator.
3. Copy the Tenant ID, Client ID, and a Client Secret from the app registration.

**Set up in StackAI**

1. Open **Settings → Connections**, add a connection, and select **Microsoft Entra**.
2. Enter the credentials and connection details in the fields below.
3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

**Connection fields**

| StackAI field | Required | What to enter                                                                                                                                                              |
| ------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Tenant ID     | Yes      | Your Microsoft Entra Tenant Id. [Provider instructions](https://learn.microsoft.com/en-us/entra/fundamentals/how-to-find-tenant).                                          |
| Client ID     | Yes      | Your Microsoft Entra Client Id. [Provider instructions](https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app).                                |
| Client Secret | Yes      | Paste the secret Value from Microsoft Entra, not the Secret ID. [Provider instructions](https://learn.microsoft.com/en-us/entra/identity-platform/how-to-add-credentials). |

**Provider documentation:** [Setup reference](https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow).

#### Microsoft Entra Identity (OAuth2)

Connect to Microsoft Entra with directory write access for identity lifecycle work: provisioning and deactivating accounts, resetting passwords and multifactor methods, managing groups, and assigning application access. Requires tenant administrator consent and a Microsoft Entra directory role.

**Set up in Microsoft Entra**

1. Sign in with a Microsoft work or school account that holds a Microsoft Entra directory role.
2. Confirm the signing-in account holds the directory role each operation needs: User Administrator for account and password changes, Authentication Administrator for multifactor methods, Groups Administrator for groups, and Cloud Application Administrator for application assignment. Consent alone does not grant these.

**Set up in StackAI**

1. Open **Settings → Connections**, add a connection, and select **Microsoft Entra Identity (OAuth2)**.
2. Select **Connect**, sign in to the provider account, and review the requested access. Complete authorization to return to StackAI.
3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

StackAI obtains the OAuth credentials during sign-in. You do not need to paste an access token or refresh token.

**Provider documentation:** [Setup reference](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/permissions-reference).

#### Microsoft Entra (OAuth2, Legacy)

Legacy connector for reading directory data and managing group membership. It cannot perform identity lifecycle work such as creating or deactivating accounts, resetting credentials, or assigning application access. Existing connections keep working; for new setups use Microsoft Entra Identity (OAuth2).

**Set up in Microsoft Entra**

1. Use a Microsoft Entra account with access to the records and operations that your workflow needs.
2. If your organization restricts application access or user consent, have its administrator approve the connection before you sign in.

**Set up in StackAI**

1. Open **Settings → Connections**, add a connection, and select **Microsoft Entra (OAuth2, Legacy)**.
2. Select **Connect**, sign in to the provider account, and review the requested access. Complete authorization to return to StackAI.
3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

StackAI obtains the OAuth credentials during sign-in. You do not need to paste an access token or refresh token.

**Provider documentation:** [Setup reference](https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow).

#### Verify the connection

Check that the connection is healthy. Then run a read operation against a resource the connected account can access. A successful connection check confirms authentication; it does not guarantee permission for every action.

If access is denied, check the credential or OAuth permissions, the selected account or environment, and access to the specific resource. Update expired credentials or reconnect after permissions change.

#### Detailed setup guides

* [Allow StackAI in Microsoft Entra](https://docs.stackai.com/integrations/catalog/microsoft-entra/allow-stackai-in-microsoft-entra.md)

## Use an action

1. Add the required **Microsoft Entra** action to the workflow.
2. Select a connection when the action requests one.
3. Complete the required fields. Use the reference picker when a value comes from another workflow step.
4. Run the workflow and inspect the action’s output. Check the result before using it in a later step.

### Actions

#### Get Token

Get an OAuth access token from Microsoft Entra

**Inputs**

| Field                 | Type    | Required | Description                                                                                                                                                                                                                                                 |
| --------------------- | ------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Scope                 | string  | No       | The OAuth scope to request for the token.                                                                                                                                                                                                                   |
| Username              | string  | No       | The username or email address for authentication.                                                                                                                                                                                                           |
| Password              | secret  | No       | The password for authentication.                                                                                                                                                                                                                            |
| Request Refresh Token | boolean | No       | When enabled, adds 'offline\_access' scope to request a refresh token. Note: This may fail if your Azure AD app registration doesn't have the 'offline\_access' permission granted, or if Conditional Access policies block refresh tokens. Default: false. |

**Outputs**

| Field               | Type    | Description                                          |
| ------------------- | ------- | ---------------------------------------------------- |
| Access Token        | string  | The OAuth access token (JWT).                        |
| Token Type          | string  | The type of token issued.                            |
| Expires In          | integer | Token validity duration in seconds.                  |
| Extended Expires In | integer | Extended token validity duration in seconds.         |
| Scope               | string  | The scopes the access token is valid for.            |
| Refresh Token       | string  | OAuth refresh token for obtaining new access tokens. |
| ID Token            | string  | JWT containing claims about the authenticated user.  |

#### Exchange Token

Exchange an access token for another using On-Behalf-Of flow

**Inputs**

| Field           | Type     | Required | Description                                          |
| --------------- | -------- | -------- | ---------------------------------------------------- |
| Scope           | string   | No       | The OAuth scope to request for the new token.        |
| Assertion Token | textarea | No       | The access token to exchange (JWT assertion\_token). |

**Outputs**

| Field               | Type    | Description                                          |
| ------------------- | ------- | ---------------------------------------------------- |
| Access Token        | string  | The new OAuth access token (JWT).                    |
| Token Type          | string  | The type of token issued.                            |
| Expires In          | integer | Token validity duration in seconds.                  |
| Extended Expires In | integer | Extended token validity duration in seconds.         |
| Scope               | string  | The scopes the access token is valid for.            |
| Refresh Token       | string  | OAuth refresh token for obtaining new access tokens. |
| ID Token            | string  | JWT containing claims about the authenticated user.  |

#### Refresh Token

Get a new access token using a refresh token

**Inputs**

| Field         | Type     | Required | Description                                       |
| ------------- | -------- | -------- | ------------------------------------------------- |
| Refresh Token | textarea | No       | The refresh token from a previous Get Token call. |
| Scope         | string   | No       | The OAuth scope to request for the new token.     |

**Outputs**

| Field               | Type    | Description                                         |
| ------------------- | ------- | --------------------------------------------------- |
| Access Token        | string  | The new OAuth access token (JWT).                   |
| Token Type          | string  | The type of token issued.                           |
| Expires In          | integer | Token validity duration in seconds.                 |
| Extended Expires In | integer | Extended token validity duration in seconds.        |
| Scope               | string  | The scopes the access token is valid for.           |
| Refresh Token       | string  | New refresh token (tokens rotate with each use).    |
| ID Token            | string  | JWT containing claims about the authenticated user. |

#### List Members

List members of a Microsoft Entra group

**Inputs**

| Field | Type            | Required | Description                                                                                                             |
| ----- | --------------- | -------- | ----------------------------------------------------------------------------------------------------------------------- |
| Group | select (string) | Yes      | Select the Microsoft Entra group to inspect, or enter the group ID manually. Options load from the selected connection. |
| Limit | integer         | No       | Maximum number of members to retrieve from the first results page only. Defaults to 100. Default: 100.                  |

**Outputs**

| Field       | Type        | Description                               |
| ----------- | ----------- | ----------------------------------------- |
| Members     | dict\_array | Member display names and email addresses. |
| Total Count | integer     | Number of members returned.               |

#### Add Members

Add one or more members to a Microsoft Entra group

**Inputs**

| Field   | Type            | Required | Description                                                                                                                              |
| ------- | --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| Group   | select (string) | Yes      | Select the Microsoft Entra group that should receive members, or enter the group ID manually. Options load from the selected connection. |
| Members | array           | Yes      | One or more user mail addresses or user principal names to add.                                                                          |

**Outputs**

| Field          | Type        | Description                                                      |
| -------------- | ----------- | ---------------------------------------------------------------- |
| Added Members  | dict\_array | Members added to the group (display name and email only).        |
| Failed Members | dict\_array | Members that could not be added and the reason for each failure. |

#### Remove Members

Remove one or more members from a Microsoft Entra group

**Inputs**

| Field   | Type                      | Required | Description                                                                                                                                                              |
| ------- | ------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Group   | select (string)           | Yes      | Select the Microsoft Entra group to remove members from, or enter the group ID manually. Options load from the selected connection.                                      |
| Members | multiple\_select (string) | Yes      | Select one or more members from the chosen group, or enter email/UPN manually. The dropdown shows only the first 100 members. Options load from the selected connection. |

**Outputs**

| Field           | Type        | Description                                                        |
| --------------- | ----------- | ------------------------------------------------------------------ |
| Removed Members | dict\_array | Members removed from the group (display name and email only).      |
| Failed Members  | dict\_array | Members that could not be removed and the reason for each failure. |

#### Create User

Provision a new Microsoft Entra user. A random initial password is set and never revealed, so give the user a password reset email or phone so they can collect it through self-service password reset.

**Inputs**

| Field                | Type    | Required | Description                                                                                                        |
| -------------------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------ |
| Display Name         | string  | Yes      | The name shown for this user in Microsoft Entra.                                                                   |
| User Principal Name  | string  | Yes      | The sign-in address for the new user. The domain must be verified in your tenant.                                  |
| Mail Nickname        | string  | No       | Mail alias for the user. Defaults to the part of the sign-in address before the @ sign.                            |
| Job Title            | string  | No       | The new user's job title.                                                                                          |
| Department           | string  | No       | The new user's department.                                                                                         |
| Password Reset Email | string  | No       | An alternate email address to register as a password reset method, so the new user can collect their own password. |
| Password Reset Phone | string  | No       | A mobile number the user can use for self-service password reset.                                                  |
| Account Enabled      | boolean | No       | Whether the account can sign in as soon as it is created. Default: true.                                           |

**Outputs**

| Field                    | Type          | Description                                                                                                       |
| ------------------------ | ------------- | ----------------------------------------------------------------------------------------------------------------- |
| User                     | object        | The Microsoft Entra user after the operation.                                                                     |
| Registered Reset Methods | string\_array | Password reset methods registered for the user. Empty means the user cannot yet recover the account on their own. |
| Password Set             | boolean       | Whether an initial password was set on the account.                                                               |
| Force Password Change    | boolean       | Whether the user must change their password at first sign-in.                                                     |

#### Deactivate User

Disable a Microsoft Entra user account so the user cannot sign in

**Inputs**

| Field | Type            | Required | Description                                                                                                                             |
| ----- | --------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| User  | select (string) | Yes      | Select the Microsoft Entra user, or enter a mail address, user principal name, or object ID. Options load from the selected connection. |

**Outputs**

| Field | Type   | Description                                   |
| ----- | ------ | --------------------------------------------- |
| User  | object | The Microsoft Entra user after the operation. |

#### Enable User

Enable a Microsoft Entra user account so the user can sign in again

**Inputs**

| Field | Type            | Required | Description                                                                                                                             |
| ----- | --------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| User  | select (string) | Yes      | Select the Microsoft Entra user, or enter a mail address, user principal name, or object ID. Options load from the selected connection. |

**Outputs**

| Field | Type   | Description                                   |
| ----- | ------ | --------------------------------------------- |
| User  | object | The Microsoft Entra user after the operation. |

#### Update User Profile

Update department, manager, phone, address, and other profile fields

**Inputs**

| Field           | Type            | Required | Description                                                                                                                                                     |
| --------------- | --------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| User            | select (string) | Yes      | Select the Microsoft Entra user, or enter a mail address, user principal name, or object ID. Options load from the selected connection.                         |
| Job Title       | string          | No       | The user's job title. Leave empty to keep the current value.                                                                                                    |
| Department      | string          | No       | The user's department. Leave empty to keep the current value.                                                                                                   |
| Office Location | string          | No       | The user's office location. Leave empty to keep the current value.                                                                                              |
| Mobile Phone    | string          | No       | The user's mobile number, as directory contact information. Leave empty to keep the current value.                                                              |
| Street Address  | string          | No       | The user's street address. Leave empty to keep the current value.                                                                                               |
| City            | string          | No       | The user's city. Leave empty to keep the current value.                                                                                                         |
| State           | string          | No       | The user's state or province. Leave empty to keep the current value.                                                                                            |
| Postal Code     | string          | No       | The user's postal code. Leave empty to keep the current value.                                                                                                  |
| Country         | string          | No       | The user's country. Leave empty to keep the current value.                                                                                                      |
| Manager         | string          | No       | The manager's mail address, user principal name, or object ID. Microsoft Graph sets the manager through a separate call. Leave empty to keep the current value. |

**Outputs**

| Field | Type   | Description                                   |
| ----- | ------ | --------------------------------------------- |
| User  | object | The Microsoft Entra user after the operation. |

#### Revoke Sessions

Sign a Microsoft Entra user out of every device and application. The user must sign in again everywhere.

**Inputs**

| Field | Type            | Required | Description                                                                                                                             |
| ----- | --------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| User  | select (string) | Yes      | Select the Microsoft Entra user, or enter a mail address, user principal name, or object ID. Options load from the selected connection. |

**Outputs**

| Field            | Type    | Description                                              |
| ---------------- | ------- | -------------------------------------------------------- |
| User ID          | string  | Object ID of the user whose sessions were revoked.       |
| Sessions Revoked | boolean | Whether Microsoft Entra accepted the session revocation. |

#### List MFA Methods

List the multifactor authentication methods a Microsoft Entra user has registered, such as Authenticator, phone, or a security key

**Inputs**

| Field | Type            | Required | Description                                                                                                                             |
| ----- | --------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| User  | select (string) | Yes      | Select the Microsoft Entra user, or enter a mail address, user principal name, or object ID. Options load from the selected connection. |

**Outputs**

| Field                  | Type        | Description                                  |
| ---------------------- | ----------- | -------------------------------------------- |
| Authentication Methods | dict\_array | Multifactor methods the user has registered. |
| Total Count            | integer     | Number of registered multifactor methods.    |

#### Reset MFA Methods

Remove every multifactor method a user has registered so they must set up multifactor authentication again at their next sign-in. This cannot be undone.

**Inputs**

| Field | Type            | Required | Description                                                                                                                             |
| ----- | --------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| User  | select (string) | Yes      | Select the Microsoft Entra user, or enter a mail address, user principal name, or object ID. Options load from the selected connection. |

**Outputs**

| Field           | Type        | Description                             |
| --------------- | ----------- | --------------------------------------- |
| Deleted Methods | dict\_array | Methods removed from the user.          |
| Skipped Methods | dict\_array | Methods that were not removed, and why. |

#### Reset Password

Reset a user's password to a new random value and require them to change it at next sign-in. The new password is never shown, so the user recovers it through self-service password reset. This also clears a smart lockout.

**Inputs**

| Field | Type            | Required | Description                                                                                                                             |
| ----- | --------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| User  | select (string) | Yes      | Select the Microsoft Entra user, or enter a mail address, user principal name, or object ID. Options load from the selected connection. |

**Outputs**

| Field                 | Type    | Description                                                  |
| --------------------- | ------- | ------------------------------------------------------------ |
| User ID               | string  | Object ID of the user whose password was reset.              |
| Password Reset        | boolean | Whether Microsoft Entra confirmed the password was reset.    |
| Force Password Change | boolean | Whether the user must choose a new password at next sign-in. |

#### Assign App Access

Grant a Microsoft Entra user access to an enterprise application

**Inputs**

| Field            | Type            | Required | Description                                                                                                                                                |
| ---------------- | --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| User             | select (string) | Yes      | Select the Microsoft Entra user, or enter a mail address, user principal name, or object ID. Options load from the selected connection.                    |
| Application      | select (string) | Yes      | Select the enterprise application, or enter its service principal object ID. Options load from the selected connection.                                    |
| Application Role | select (string) | No       | The role to grant within the application. Leave empty for default access when the application exposes no roles. Options load from the selected connection. |

**Outputs**

| Field         | Type   | Description                                             |
| ------------- | ------ | ------------------------------------------------------- |
| Assignment ID | string | ID of the assignment, needed to revoke it later.        |
| User ID       | string | Object ID of the user who was granted access.           |
| Application   | string | Name of the application the user was granted access to. |

#### Revoke App Access

Remove a Microsoft Entra user's access to an enterprise application. This does not sign the user out of sessions they already hold.

**Inputs**

| Field                  | Type            | Required | Description                                                                                                                                             |
| ---------------------- | --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| User                   | select (string) | Yes      | Select the Microsoft Entra user, or enter a mail address, user principal name, or object ID. Options load from the selected connection.                 |
| Application Assignment | select (string) | Yes      | The application assignment to remove. Choose from the user's current assignments, or enter an assignment ID. Options load from the selected connection. |

**Outputs**

| Field          | Type    | Description                                     |
| -------------- | ------- | ----------------------------------------------- |
| User ID        | string  | Object ID of the user whose access was revoked. |
| Assignment ID  | string  | The assignment that was removed.                |
| Access Revoked | boolean | Whether Microsoft Entra removed the assignment. |

#### Get User Access

List the enterprise applications and licences assigned to a Microsoft Entra user, for an access review or before offboarding

**Inputs**

| Field | Type            | Required | Description                                                                                                                             |
| ----- | --------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| User  | select (string) | Yes      | Select the Microsoft Entra user, or enter a mail address, user principal name, or object ID. Options load from the selected connection. |

**Outputs**

| Field        | Type        | Description                                      |
| ------------ | ----------- | ------------------------------------------------ |
| User ID      | string      | Object ID of the user.                           |
| Applications | dict\_array | Enterprise applications the user is assigned to. |
| Licenses     | dict\_array | Licences assigned to the user.                   |

#### Create Group

Create a Microsoft Entra security group or Microsoft 365 group, then add members to it with Add Members

**Inputs**

| Field         | Type            | Required | Description                                                                                                                                                                                   |
| ------------- | --------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Group Name    | string          | Yes      | The name shown for this group in Microsoft Entra.                                                                                                                                             |
| Group Type    | select (string) | No       | A security group controls access to resources. A Microsoft 365 group also gets a shared mailbox and calendar. Available values: Security group, Microsoft 365 group. Default: security.       |
| Mail Nickname | string          | No       | Mail alias for the group. Defaults to the group name with spaces removed.                                                                                                                     |
| Owner         | string          | No       | The user who will own the group, as a mail address, user principal name, or object ID. Required for a Microsoft 365 group on a credentials connection, which has no signed-in user to own it. |
| Description   | string          | No       | What this group is for.                                                                                                                                                                       |

**Outputs**

| Field        | Type   | Description                                                   |
| ------------ | ------ | ------------------------------------------------------------- |
| Group ID     | string | Object ID of the created group.                               |
| Group Name   | string | Name of the created group.                                    |
| Mail Address | string | Mail address of the group. Only Microsoft 365 groups get one. |

#### Delete Group

Delete a Microsoft Entra group. Microsoft 365 and security groups move to deleted items and can be restored for 30 days; distribution groups are removed immediately. Check Recoverable For (Days) in the result.

**Inputs**

| Field | Type            | Required | Description                                                                                                            |
| ----- | --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------- |
| Group | select (string) | Yes      | Select the Microsoft Entra group to delete, or enter the group ID manually. Options load from the selected connection. |

**Outputs**

| Field                  | Type    | Description                                                                                                |
| ---------------------- | ------- | ---------------------------------------------------------------------------------------------------------- |
| Group ID               | string  | Object ID of the deleted group.                                                                            |
| Deleted                | boolean | Whether Microsoft Entra deleted the group.                                                                 |
| Recoverable For (Days) | integer | How long the group can still be restored from deleted items before Microsoft Entra removes it permanently. |

### Important behavior

If an operation is denied, check the connection’s granted permissions and the account’s access in the provider. Reauthorize the connection when it needs additional permissions.

Actions that create, update, send, or delete data can change the connected service. Review their inputs before running them. A retry can repeat an operation; consider this when configuring retries for actions that change data.

The catalog lists the fields and capabilities available in the supplied provider definition. Availability can also depend on your deployment and organization’s Feature Access settings.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/integrations/catalog/microsoft-entra.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
