PowerShell for Exchange/O365
Overview
The PowerShell connector enables your Leena AI Agents to integrate with Microsoft 365 and Exchange Online environments, facilitating automated PowerShell script execution, mailbox management, and distribution list operations.
PowerShell is Microsoft's task automation and configuration management framework. The PowerShell connector allows Leena AI to automate Microsoft 365 operations, manage Exchange Online resources, and execute custom scripts seamlessly.
API Details
Leena AI integrates with Microsoft 365 via Microsoft Graph API and Exchange Online PowerShell.
Documentation link: https://learn.microsoft.com/en-us/graph/overview
Setup
The PowerShell connector uses OAuth 2.0 authentication with Azure Active Directory.
Prerequisites
Before setting up the PowerShell connector, ensure you have:
- Azure Active Directory (Azure AD) admin access
- Microsoft 365 admin permissions
- Access to Exchange Online
- PowerShell execution permissions
- Azure AD application registration capabilities
- Access to your Leena AI workspace with connector management permissions
Get credentials
Here is how to register an application in Azure AD:
- Sign in to the Azure Portal
- Navigate to Azure Active Directory:
- Click on Azure Active Directory in the sidebar
- Select App registrations
- Create New Registration:
- Click New registration
- Configure the application:
- Name: Enter a descriptive name (e.g., "Leena AI PowerShell Connector")
- Supported account types: Select based on your organization needs
- Redirect URI: Can be configured later if needed
- Click Register
- Note down the Application (client) ID
- Create Client Secret:
- In your app registration, go to Certificates & secrets
- Click New client secret
- Add a description (e.g., "Leena AI PowerShell Secret")
- Select an expiration period
- Click Add
- Important: Copy the client secret value immediately - it won't be shown again
- Configure API Permissions:
- In your app registration, go to API permissions
- Click Add a permission
- Select Microsoft Graph
- Add the following Application permissions:
- User.Read.All
- Group.ReadWrite.All
- Mail.ReadWrite
- Add Exchange Online permissions if needed
- Click Grant admin consent for your organization
- Note Your Tenant ID:
- In Azure AD overview, locate your Tenant ID
- Copy this value for configuration
Add connection
Here is how to add a connection on Leena AI:
- Log in to your Leena AI workspace
- Navigate to Settings > Integrations
- Search for "PowerShell" and select it from the list to add its new connector
- Start configuring the connector
- Client ID: Your Azure AD application (client) ID
- Client Secret: The secret created in Azure AD
- Tenant ID: Your Azure AD tenant ID
- Scope: Microsoft Graph API scope (Pre-filled with 'https://graph.microsoft.com/.default')
- Save the connector configuration
Actions
The following actions are supported for the PowerShell connector:
Create Shared Mailbox
Creates a new shared mailbox in Microsoft 365 or Exchange Online. The Agent can leverage the skill (workflow), which has been designed to create a shared mailbox, once the user provides the required mailbox details.
Input Parameters
Here are the input parameters required to set up this action:
Mandatory
| Name | Description | Example |
|---|---|---|
| Script Type | Action identifier for creating shared mailbox | create-shared-mailbox |
| Shared Mailbox Name | Display name for the mailbox | Marketing Team |
| Shared Mailbox Alias | Alias for the mailbox | marketing-team |
| Shared Mailbox Email | Email address for the mailbox | [email protected] |
Here is a sample JSON input:
{
"Script Type": "create-shared-mailbox",
"Shared Mailbox Name": "Marketing Team",
"Shared Mailbox Alias": "marketing-team",
"Shared Mailbox Email": "[email protected]"
}Response
Upon successful creation, the action returns confirmation of the created shared mailbox.
Add Users to Shared Mailbox
Adds users to an existing shared mailbox with specified access permissions. The Agent can leverage the skill (workflow), which has been designed to grant mailbox access to users. This action supports different types of access including Full Access, Send As, and Send on Behalf permissions.
Input Parameters
Here are the input parameters required to set up this action:
Mandatory
| Name | Description | Example |
|---|---|---|
| Script Type | Action identifier for adding mailbox permissions | add-mailbox-permission |
| Shared Mailbox Email | Target mailbox email address | [email protected] |
| Users | List of users to add access for | ["[email protected]", "[email protected]"] |
| Access Rights | Type of permission to grant | FullAccess |
Here is a sample JSON input:
{
"Script Type": "add-mailbox-permission",
"Shared Mailbox Email": "[email protected]",
"Users": [
"[email protected]",
"[email protected]"
],
"Access Rights": "FullAccess"
}Response
Upon successful execution, the action returns confirmation that users have been added to the shared mailbox with specified permissions.
Remove Users from Shared Mailbox
Removes users from an existing shared mailbox. The Agent can leverage the skill (workflow), which has been designed to revoke mailbox access from users. This action supports removing different types of access including Full Access, Send As, and Send on Behalf permissions.
Input Parameters
Here are the input parameters required to set up this action:
Mandatory
| Name | Description | Example |
|---|---|---|
| Shared Mailbox Email | Target mailbox email address | [email protected] |
| Users | List of users to remove access from | ["[email protected]", "[email protected]"] |
Here is a sample JSON input:
{
"Shared Mailbox Email": "[email protected]",
"Users": [
"[email protected]",
"[email protected]"
]
}Response
Upon successful execution, the action returns confirmation that users have been removed from the shared mailbox.
Create Distribution Group/List
Creates a new distribution list or group in Microsoft 365. The Agent can leverage the skill (workflow), which has been designed to create distribution lists for email communication.
Input Parameters
Here are the input parameters required to set up this action:
Mandatory
| Name | Description | Example |
|---|---|---|
| Script Type | Action identifier for creating distribution list | create-distribution-list |
| List Name | Name of the distribution list | All Employees |
| List Email | Email address for the distribution list | [email protected] |
Optional
| Name | Description | Example |
|---|---|---|
| Members | Initial members to add to the list | ["[email protected]", "[email protected]"] |
Here is a sample JSON input:
{
"Script Type": "create-distribution-list",
"List Name": "All Employees",
"List Email": "[email protected]",
"Members": [
"[email protected]",
"[email protected]"
]
}Response
Upon successful creation, the action returns confirmation of the created distribution list.
Add Members to Distribution Group/List
Adds members to an existing distribution list or group. The Agent can leverage the skill (workflow), which has been designed to add members to distribution lists. This is particularly useful for onboarding workflows where new employees need to be added to relevant distribution lists.
Input Parameters
Here are the input parameters required to set up this action:
Mandatory
| Name | Description | Example |
|---|---|---|
| List Email | Distribution list email address | [email protected] |
| Users | List of members to add | ["[email protected]"] |
Here is a sample JSON input:
{
"List Email": "[email protected]",
"Users": [
"[email protected]"
]
}Response
Upon successful execution, the action returns confirmation that members have been added to the distribution list.
Remove Members from Distribution Group/List
Removes members from an existing distribution list or group. The Agent can leverage the skill (workflow), which has been designed to remove members from distribution lists. This is particularly useful for offboarding workflows where departing employees need to be removed from distribution lists.
Input Parameters
Here are the input parameters required to set up this action:
Mandatory
| Name | Description | Example |
|---|---|---|
| List Email | Distribution list email address | [email protected] |
| Users | List of members to remove | ["[email protected]"] |
Here is a sample JSON input:
{
"List Email": "[email protected]",
"Users": [
"[email protected]"
]
}Response
Upon successful execution, the action returns confirmation that members have been removed from the distribution list.
Updated about 19 hours ago
