Microsoft


Overview

The Microsoft Connector provides comprehensive integration with Microsoft 365 services through the Microsoft Graph API. This connector enables organizations to automate user management tasks, including creating and managing user accounts, granting licenses, managing email configurations, and generating temporary passwords. Developed by the Leena AI Integration Team, this connector streamlines Microsoft 365 administrative operations.

API Details

Leena AI integrates with Microsoft 365 via Microsoft Graph API.

Documentation link: https://learn.microsoft.com/en-us/graph/overview

Setup

The Microsoft Connector uses OAuth 2.0 Client Credentials Flow for secure authentication with Microsoft Graph API.

Prerequisites

Before setting up the Microsoft connector, ensure you have:

  • Administrator access to your Azure Portal
  • Access to Azure Active Directory
  • Ability to create app registrations in Azure
  • Access to your Leena AI workspace with connector management permissions

Get credentials

Here is how to create an app registration in Azure:

  1. Navigate to Azure Portal at https://portal.azure.com/#home

  2. Click on New Registration

  3. Configure App Registration:

  4. Name: Provide the name of the application

  5. Copy the Tenant ID and Client ID from the overview page


  6. Create Client Secret:

    1. Click on 'Certificates and secrets'

    2. Click on New Client Secret

    3. Select an expiry period (commonly configured as 24 Months)

    4. Copy the Secret value immediately (it won't be shown again)

  7. Configure API Permissions:

    1. Go to API Permissions (on the left side tab)

    2. Click on Add a permission

    3. Select the relevant permissions based on your use case:

      • User.ReadWrite.All

      • UserAuthenticationMethod.ReadWrite.All

      • User-PasswordProfile.ReadWrite.All

    4. After adding permissions, click on Grant admin permission

  8. Create App Role:

    1. Click on App role, then Create App role

    2. Under the pop-up, add the details:

      • Name: Name of Application
      • Member types: Select Applications
      • Value: User.ReadWrite.All, UserAuthenticationMethod.ReadWrite.All, User-PasswordProfile.ReadWrite.All

Add connection

Here is how to add a connection on Leena AI:

  1. Log in to your Leena AI workspace
  2. Navigate to Settings > Integrations
  3. Search for "Microsoft" and select it from the list to add its new connector
  4. Click on Connect and configure the following details:
    1. Tenant ID: The Azure AD tenant ID (Directory ID) from step 4 of app registration
    2. Client ID: The Application (client) ID from your Azure AD app registration from step 4
    3. Client Secret: The client secret value from step 5 of app registration
  5. Save the connector configuration

Actions

The following actions are supported for the Microsoft connector:

List Users

Retrieves users from Microsoft 365 tenant with optional filtering and pagination. The Agent can leverage the skill (workflow), which has been designed to retrieve a list of users from the Microsoft 365 tenant, once the user raises a query to do so.

Input Parameters

Here are the input parameters required to set up this action:

Optional

NameDescription
FilterOData filter query to narrow down results (e.g., "startswith(displayName,'John')")
CountBoolean to include count of items in response
SelectComma-separated list of properties to include in results
ExpandComma-separated list of relationships to expand in the response
TopNumber of items to return (pagination)
OrderByProperty name and direction for sorting results
SearchSearch query string for filtering results
Skip TokenToken for continuing pagination from a previous request

Here is a sample JSON input:

{
  "Filter": "startswith(displayName,'John')",
  "Select": "displayName,userPrincipalName,mail",
  "Top": 50,
  "OrderBy": "displayName"
}

Response

The action returns a list of users, each containing the requested properties such as display name, user principal name, email, and other selected attributes.

Create User

Creates a new user account in Microsoft 365. The Agent can leverage the skill (workflow), which has been designed to create a new user account in Microsoft 365, once the user provides the required details.

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
Display NameThe user's full display name
User Principal NameThe user's login name ([email protected])
Mail NicknameThe mail alias for the user (username portion of email)
PasswordInitial password for the user account
Account EnabledBoolean to enable or disable the account upon creation

Here is a sample JSON input:

{
  "Display Name": "John Doe",
  "User Principal Name": "[email protected]",
  "Mail Nickname": "john.doe",
  "Password": "TempPassword123!",
  "Account Enabled": true
}

Response

Upon successful creation, the action returns the created user details including user ID, display name, user principal name, and account status.

Update User

Modifies an existing user account in Microsoft 365. The Agent can leverage the skill (workflow), which has been designed to update user account details in Microsoft 365, once the user specifies the updates to be made.

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
User IDThe ID of the user to update
JSON BodyUpdate payload in JSON format containing attributes to modify

Here is a sample JSON input:

{
  "User ID": "12345678-1234-1234-1234-123456789012",
  "JSON Body": {
    "displayName": "John A. Doe",
    "jobTitle": "Senior Manager",
    "department": "Sales"
  }
}

Response

Upon successful update, the action returns confirmation of the updated user details.

Delete User

Removes a user account from Microsoft 365. The Agent can leverage the skill (workflow), which has been designed to delete a user account from Microsoft 365, once the user confirms the deletion.

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
User IDThe ID of the user to delete

Here is a sample JSON input:

{
  "User ID": "12345678-1234-1234-1234-123456789012"
}

Response

Upon successful deletion, the action returns confirmation of the user account removal.

Assign License

Assigns Microsoft 365 licenses to a user. The Agent can leverage the skill (workflow), which has been designed to assign licenses to users in Microsoft 365, once the user provides the license details.

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
User IDThe ID of the user to assign licenses to
License SKU IDsArray of license SKU IDs to assign

Optional

NameDescription
Disabled PlansOptional array of service plans to disable within the licenses

Here is a sample JSON input:

{
  "User ID": "12345678-1234-1234-1234-123456789012",
  "License SKU IDs": [
    "c42b9cae-ea4f-4ab7-9717-81576235ccac",
    "6fd2c87f-b296-42f0-b197-1e91e994b900"
  ],
  "Disabled Plans": []
}

Response

Upon successful assignment, the action returns confirmation of the licenses assigned to the user.

Reset Password

Resets a user's password and optionally generates a temporary password. The Agent can leverage the skill (workflow), which has been designed to reset user passwords in Microsoft 365, once the user requests a password reset.

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
User IDThe ID of the user whose password will be reset

Optional

NameDescription
New PasswordThe new password to set (leave empty to auto-generate)
Force Change PasswordBoolean to require password change at next sign-in
Generate Temporary PasswordBoolean to generate a random temporary password

Here is a sample JSON input:

{
  "User ID": "12345678-1234-1234-1234-123456789012",
  "Force Change Password": true,
  "Generate Temporary Password": true
}

Response

Upon successful reset, the action returns the new password details and confirmation of the password reset.

Get User Details

Retrieves detailed information about a specific user. The Agent can leverage the skill (workflow), which has been designed to fetch user details from Microsoft 365, once the user requests information about a specific user.

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
User IDThe ID of the user to retrieve details for

Optional

NameDescription
SelectComma-separated list of properties to include
ExpandComma-separated list of relationships to expand

Here is a sample JSON input:

{
  "User ID": "12345678-1234-1234-1234-123456789012",
  "Select": "displayName,mail,jobTitle,department",
  "Expand": "manager"
}

Response

The action returns detailed user information including the requested properties and expanded relationships.

List Groups

Retrieves groups from Microsoft 365 tenant with optional filtering. The Agent can leverage the skill (workflow), which has been designed to list groups from Microsoft 365, once the user raises a query to do so.

Input Parameters

Here are the input parameters required to set up this action:

Optional

NameDescription
FilterOData filter query to narrow down results
SelectComma-separated list of properties to include
ExpandComma-separated list of relationships to expand
TopNumber of items to return

Here is a sample JSON input:

{
  "Filter": "startswith(displayName,'Sales')",
  "Select": "displayName,mail,description",
  "Top": 25
}

Response

The action returns a list of groups with the requested properties.

Add Group Member

Adds a user to a Microsoft 365 group. The Agent can leverage the skill (workflow), which has been designed to add users to groups in Microsoft 365, once the user provides the group and user details.

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
Group IDThe ID of the group to add the member to
User IDThe ID of the user to add as a member

Here is a sample JSON input:

{
  "Group ID": "87654321-4321-4321-4321-210987654321",
  "User ID": "12345678-1234-1234-1234-123456789012"
}

Response

Upon successful addition, the action returns confirmation that the user has been added to the group.

Send Email

Sends an email message from a user's account or shared mailbox. The Agent can leverage the skill (workflow), which has been designed to send emails through Microsoft 365, once the user provides the email details.

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
User IDThe ID of the user from whose mail-box to send the email
To RecipientsArray of email addresses for the To field
SubjectEmail subject line
Body ContentContent of the email body
Body TypeFormat of the body content (HTML or Text)

Optional

NameDescription
CC RecipientsOptional array of email addresses for the CC field
BCC RecipientsOptional array of email addresses for the BCC field
AttachmentsOptional array of file attachments

Here is a sample JSON input:

{
  "User ID": "12345678-1234-1234-1234-123456789012",
  "To Recipients": [
    "[email protected]",
    "[email protected]"
  ],
  "Subject": "Welcome to the Team",
  "Body Content": "<p>Welcome to our organization! We're excited to have you on board.</p>",
  "Body Type": "HTML",
  "CC Recipients": [
    "[email protected]"
  ]
}

Response

Upon successful sending, the action returns confirmation that the email has been sent.