# Microsoft Exchange

![MS Exchange logo.png](https://assets.relyanceuat.xyz/images/docs/33250694718861/33250717699597.png)
Microsoft Exchange is a messaging and collaboration platform that provides email, calendar, contact management, and task-sharing features for businesses. It supports seamless communication and organization across teams with robust security, scalability, and integration capabilities.

In order to integrate Microsoft Exchange with Relyance AI you will need to follow an OAuth2 flow.

#### In the Relyance AI application:

1. Login to your Relyance account.
2. Navigate to the **Settings** Menu in the bottom left-hand side.
3. Select **Integrations**.
4. Click on the **Vendor Integration** tab.
5. Find the **Microsoft Exchange** integration card and click it to open its connections.
6. Under **Authentication Method**, choose **Oauth2 / App Token**.
8. Additional Features:
    - Use the **Asset Discovery** checkbox if you wish to run this integration with the Asset Intelligence Module.
    - Select the **Enable Data Inspection** checkbox if you wish Relyance also to inspect the data. For more information on Relyance features, please refer to this help center article: [here](/docs/introduction-to-relyance-ai/integration-features/).
9. Click **Authenticate**.
10. This will bring you to the Microsoft site to authorize Relyance. You may be asked to sign in. Once authorized, you'll be redirected back to Relyance.
11. At this point, you should see the following result on the **Vendor** Integrations page:

![MSExchange_1.png](https://assets.relyanceuat.xyz/images/docs/33250694718861/33250694706317.png)

![MSExchange_2.png](https://assets.relyanceuat.xyz/images/docs/33250694718861/33250717709069.png)

12. Congratulations, you are now connected to **Microsoft Exchange**.

### Verify the connection is really working

The permissions are the *.Shared* variants — `Mail.Read.Shared`,
`Calendars.Read.Shared`, `Contacts.Read.Shared` — plus `User.Read.All`.

1. **Connected but nothing discovered** is admin consent, which is granted per
   permission and issues a valid token regardless. Check each entry reads "Granted
   for &lt;organization&gt;".
2. **Some mailboxes return nothing.** The `.Shared` permissions read what has been
   shared with the app's identity. A mailbox that has not been shared, or is
   excluded by an Exchange **application access policy**, produces no results and no
   error — that policy is the usual reason a subset of mailboxes is silently
   invisible.
3. **A connection that worked and then stopped** is the client secret expiring;
   record the date in the connection's **Credentials expiry** field.

<!-- terraform-examples:begin (generated from the integration catalog; do not hand-edit) -->

## Manage this integration with Terraform

Connections for this integration can be managed as code with the [Relyance Terraform provider](https://registry.terraform.io/providers/Relyance/relyance/latest). Non-secret fields go in `auth.params`; secret fields go in `auth.secrets_wo`, which is write-only — never stored in Terraform state. Rotate secrets by bumping `auth.secrets_wo_version`.

The **OAuth (browser authorization)** method uses a browser authorization flow, so the connection is created in the Relyance app. Manage it in Terraform afterwards by importing it (`terraform import relyance_integration_connection.example microsoft_exchange/<connection_id>`) or reading it with the `relyance_integration_connection` data source.

<!-- terraform-examples:end -->
